1 package org.apache.maven.artifact;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.HashMap;
23 import java.util.Map;
24
25
26
27
28
29
30
31 public final class ArtifactStatus
32 implements Comparable
33 {
34
35
36
37 public static final ArtifactStatus NONE = new ArtifactStatus( "none", 0 );
38
39
40
41
42 public static final ArtifactStatus GENERATED = new ArtifactStatus( "generated", 1 );
43
44
45
46
47 public static final ArtifactStatus CONVERTED = new ArtifactStatus( "converted", 2 );
48
49
50
51
52 public static final ArtifactStatus PARTNER = new ArtifactStatus( "partner", 3 );
53
54
55
56
57 public static final ArtifactStatus DEPLOYED = new ArtifactStatus( "deployed", 4 );
58
59
60
61
62 public static final ArtifactStatus VERIFIED = new ArtifactStatus( "verified", 5 );
63
64 private final int rank;
65
66 private final String key;
67
68 private static Map map;
69
70 private ArtifactStatus( String key, int rank )
71 {
72 this.rank = rank;
73 this.key = key;
74
75 if ( map == null )
76 {
77 map = new HashMap();
78 }
79 map.put( key, this );
80 }
81
82 public static ArtifactStatus valueOf( String status )
83 {
84 ArtifactStatus retVal = null;
85
86 if ( status != null )
87 {
88 retVal = (ArtifactStatus) map.get( status );
89 }
90
91 return retVal != null ? retVal : NONE;
92 }
93
94 public boolean equals( Object o )
95 {
96 if ( this == o )
97 {
98 return true;
99 }
100 if ( o == null || getClass() != o.getClass() )
101 {
102 return false;
103 }
104
105 final ArtifactStatus that = (ArtifactStatus) o;
106
107 return rank == that.rank;
108
109 }
110
111 public int hashCode()
112 {
113 return rank;
114 }
115
116 public String toString()
117 {
118 return key;
119 }
120
121 public int compareTo( Object o )
122 {
123 ArtifactStatus s = (ArtifactStatus) o;
124 return rank - s.rank;
125 }
126 }