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