1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.refactoring.job; |
21 |
|
|
22 |
|
import java.util.Collection; |
23 |
|
import java.util.Collections; |
24 |
|
import java.util.HashMap; |
25 |
|
import java.util.Map; |
26 |
|
|
27 |
|
import org.xwiki.job.AbstractRequest; |
28 |
|
import org.xwiki.model.reference.DocumentReference; |
29 |
|
import org.xwiki.model.reference.EntityReference; |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
@version |
35 |
|
@since |
36 |
|
|
|
|
| 97% |
Uncovered Elements: 1 (33) |
Complexity: 14 |
Complexity Density: 0.82 |
|
37 |
|
public class EntityRequest extends AbstractRequest |
38 |
|
{ |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
private static final long serialVersionUID = 1L; |
43 |
|
|
44 |
|
|
45 |
|
@see |
46 |
|
|
47 |
|
private static final String PROPERTY_JOB_TYPE = "job.type"; |
48 |
|
|
49 |
|
|
50 |
|
@see |
51 |
|
|
52 |
|
private static final String PROPERTY_USER_REFERENCE = "user.reference"; |
53 |
|
|
54 |
|
|
55 |
|
@see |
56 |
|
|
57 |
|
private static final String PROPERTY_CHECK_RIGHTS = "checkrights"; |
58 |
|
|
59 |
|
|
60 |
|
@see |
61 |
|
|
62 |
|
private static final String PROPERTY_ENTITY_REFERENCES = "entityReferences"; |
63 |
|
|
64 |
|
|
65 |
|
@see |
66 |
|
|
67 |
|
private static final String PROPERTY_ENTITY_PARAMETERS = "entityParameters"; |
68 |
|
|
69 |
|
|
70 |
|
@see |
71 |
|
|
72 |
|
private static final String PROPERTY_DEEP = "deep"; |
73 |
|
|
74 |
|
|
75 |
|
@return |
76 |
|
|
77 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
78 |
6 |
public String getJobType()... |
79 |
|
{ |
80 |
6 |
return getProperty(PROPERTY_JOB_TYPE); |
81 |
|
} |
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
@param |
88 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
89 |
47 |
public void setJobType(String jobType)... |
90 |
|
{ |
91 |
47 |
setProperty(PROPERTY_JOB_TYPE, jobType); |
92 |
|
} |
93 |
|
|
94 |
|
|
95 |
|
@return@link |
96 |
|
|
97 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
98 |
74 |
public boolean isCheckRights()... |
99 |
|
{ |
100 |
74 |
return getProperty(PROPERTY_CHECK_RIGHTS, true); |
101 |
|
} |
102 |
|
|
103 |
|
|
104 |
|
@link |
105 |
|
|
106 |
|
|
107 |
|
@param@link |
108 |
|
|
109 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
110 |
101 |
public void setCheckRights(boolean checkRights)... |
111 |
|
{ |
112 |
101 |
setProperty(PROPERTY_CHECK_RIGHTS, checkRights); |
113 |
|
} |
114 |
|
|
115 |
|
|
116 |
|
@return |
117 |
|
@link |
118 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
119 |
119 |
public DocumentReference getUserReference()... |
120 |
|
{ |
121 |
119 |
return getProperty(PROPERTY_USER_REFERENCE); |
122 |
|
} |
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
@link |
127 |
|
|
128 |
|
@param |
129 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
130 |
95 |
public void setUserReference(DocumentReference userReference)... |
131 |
|
{ |
132 |
95 |
setProperty(PROPERTY_USER_REFERENCE, userReference); |
133 |
|
} |
134 |
|
|
135 |
|
|
136 |
|
@return |
137 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
138 |
163 |
public Collection<EntityReference> getEntityReferences()... |
139 |
|
{ |
140 |
163 |
return getProperty(PROPERTY_ENTITY_REFERENCES); |
141 |
|
} |
142 |
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
@param |
147 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
148 |
102 |
public void setEntityReferences(Collection<EntityReference> entityReferences)... |
149 |
|
{ |
150 |
102 |
setProperty(PROPERTY_ENTITY_REFERENCES, entityReferences); |
151 |
|
} |
152 |
|
|
153 |
|
|
154 |
|
@return |
155 |
|
|
156 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
157 |
60 |
public boolean isDeep()... |
158 |
|
{ |
159 |
60 |
return getProperty(PROPERTY_DEEP, false); |
160 |
|
} |
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
@param |
166 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
167 |
25 |
public void setDeep(boolean deep)... |
168 |
|
{ |
169 |
25 |
setProperty(PROPERTY_DEEP, deep); |
170 |
|
} |
171 |
|
|
172 |
|
|
173 |
|
@param |
174 |
|
@return |
175 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
176 |
8 |
public Map<String, String> getEntityParameters(EntityReference entityReference)... |
177 |
|
{ |
178 |
8 |
Map<String, String> entityParameters = |
179 |
|
getProperty(PROPERTY_ENTITY_PARAMETERS, Collections.<EntityReference, Map<String, String>>emptyMap()).get( |
180 |
|
entityReference); |
181 |
8 |
return entityParameters == null ? Collections.emptyMap() : entityParameters; |
182 |
|
} |
183 |
|
|
184 |
|
|
185 |
|
|
186 |
|
|
187 |
|
@param |
188 |
|
@param |
189 |
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
190 |
2 |
public void setEntityParameters(EntityReference entityReference, Map<String, String> entityParameters)... |
191 |
|
{ |
192 |
2 |
Map<EntityReference, Map<String, String>> paramsPerEntity = getProperty(PROPERTY_ENTITY_PARAMETERS); |
193 |
2 |
if (paramsPerEntity == null) { |
194 |
2 |
paramsPerEntity = new HashMap<>(); |
195 |
2 |
setProperty(PROPERTY_ENTITY_PARAMETERS, paramsPerEntity); |
196 |
|
} |
197 |
2 |
paramsPerEntity.put(entityReference, entityParameters); |
198 |
|
} |
199 |
|
} |