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