1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.owasp.dependencycheck.data.nexus;
19
20 import java.io.Serializable;
21 import javax.annotation.concurrent.ThreadSafe;
22
23
24
25
26
27
28
29 @ThreadSafe
30 public class MavenArtifact implements Serializable {
31
32
33
34
35 private static final long serialVersionUID = -9112154330099159722L;
36
37
38
39
40 private String groupId;
41
42
43
44
45 private String artifactId;
46
47
48
49
50 private String version;
51
52
53
54
55
56 private String artifactUrl;
57
58
59
60 private String pomUrl;
61
62
63
64
65 public MavenArtifact() {
66 }
67
68
69
70
71
72
73
74
75 public MavenArtifact(String groupId, String artifactId, String version) {
76 this.groupId = groupId;
77 this.artifactId = artifactId;
78 this.version = version;
79 }
80
81
82
83
84
85
86
87
88
89 public MavenArtifact(String groupId, String artifactId, String version, String url) {
90 this.groupId = groupId;
91 this.artifactId = artifactId;
92 this.version = version;
93 this.artifactUrl = url;
94 }
95
96
97
98
99
100
101
102
103
104
105 public MavenArtifact(String groupId, String artifactId, String version, String artifactUrl, String pomUrl) {
106 this.groupId = groupId;
107 this.artifactId = artifactId;
108 this.version = version;
109 this.artifactUrl = artifactUrl;
110 this.pomUrl = pomUrl;
111 }
112
113
114
115
116
117
118
119
120
121 public static String derivePomUrl(String artifactId, String version, String artifactUrl) {
122 return artifactUrl.substring(0, artifactUrl.lastIndexOf('/')) + '/' + artifactId + '-' + version + ".pom";
123 }
124
125
126
127
128
129
130 @Override
131 public String toString() {
132 return String.format("%s:%s:%s", groupId, artifactId, version);
133 }
134
135
136
137
138
139
140 public String getGroupId() {
141 return groupId;
142 }
143
144
145
146
147
148
149 public void setGroupId(String groupId) {
150 this.groupId = groupId;
151 }
152
153
154
155
156
157
158 public String getArtifactId() {
159 return artifactId;
160 }
161
162
163
164
165
166
167 public void setArtifactId(String artifactId) {
168 this.artifactId = artifactId;
169 }
170
171
172
173
174
175
176 public String getVersion() {
177 return version;
178 }
179
180
181
182
183
184
185 public void setVersion(String version) {
186 this.version = version;
187 }
188
189
190
191
192
193
194 public String getArtifactUrl() {
195 return artifactUrl;
196 }
197
198
199
200
201
202
203 public void setArtifactUrl(String artifactUrl) {
204 this.artifactUrl = artifactUrl;
205 }
206
207
208
209
210
211
212 public String getPomUrl() {
213 return pomUrl;
214 }
215
216
217
218
219
220
221 public void setPomUrl(String pomUrl) {
222 this.pomUrl = pomUrl;
223 }
224
225 }