This project has retired. For details please refer to its
Attic page.
LegacyArtifactPath xref
1 package org.apache.archiva.admin.model.beans;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import javax.xml.bind.annotation.XmlRootElement;
22 import java.io.Serializable;
23
24
25
26
27
28 @XmlRootElement( name = "legacyArtifactPath" )
29 public class LegacyArtifactPath
30 implements Serializable
31 {
32
33
34
35 private String path;
36
37
38
39
40
41 private String artifact;
42
43 private String groupId;
44
45 private String artifactId;
46
47 private String version;
48
49 private String classifier;
50
51 private String type;
52
53 public LegacyArtifactPath()
54 {
55
56 }
57
58 public LegacyArtifactPath( String path, String artifact )
59 {
60 this.path = path;
61
62 this.artifact = artifact;
63 initValues( this.artifact );
64 }
65
66 private void initValues( String artifact )
67 {
68 String[] splitted = artifact.split( ":" );
69 if ( splitted.length < 4 )
70 {
71 throw new IllegalArgumentException( "artifact value '" + artifact + "' is not correct" );
72 }
73 this.groupId = splitted[0];
74 this.artifactId = splitted[1];
75 this.version = splitted[2];
76 String classifier = splitted.length >= 4 ? splitted[3] : null;
77 this.classifier = classifier.length() > 0 ? classifier : null;
78 String type = splitted.length >= 5 ? splitted[4] : null;
79 this.type = type.length() > 0 ? artifact.split( ":" )[4] : null;
80 }
81
82 public String getPath()
83 {
84 return path;
85 }
86
87 public void setPath( String path )
88 {
89 this.path = path;
90 }
91
92 public String getArtifact()
93 {
94 return artifact;
95 }
96
97 public void setArtifact( String artifact )
98 {
99 this.artifact = artifact;
100 initValues( this.artifact );
101 }
102
103 public boolean match( String path )
104 {
105 return path.equals( this.path );
106 }
107
108 public void setGroupId( String groupId )
109 {
110 this.groupId = groupId;
111 }
112
113 public String getGroupId()
114 {
115 return this.groupId;
116 }
117
118
119 public String getArtifactId()
120 {
121 return this.artifactId;
122 }
123
124 public void setArtifactId( String artifactId )
125 {
126 this.artifactId = artifactId;
127 }
128
129 public String getVersion()
130 {
131 return this.version;
132 }
133
134 public String getClassifier()
135 {
136
137
138 return this.classifier;
139 }
140
141 public String getType()
142 {
143 return this.type;
144 }
145
146 @Override
147 public boolean equals( Object o )
148 {
149 if ( this == o )
150 {
151 return true;
152 }
153 if ( o == null || getClass() != o.getClass() )
154 {
155 return false;
156 }
157
158 LegacyArtifactPath that = (LegacyArtifactPath) o;
159
160 if ( path != null ? !path.equals( that.path ) : that.path != null )
161 {
162 return false;
163 }
164
165 return true;
166 }
167
168 @Override
169 public int hashCode()
170 {
171 return path != null ? 37 + path.hashCode() : 0;
172 }
173
174 @Override
175 public String toString()
176 {
177 final StringBuilder sb = new StringBuilder();
178 sb.append( "LegacyArtifactPath" );
179 sb.append( "{path='" ).append( path ).append( '\'' );
180 sb.append( ", artifact='" ).append( artifact ).append( '\'' );
181 sb.append( ", groupId='" ).append( groupId ).append( '\'' );
182 sb.append( ", artifactId='" ).append( artifactId ).append( '\'' );
183 sb.append( ", version='" ).append( version ).append( '\'' );
184 sb.append( ", classifier='" ).append( classifier ).append( '\'' );
185 sb.append( ", type='" ).append( type ).append( '\'' );
186 sb.append( '}' );
187 return sb.toString();
188 }
189 }