1 | |
package org.apache.maven.archiva.dependency.graph; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.apache.maven.archiva.model.ArtifactReference; |
23 | |
import org.apache.maven.archiva.model.Dependency; |
24 | |
import org.apache.maven.archiva.model.Exclusion; |
25 | |
|
26 | |
import java.util.ArrayList; |
27 | |
import java.util.HashSet; |
28 | |
import java.util.List; |
29 | |
import java.util.Set; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
public class DependencyGraphNode |
37 | |
{ |
38 | |
|
39 | |
|
40 | |
|
41 | |
private ArtifactReference artifact; |
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | 0 | private List<Dependency> dependencyManagement = new ArrayList<Dependency>(); |
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | 0 | private Set<String> excludes = new HashSet<String>(); |
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | 0 | private boolean resolved = false; |
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | 0 | private boolean fromParent = false; |
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | 0 | private boolean conflicted = false; |
72 | |
|
73 | |
public DependencyGraphNode( ArtifactReference artifact ) |
74 | |
{ |
75 | 0 | super(); |
76 | 0 | this.artifact = artifact; |
77 | 0 | } |
78 | |
|
79 | |
public void addExclude( Exclusion exclusion ) |
80 | |
{ |
81 | 0 | this.excludes.add( DependencyGraphKeys.toManagementKey( exclusion ) ); |
82 | 0 | } |
83 | |
|
84 | |
public boolean equals( Object obj ) |
85 | |
{ |
86 | 0 | if ( this == obj ) |
87 | |
{ |
88 | 0 | return true; |
89 | |
} |
90 | 0 | if ( obj == null ) |
91 | |
{ |
92 | 0 | return false; |
93 | |
} |
94 | 0 | if ( getClass() != obj.getClass() ) |
95 | |
{ |
96 | 0 | return false; |
97 | |
} |
98 | 0 | final DependencyGraphNode other = (DependencyGraphNode) obj; |
99 | 0 | if ( artifact == null ) |
100 | |
{ |
101 | 0 | if ( other.artifact != null ) |
102 | |
{ |
103 | 0 | return false; |
104 | |
} |
105 | |
} |
106 | 0 | else if ( !artifact.equals( other.artifact ) ) |
107 | |
{ |
108 | 0 | return false; |
109 | |
} |
110 | 0 | return true; |
111 | |
} |
112 | |
|
113 | |
public ArtifactReference getArtifact() |
114 | |
{ |
115 | 0 | return artifact; |
116 | |
} |
117 | |
|
118 | |
public List<Dependency> getDependencyManagement() |
119 | |
{ |
120 | 0 | return dependencyManagement; |
121 | |
} |
122 | |
|
123 | |
public Set<String> getExcludes() |
124 | |
{ |
125 | 0 | return excludes; |
126 | |
} |
127 | |
|
128 | |
public int hashCode() |
129 | |
{ |
130 | 0 | final int PRIME = 31; |
131 | 0 | int result = 1; |
132 | 0 | result = PRIME * result + ( ( artifact == null ) ? 0 : artifact.hashCode() ); |
133 | 0 | return result; |
134 | |
} |
135 | |
|
136 | |
public boolean isConflicted() |
137 | |
{ |
138 | 0 | return conflicted; |
139 | |
} |
140 | |
|
141 | |
public boolean isResolved() |
142 | |
{ |
143 | 0 | return resolved; |
144 | |
} |
145 | |
|
146 | |
public void addDependencyManagement( Dependency dep ) |
147 | |
{ |
148 | 0 | this.dependencyManagement.add( dep ); |
149 | 0 | } |
150 | |
|
151 | |
public void setArtifact( ArtifactReference artifact ) |
152 | |
{ |
153 | 0 | this.artifact = artifact; |
154 | 0 | } |
155 | |
|
156 | |
public void setConflicted( boolean conflicted ) |
157 | |
{ |
158 | 0 | this.conflicted = conflicted; |
159 | 0 | } |
160 | |
|
161 | |
public void setDependencyManagement( List<Dependency> dependencyManagement ) |
162 | |
{ |
163 | 0 | this.dependencyManagement = dependencyManagement; |
164 | 0 | } |
165 | |
|
166 | |
public void setExcludes( Set<String> excludes ) |
167 | |
{ |
168 | 0 | this.excludes = excludes; |
169 | 0 | } |
170 | |
|
171 | |
public void setResolved( boolean resolved ) |
172 | |
{ |
173 | 0 | this.resolved = resolved; |
174 | 0 | } |
175 | |
|
176 | |
public String toString() |
177 | |
{ |
178 | 0 | return DependencyGraphKeys.toKey( artifact ); |
179 | |
} |
180 | |
|
181 | |
public boolean isFromParent() |
182 | |
{ |
183 | 0 | return fromParent; |
184 | |
} |
185 | |
|
186 | |
public void setFromParent( boolean fromParent ) |
187 | |
{ |
188 | 0 | this.fromParent = fromParent; |
189 | 0 | } |
190 | |
} |