1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.repository.metadata;
20
21 import org.apache.maven.artifact.ArtifactScopeEnum;
22
23
24
25
26
27
28
29 @Deprecated
30 public class MetadataGraphEdge {
31 String version;
32 ArtifactScopeEnum scope;
33 int depth = -1;
34 int pomOrder = -1;
35 boolean resolved = true;
36 String artifactUri;
37
38
39
40
41
42
43
44 MetadataGraphVertex source;
45
46 MetadataGraphVertex target;
47
48
49 public MetadataGraphEdge(
50 String version, boolean resolved, ArtifactScopeEnum scope, String artifactUri, int depth, int pomOrder) {
51 super();
52 this.version = version;
53 this.scope = scope;
54 this.artifactUri = artifactUri;
55 this.depth = depth;
56 this.resolved = resolved;
57 this.pomOrder = pomOrder;
58 }
59
60
61
62
63 private static boolean objectsEqual(Object o1, Object o2) {
64 if (o1 == null && o2 == null) {
65 return true;
66 }
67 if (o1 == null || o2 == null) {
68 return false;
69 }
70 return o1.equals(o2);
71 }
72
73
74
75
76
77 @Override
78 @SuppressWarnings("checkstyle:equalshashcode")
79 public boolean equals(Object o) {
80 if (o instanceof MetadataGraphEdge) {
81 MetadataGraphEdge e = (MetadataGraphEdge) o;
82
83 return objectsEqual(version, e.version)
84 && ArtifactScopeEnum.checkScope(scope)
85 .getScope()
86 .equals(ArtifactScopeEnum.checkScope(e.scope).getScope())
87 && depth == e.depth;
88 }
89 return false;
90 }
91
92
93 public String getVersion() {
94 return version;
95 }
96
97 public void setVersion(String version) {
98 this.version = version;
99 }
100
101 public ArtifactScopeEnum getScope() {
102 return scope;
103 }
104
105 public void setScope(ArtifactScopeEnum scope) {
106 this.scope = scope;
107 }
108
109 public int getDepth() {
110 return depth;
111 }
112
113 public void setDepth(int depth) {
114 this.depth = depth;
115 }
116
117 public boolean isResolved() {
118 return resolved;
119 }
120
121 public void setResolved(boolean resolved) {
122 this.resolved = resolved;
123 }
124
125 public int getPomOrder() {
126 return pomOrder;
127 }
128
129 public void setPomOrder(int pomOrder) {
130 this.pomOrder = pomOrder;
131 }
132
133 public String getArtifactUri() {
134 return artifactUri;
135 }
136
137 public void setArtifactUri(String artifactUri) {
138 this.artifactUri = artifactUri;
139 }
140
141 public MetadataGraphVertex getSource() {
142 return source;
143 }
144
145 public void setSource(MetadataGraphVertex source) {
146 this.source = source;
147 }
148
149 public MetadataGraphVertex getTarget() {
150 return target;
151 }
152
153 public void setTarget(MetadataGraphVertex target) {
154 this.target = target;
155 }
156
157 @Override
158 public String toString() {
159 return "[ " + "FROM:("
160 + (source == null ? "no source" : (source.md == null ? "no source MD" : source.md.toString())) + ") "
161 + "TO:(" + (target == null ? "no target" : (target.md == null ? "no target MD" : target.md.toString()))
162 + ") " + "version=" + version + ", scope=" + (scope == null ? "null" : scope.getScope()) + ", depth="
163 + depth + "]";
164 }
165
166
167 }