1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.resource.temporary; |
21 |
|
|
22 |
|
import java.util.ArrayList; |
23 |
|
import java.util.Collections; |
24 |
|
import java.util.List; |
25 |
|
|
26 |
|
import org.apache.commons.lang3.builder.EqualsBuilder; |
27 |
|
import org.apache.commons.lang3.builder.HashCodeBuilder; |
28 |
|
import org.xwiki.model.reference.EntityReference; |
29 |
|
import org.xwiki.resource.AbstractResourceReference; |
30 |
|
import org.xwiki.resource.ResourceType; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
|
|
| 76.9% |
Uncovered Elements: 6 (26) |
Complexity: 10 |
Complexity Density: 0.67 |
|
39 |
|
public class TemporaryResourceReference extends AbstractResourceReference |
40 |
|
{ |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
public static final ResourceType TYPE = new ResourceType("tmp"); |
45 |
|
|
46 |
|
private final EntityReference owningEntityReference; |
47 |
|
|
48 |
|
private final List<String> resourcePath; |
49 |
|
|
50 |
|
private final String moduleId; |
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
@param@link |
56 |
|
@param@link |
57 |
|
@param@link |
58 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
59 |
66 |
public TemporaryResourceReference(String moduleId, List<String> resourcePath, EntityReference owningEntityReference)... |
60 |
|
{ |
61 |
66 |
setType(TYPE); |
62 |
66 |
this.moduleId = moduleId; |
63 |
66 |
this.resourcePath = Collections.unmodifiableList(new ArrayList<String>(resourcePath)); |
64 |
66 |
this.owningEntityReference = owningEntityReference; |
65 |
|
} |
66 |
|
|
67 |
|
|
68 |
|
@param@link |
69 |
|
@param@link |
70 |
|
@param@link |
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
72 |
64 |
public TemporaryResourceReference(String moduleId, String resourceName, EntityReference owningEntityReference)... |
73 |
|
{ |
74 |
64 |
this(moduleId, Collections.singletonList(resourceName), owningEntityReference); |
75 |
|
} |
76 |
|
|
77 |
|
|
78 |
|
@param@link |
79 |
|
@param@link |
80 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
81 |
0 |
public TemporaryResourceReference(String moduleId, String resourceName)... |
82 |
|
{ |
83 |
0 |
this(moduleId, resourceName, null); |
84 |
|
} |
85 |
|
|
86 |
|
|
87 |
|
@return |
88 |
|
|
89 |
|
|
90 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
91 |
234 |
public EntityReference getOwningEntityReference()... |
92 |
|
{ |
93 |
234 |
return this.owningEntityReference; |
94 |
|
} |
95 |
|
|
96 |
|
|
97 |
|
@return |
98 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
99 |
2 |
public String getResourceName()... |
100 |
|
{ |
101 |
2 |
return this.resourcePath.get(this.resourcePath.size() - 1); |
102 |
|
} |
103 |
|
|
104 |
|
|
105 |
|
@return |
106 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
107 |
232 |
public List<String> getResourcePath()... |
108 |
|
{ |
109 |
232 |
return this.resourcePath; |
110 |
|
} |
111 |
|
|
112 |
|
|
113 |
|
@return |
114 |
|
|
115 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
116 |
234 |
public String getModuleId()... |
117 |
|
{ |
118 |
234 |
return this.moduleId; |
119 |
|
} |
120 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
121 |
0 |
@Override... |
122 |
|
public int hashCode() |
123 |
|
{ |
124 |
0 |
return new HashCodeBuilder(super.hashCode(), 5).append(getModuleId()).append(getOwningEntityReference()) |
125 |
|
.append(getResourcePath()).toHashCode(); |
126 |
|
} |
127 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
128 |
116 |
@Override... |
129 |
|
public boolean equals(Object object) |
130 |
|
{ |
131 |
116 |
if (!super.equals(object)) { |
132 |
0 |
return false; |
133 |
|
} |
134 |
|
|
135 |
116 |
TemporaryResourceReference reference = (TemporaryResourceReference) object; |
136 |
116 |
return new EqualsBuilder().append(getModuleId(), reference.getModuleId()) |
137 |
|
.append(getOwningEntityReference(), reference.getOwningEntityReference()) |
138 |
|
.append(getResourcePath(), reference.getResourcePath()).isEquals(); |
139 |
|
} |
140 |
|
} |