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