1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package org.codehaus.mojo.license.model;
26
27 import org.apache.maven.artifact.Artifact;
28 import org.apache.maven.model.License;
29
30 import java.util.ArrayList;
31 import java.util.List;
32
33
34
35
36
37
38
39 public class ProjectLicenseInfo
40 {
41 private String groupId;
42
43 private String artifactId;
44
45 private String version;
46
47 private List<License> licenses = new ArrayList<License>();
48
49 private String licenseResolutionResult;
50
51 public String getLicenseResolutionResult()
52 {
53 return licenseResolutionResult;
54 }
55
56 public void setLicenseResolutionResult( String licenseResolutionResult )
57 {
58 this.licenseResolutionResult = licenseResolutionResult;
59 }
60
61
62
63
64 public ProjectLicenseInfo()
65 {
66
67 }
68
69 public ProjectLicenseInfo( String groupId, String artifactId, String version )
70 {
71 this.groupId = groupId;
72 this.artifactId = artifactId;
73 this.version = version;
74 }
75
76 public String getGroupId()
77 {
78 return groupId;
79 }
80
81 public void setGroupId( String groupId )
82 {
83 this.groupId = groupId;
84 }
85
86 public String getArtifactId()
87 {
88 return artifactId;
89 }
90
91 public void setArtifactId( String artifactId )
92 {
93 this.artifactId = artifactId;
94 }
95
96 public String getVersion()
97 {
98 return version;
99 }
100
101 public void setVersion( String version )
102 {
103 this.version = version;
104 }
105
106 public List<License> getLicenses()
107 {
108 return licenses;
109 }
110
111 public void setLicenses( List<License> licenses )
112 {
113 this.licenses = licenses;
114 }
115
116 public void addLicense( License license )
117 {
118 licenses.add( license );
119 }
120
121 public String toString()
122 {
123 return getId();
124 }
125
126
127
128
129
130
131 public String getId()
132 {
133 return groupId + ":" + artifactId;
134 }
135
136
137
138
139
140 public boolean equals( Object compareTo )
141 {
142 if ( compareTo instanceof ProjectLicenseInfo )
143 {
144 ProjectLicenseInfo compare = (ProjectLicenseInfo) compareTo;
145 if ( groupId.equals( compare.getGroupId() ) && artifactId.equals( compare.getArtifactId() ) )
146 {
147 return true;
148 }
149 }
150 if ( compareTo instanceof Artifact )
151 {
152 Artifact compare = (Artifact) compareTo;
153 if ( groupId.equals( compare.getGroupId() ) && artifactId.equals( compare.getArtifactId() ) )
154 {
155 return true;
156 }
157 }
158 return false;
159 }
160
161 public int hashCode()
162 {
163 return getId().hashCode();
164 }
165
166 }