1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.resource.entity; |
21 |
|
|
22 |
|
import java.util.Locale; |
23 |
|
|
24 |
|
import org.apache.commons.lang3.builder.EqualsBuilder; |
25 |
|
import org.apache.commons.lang3.builder.HashCodeBuilder; |
26 |
|
import org.apache.commons.lang3.builder.ToStringBuilder; |
27 |
|
import org.xwiki.model.reference.EntityReference; |
28 |
|
import org.xwiki.resource.AbstractResourceReference; |
29 |
|
import org.xwiki.resource.ResourceType; |
30 |
|
import org.xwiki.text.XWikiToStringBuilder; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@version |
36 |
|
@since |
37 |
|
|
|
|
| 86.4% |
Uncovered Elements: 6 (44) |
Complexity: 15 |
Complexity Density: 0.58 |
|
38 |
|
public class EntityResourceReference extends AbstractResourceReference |
39 |
|
{ |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
public static final ResourceType TYPE = new ResourceType("entity"); |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
private static final String REVISION_PARAMETER_NAME = "rev"; |
49 |
|
|
50 |
|
|
51 |
|
@see |
52 |
|
|
53 |
|
private EntityReference entityReference; |
54 |
|
|
55 |
|
|
56 |
|
@see |
57 |
|
|
58 |
|
private Locale locale; |
59 |
|
|
60 |
|
|
61 |
|
@see |
62 |
|
|
63 |
|
private EntityResourceAction action; |
64 |
|
|
65 |
|
|
66 |
|
@param |
67 |
|
@param |
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
69 |
21152 |
public EntityResourceReference(EntityReference entityReference, EntityResourceAction action)... |
70 |
|
{ |
71 |
21150 |
setType(TYPE); |
72 |
21149 |
setEntityReference(entityReference); |
73 |
21128 |
setAction(action); |
74 |
|
} |
75 |
|
|
76 |
|
|
77 |
|
@return |
78 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
79 |
38895 |
public EntityResourceAction getAction()... |
80 |
|
{ |
81 |
38907 |
return this.action; |
82 |
|
} |
83 |
|
|
84 |
|
|
85 |
|
@param@link |
86 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
87 |
21078 |
public void setAction(EntityResourceAction action)... |
88 |
|
{ |
89 |
21102 |
this.action = action; |
90 |
|
} |
91 |
|
|
92 |
|
|
93 |
|
@return |
94 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
95 |
31435 |
public EntityReference getEntityReference()... |
96 |
|
{ |
97 |
31447 |
return this.entityReference; |
98 |
|
} |
99 |
|
|
100 |
|
|
101 |
|
@param@link |
102 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
103 |
21112 |
public void setEntityReference(EntityReference entityReference)... |
104 |
|
{ |
105 |
21131 |
this.entityReference = entityReference; |
106 |
|
} |
107 |
|
|
108 |
|
|
109 |
|
@param@link |
110 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
111 |
1 |
public void setLocale(Locale locale)... |
112 |
|
{ |
113 |
1 |
this.locale = locale; |
114 |
|
} |
115 |
|
|
116 |
|
|
117 |
|
@return |
118 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
119 |
9514 |
public Locale getLocale()... |
120 |
|
{ |
121 |
9522 |
return this.locale; |
122 |
|
} |
123 |
|
|
124 |
|
|
125 |
|
@param@link |
126 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
127 |
1 |
public void setRevision(String revision)... |
128 |
|
{ |
129 |
1 |
addParameter(REVISION_PARAMETER_NAME, revision); |
130 |
|
} |
131 |
|
|
132 |
|
|
133 |
|
@return |
134 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
135 |
1 |
public String getRevision()... |
136 |
|
{ |
137 |
1 |
return getParameterValue(REVISION_PARAMETER_NAME); |
138 |
|
} |
139 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
140 |
2 |
@Override... |
141 |
|
public int hashCode() |
142 |
|
{ |
143 |
2 |
return new HashCodeBuilder(9, 9) |
144 |
|
.appendSuper(super.hashCode()) |
145 |
|
.append(getEntityReference()) |
146 |
|
.append(getLocale()) |
147 |
|
.append(getAction()) |
148 |
|
.toHashCode(); |
149 |
|
} |
150 |
|
|
|
|
| 57.1% |
Uncovered Elements: 6 (14) |
Complexity: 4 |
Complexity Density: 0.5 |
|
151 |
5 |
@Override... |
152 |
|
public boolean equals(Object object) |
153 |
|
{ |
154 |
5 |
if (object == null) { |
155 |
0 |
return false; |
156 |
|
} |
157 |
5 |
if (object == this) { |
158 |
0 |
return true; |
159 |
|
} |
160 |
5 |
if (object.getClass() != getClass()) { |
161 |
0 |
return false; |
162 |
|
} |
163 |
5 |
EntityResourceReference rhs = (EntityResourceReference) object; |
164 |
5 |
return new EqualsBuilder() |
165 |
|
.appendSuper(super.equals(object)) |
166 |
|
.append(getEntityReference(), rhs.getEntityReference()) |
167 |
|
.append(getLocale(), rhs.getLocale()) |
168 |
|
.append(getAction(), rhs.getAction()) |
169 |
|
.isEquals(); |
170 |
|
} |
171 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
172 |
9504 |
@Override... |
173 |
|
public String toString() |
174 |
|
{ |
175 |
9500 |
ToStringBuilder builder = new XWikiToStringBuilder(this); |
176 |
9492 |
builder.appendSuper(super.toString()); |
177 |
9507 |
builder.append("reference", getEntityReference()); |
178 |
9511 |
builder.append("action", getAction()); |
179 |
9511 |
builder.append("locale", getLocale()); |
180 |
9504 |
return builder.toString(); |
181 |
|
} |
182 |
|
} |