1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.plugin.tag; |
21 |
|
|
22 |
|
import java.util.ArrayList; |
23 |
|
import java.util.Arrays; |
24 |
|
import java.util.Collection; |
25 |
|
import java.util.List; |
26 |
|
import java.util.ListIterator; |
27 |
|
import java.util.Map; |
28 |
|
import java.util.regex.Pattern; |
29 |
|
|
30 |
|
import org.apache.commons.lang3.StringUtils; |
31 |
|
import org.slf4j.Logger; |
32 |
|
import org.slf4j.LoggerFactory; |
33 |
|
|
34 |
|
import com.xpn.xwiki.XWikiContext; |
35 |
|
import com.xpn.xwiki.XWikiException; |
36 |
|
import com.xpn.xwiki.api.Api; |
37 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
38 |
|
import com.xpn.xwiki.objects.BaseObject; |
39 |
|
import com.xpn.xwiki.objects.BaseProperty; |
40 |
|
import com.xpn.xwiki.objects.DBStringListProperty; |
41 |
|
import com.xpn.xwiki.objects.classes.BaseClass; |
42 |
|
import com.xpn.xwiki.objects.classes.PropertyClass; |
43 |
|
import com.xpn.xwiki.plugin.XWikiDefaultPlugin; |
44 |
|
import com.xpn.xwiki.plugin.XWikiPluginInterface; |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
@version |
50 |
|
|
|
|
| 0% |
Uncovered Elements: 177 (177) |
Complexity: 46 |
Complexity Density: 0.38 |
|
51 |
|
public class TagPlugin extends XWikiDefaultPlugin implements XWikiPluginInterface |
52 |
|
{ |
53 |
|
|
54 |
|
public static final Logger LOGGER = LoggerFactory.getLogger(TagPlugin.class); |
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
public static final String PLUGIN_NAME = "tag"; |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
public static final String TAG_CLASS = "XWiki.TagClass"; |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
public static final String TAG_PROPERTY = "tags"; |
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
public static final String DOC_COMMENT_TAG_ADDED = "plugin.tag.editcomment.added"; |
76 |
|
|
77 |
|
private static final Pattern LIKE_ESCAPE = Pattern.compile("[_%\\\\]"); |
78 |
|
|
79 |
|
private static final String LIKE_REPLACEMENT = "\\\\$0"; |
80 |
|
|
81 |
|
private static final String LIKE_APPEND = ".%"; |
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
@param |
87 |
|
@param |
88 |
|
@param |
89 |
|
@see |
90 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
91 |
0 |
public TagPlugin(String name, String className, XWikiContext context)... |
92 |
|
{ |
93 |
0 |
super(PLUGIN_NAME, className, context); |
94 |
|
} |
95 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
96 |
0 |
@Override... |
97 |
|
public Api getPluginApi(XWikiPluginInterface plugin, XWikiContext context) |
98 |
|
{ |
99 |
0 |
return new TagPluginApi((TagPlugin) plugin, context); |
100 |
|
} |
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
@param |
106 |
|
@return |
107 |
|
|
108 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
109 |
0 |
@SuppressWarnings("unchecked")... |
110 |
|
private List<String> getTagsFromDocument(XWikiDocument document) |
111 |
|
{ |
112 |
0 |
try { |
113 |
0 |
BaseProperty prop = (BaseProperty) document.getObject(TAG_CLASS).safeget(TAG_PROPERTY); |
114 |
0 |
return new ArrayList<String>((List<String>) prop.getValue()); |
115 |
|
} catch (NullPointerException ex) { |
116 |
0 |
return new ArrayList<String>(); |
117 |
|
} |
118 |
|
} |
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
|
123 |
|
@param |
124 |
|
@param |
125 |
|
@param |
126 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
127 |
0 |
private void setDocumentTags(XWikiDocument document, List<String> tags, XWikiContext context)... |
128 |
|
{ |
129 |
0 |
BaseProperty prop = (BaseProperty) document.getObject(TAG_CLASS, true, context).safeget(TAG_PROPERTY); |
130 |
|
|
131 |
0 |
if (prop == null) { |
132 |
0 |
prop = createTagProperty(document.getObject(TAG_CLASS, true, context), context); |
133 |
|
} |
134 |
0 |
prop.setValue(tags); |
135 |
|
} |
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
@param |
142 |
|
@param |
143 |
|
@return |
144 |
|
@see |
145 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 2 |
Complexity Density: 0.18 |
|
146 |
0 |
private BaseProperty createTagProperty(BaseObject tagObject, XWikiContext context)... |
147 |
|
{ |
148 |
0 |
BaseProperty tagProperty; |
149 |
0 |
try { |
150 |
0 |
BaseClass tagClass = context.getWiki().getClass(TAG_CLASS, context); |
151 |
0 |
PropertyClass tagPropertyDefinition = (PropertyClass) tagClass.getField(TAG_PROPERTY); |
152 |
0 |
tagProperty = tagPropertyDefinition.newProperty(); |
153 |
|
} catch (XWikiException ex) { |
154 |
0 |
LOGGER.warn("Failed to properly create tag property for the tag object, creating a default one"); |
155 |
0 |
tagProperty = new DBStringListProperty(); |
156 |
|
} |
157 |
0 |
tagProperty.setName(TAG_PROPERTY); |
158 |
0 |
tagProperty.setObject(tagObject); |
159 |
0 |
tagObject.safeput(TAG_PROPERTY, tagProperty); |
160 |
0 |
return tagProperty; |
161 |
|
} |
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
@param |
167 |
|
@return |
168 |
|
@throws |
169 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
170 |
0 |
public List<String> getAllTags(XWikiContext context) throws XWikiException... |
171 |
|
{ |
172 |
0 |
return TagQueryUtils.getAllTags(context); |
173 |
|
} |
174 |
|
|
175 |
|
|
176 |
|
|
177 |
|
|
178 |
|
@param |
179 |
|
@return |
180 |
|
@throws |
181 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
182 |
0 |
public Map<String, Integer> getTagCount(XWikiContext context) throws XWikiException... |
183 |
|
{ |
184 |
0 |
return this.getTagCountForQuery(null, null, context); |
185 |
|
} |
186 |
|
|
187 |
|
|
188 |
|
|
189 |
|
|
190 |
|
@param |
191 |
|
|
192 |
|
@param |
193 |
|
@return |
194 |
|
@throws |
195 |
|
@since |
196 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
197 |
0 |
public Map<String, Integer> getTagCount(String spaceReference, XWikiContext context) throws XWikiException... |
198 |
|
{ |
199 |
0 |
if (!StringUtils.isBlank(spaceReference)) { |
200 |
0 |
StringBuilder where = new StringBuilder(); |
201 |
0 |
where.append('('); |
202 |
0 |
where.append("doc.space = ?"); |
203 |
0 |
where.append(" OR "); |
204 |
0 |
where.append("doc.space LIKE ?"); |
205 |
0 |
where.append(')'); |
206 |
|
|
207 |
|
|
208 |
0 |
String escapedSpaceReference = LIKE_ESCAPE.matcher(spaceReference).replaceAll(LIKE_REPLACEMENT); |
209 |
|
|
210 |
0 |
return getTagCountForQuery("", where.toString(), |
211 |
|
Arrays.asList(spaceReference, escapedSpaceReference + LIKE_APPEND), context); |
212 |
|
} |
213 |
|
|
214 |
0 |
return getTagCount(context); |
215 |
|
} |
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
|
221 |
|
|
222 |
|
|
223 |
|
@param |
224 |
|
@param |
225 |
|
@return |
226 |
|
@throws |
227 |
|
@since |
228 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 3 |
Complexity Density: 0.19 |
|
229 |
0 |
public Map<String, Integer> getTagCountForSpaces(String spaces, XWikiContext context) throws XWikiException... |
230 |
|
{ |
231 |
0 |
List<String> spaceRefList = TagParamUtils.spacesParameterToList(spaces); |
232 |
|
|
233 |
0 |
List<Object> queryParameter = new ArrayList<>(); |
234 |
0 |
StringBuilder where = new StringBuilder(); |
235 |
0 |
boolean first = true; |
236 |
0 |
for (String spaceReference : spaceRefList) { |
237 |
0 |
if (first) { |
238 |
0 |
where.append("(doc.space = ? "); |
239 |
0 |
first = false; |
240 |
|
} else { |
241 |
0 |
where.append(" OR doc.space = ? "); |
242 |
|
} |
243 |
0 |
queryParameter.add(spaceReference); |
244 |
0 |
where.append("OR doc.space LIKE ?"); |
245 |
0 |
String escapedSpaceReference = LIKE_ESCAPE.matcher(spaceReference).replaceAll(LIKE_REPLACEMENT); |
246 |
0 |
queryParameter.add(escapedSpaceReference + LIKE_APPEND); |
247 |
|
} |
248 |
|
|
249 |
|
|
250 |
0 |
if (!first) { |
251 |
0 |
where.append(')'); |
252 |
|
} |
253 |
|
|
254 |
0 |
return getTagCountForQuery("", where.toString(), queryParameter, context); |
255 |
|
} |
256 |
|
|
257 |
|
|
258 |
|
|
259 |
|
|
260 |
|
@param |
261 |
|
@param |
262 |
|
@param |
263 |
|
@return |
264 |
|
@throws |
265 |
|
@since |
266 |
|
@see |
267 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
268 |
0 |
public Map<String, Integer> getTagCountForQuery(String fromHql, String whereHql, XWikiContext context)... |
269 |
|
throws XWikiException |
270 |
|
{ |
271 |
0 |
return getTagCountForQuery(fromHql, whereHql, null, context); |
272 |
|
} |
273 |
|
|
274 |
|
|
275 |
|
|
276 |
|
|
277 |
|
@param |
278 |
|
@param |
279 |
|
@param |
280 |
|
@param |
281 |
|
@return |
282 |
|
@throws |
283 |
|
@since |
284 |
|
@see |
285 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
286 |
0 |
public Map<String, Integer> getTagCountForQuery(String fromHql, String whereHql, List<?> parameterValues,... |
287 |
|
XWikiContext context) throws XWikiException |
288 |
|
{ |
289 |
0 |
return TagQueryUtils.getTagCountForQuery(fromHql, whereHql, parameterValues, context); |
290 |
|
} |
291 |
|
|
292 |
|
|
293 |
|
|
294 |
|
|
295 |
|
@param |
296 |
|
@param |
297 |
|
@return |
298 |
|
@throws |
299 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
300 |
0 |
public List<String> getDocumentsWithTag(String tag, XWikiContext context) throws XWikiException... |
301 |
|
{ |
302 |
0 |
return TagQueryUtils.getDocumentsWithTag(tag, context); |
303 |
|
} |
304 |
|
|
305 |
|
|
306 |
|
|
307 |
|
|
308 |
|
@param |
309 |
|
@param |
310 |
|
@param |
311 |
|
@return |
312 |
|
@throws |
313 |
|
@since |
314 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
315 |
0 |
public List<String> getDocumentsWithTag(String tag, boolean includeHiddenDocuments, XWikiContext context)... |
316 |
|
throws XWikiException |
317 |
|
{ |
318 |
0 |
return TagQueryUtils.getDocumentsWithTag(tag, includeHiddenDocuments, context); |
319 |
|
} |
320 |
|
|
321 |
|
|
322 |
|
|
323 |
|
|
324 |
|
@param |
325 |
|
@param |
326 |
|
@return |
327 |
|
@throws |
328 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
329 |
0 |
public List<String> getTagsFromDocument(String documentName, XWikiContext context) throws XWikiException... |
330 |
|
{ |
331 |
0 |
return getTagsFromDocument(context.getWiki().getDocument(documentName, context)); |
332 |
|
} |
333 |
|
|
334 |
|
|
335 |
|
|
336 |
|
|
337 |
|
@param |
338 |
|
@param |
339 |
|
@return |
340 |
|
@throws |
341 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
342 |
0 |
public List<String> getTagsFromDocument(XWikiDocument document, XWikiContext context) throws XWikiException... |
343 |
|
{ |
344 |
0 |
return getTagsFromDocument(document); |
345 |
|
} |
346 |
|
|
347 |
|
|
348 |
|
|
349 |
|
|
350 |
|
@param |
351 |
|
@param |
352 |
|
@param |
353 |
|
@return@link |
354 |
|
@throws |
355 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
356 |
0 |
public TagOperationResult addTagToDocument(String tag, String documentName, XWikiContext context)... |
357 |
|
throws XWikiException |
358 |
|
{ |
359 |
0 |
return addTagToDocument(tag, context.getWiki().getDocument(documentName, context), context); |
360 |
|
} |
361 |
|
|
362 |
|
|
363 |
|
|
364 |
|
|
365 |
|
@param |
366 |
|
@param |
367 |
|
@param |
368 |
|
@return@link |
369 |
|
@throws |
370 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.33 |
|
371 |
0 |
public TagOperationResult addTagToDocument(String tag, XWikiDocument document, XWikiContext context)... |
372 |
|
throws XWikiException |
373 |
|
{ |
374 |
0 |
List<String> tags = getTagsFromDocument(document); |
375 |
0 |
if (!StringUtils.isBlank(tag) && !tags.contains(tag)) { |
376 |
0 |
tags.add(tag); |
377 |
0 |
setDocumentTags(document, tags, context); |
378 |
|
|
379 |
0 |
String comment = localizePlainOrKey(DOC_COMMENT_TAG_ADDED, tag); |
380 |
|
|
381 |
|
|
382 |
0 |
document.setAuthorReference(context.getUserReference()); |
383 |
|
|
384 |
0 |
context.getWiki().saveDocument(document, comment, true, context); |
385 |
|
|
386 |
0 |
return TagOperationResult.OK; |
387 |
|
} |
388 |
0 |
return TagOperationResult.NO_EFFECT; |
389 |
|
} |
390 |
|
|
391 |
|
|
392 |
|
|
393 |
|
|
394 |
|
@param |
395 |
|
@param |
396 |
|
@param |
397 |
|
@return@link@link |
398 |
|
@link |
399 |
|
|
400 |
|
@throws |
401 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
402 |
0 |
public TagOperationResult addTagsToDocument(String tags, String documentName, XWikiContext context)... |
403 |
|
throws XWikiException |
404 |
|
{ |
405 |
0 |
return addTagsToDocument(tags, context.getWiki().getDocument(documentName, context), context); |
406 |
|
} |
407 |
|
|
408 |
|
|
409 |
|
|
410 |
|
|
411 |
|
@param |
412 |
|
@param |
413 |
|
@param |
414 |
|
@return@link@link |
415 |
|
@link |
416 |
|
|
417 |
|
@throws |
418 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 4 |
Complexity Density: 0.29 |
|
419 |
0 |
public TagOperationResult addTagsToDocument(String tags, XWikiDocument document, XWikiContext context)... |
420 |
|
throws XWikiException |
421 |
|
{ |
422 |
0 |
List<String> documentTags = getTagsFromDocument(document); |
423 |
0 |
String[] newTags = tags.trim().split("\\s*+,\\s*+"); |
424 |
0 |
boolean added = false; |
425 |
|
|
426 |
0 |
for (String tag : newTags) { |
427 |
0 |
if (!StringUtils.isBlank(tag) && !containsIgnoreCase(documentTags, tag)) { |
428 |
0 |
documentTags.add(tag); |
429 |
0 |
added = true; |
430 |
|
} |
431 |
|
} |
432 |
|
|
433 |
0 |
if (added) { |
434 |
0 |
setDocumentTags(document, documentTags, context); |
435 |
0 |
String comment = localizePlainOrKey(DOC_COMMENT_TAG_ADDED, tags); |
436 |
|
|
437 |
|
|
438 |
0 |
document.setAuthorReference(context.getUserReference()); |
439 |
|
|
440 |
0 |
context.getWiki().saveDocument(document, comment, true, context); |
441 |
|
|
442 |
0 |
return TagOperationResult.OK; |
443 |
|
} |
444 |
|
|
445 |
0 |
return TagOperationResult.NO_EFFECT; |
446 |
|
} |
447 |
|
|
448 |
|
|
449 |
|
@param |
450 |
|
@param |
451 |
|
@return |
452 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
453 |
0 |
private boolean containsIgnoreCase(Collection<String> collection, String item)... |
454 |
|
{ |
455 |
0 |
for (String existingItem : collection) { |
456 |
0 |
if (existingItem.equalsIgnoreCase(item)) { |
457 |
0 |
return true; |
458 |
|
} |
459 |
|
} |
460 |
0 |
return false; |
461 |
|
} |
462 |
|
|
463 |
|
|
464 |
|
|
465 |
|
|
466 |
|
@param |
467 |
|
@param |
468 |
|
@param |
469 |
|
@return@link |
470 |
|
@throws |
471 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
472 |
0 |
public TagOperationResult removeTagFromDocument(String tag, String documentName, XWikiContext context)... |
473 |
|
throws XWikiException |
474 |
|
{ |
475 |
0 |
return removeTagFromDocument(tag, context.getWiki().getDocument(documentName, context), context); |
476 |
|
} |
477 |
|
|
478 |
|
|
479 |
|
|
480 |
|
|
481 |
|
@param |
482 |
|
@param |
483 |
|
@param |
484 |
|
@return@link |
485 |
|
@throws |
486 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 4 |
Complexity Density: 0.29 |
|
487 |
0 |
public TagOperationResult removeTagFromDocument(String tag, XWikiDocument document, XWikiContext context)... |
488 |
|
throws XWikiException |
489 |
|
{ |
490 |
0 |
List<String> tags = getTagsFromDocument(document); |
491 |
0 |
boolean needsUpdate = false; |
492 |
|
|
493 |
0 |
ListIterator<String> it = tags.listIterator(); |
494 |
0 |
while (it.hasNext()) { |
495 |
0 |
if (tag.equalsIgnoreCase(it.next())) { |
496 |
0 |
needsUpdate = true; |
497 |
0 |
it.remove(); |
498 |
|
} |
499 |
|
} |
500 |
|
|
501 |
0 |
if (needsUpdate) { |
502 |
0 |
setDocumentTags(document, tags, context); |
503 |
0 |
String comment = localizePlainOrKey("plugin.tag.editcomment.removed", tag); |
504 |
|
|
505 |
|
|
506 |
0 |
document.setAuthorReference(context.getUserReference()); |
507 |
|
|
508 |
0 |
context.getWiki().saveDocument(document, comment, true, context); |
509 |
|
|
510 |
0 |
return TagOperationResult.OK; |
511 |
|
} else { |
512 |
|
|
513 |
0 |
return TagOperationResult.NO_EFFECT; |
514 |
|
} |
515 |
|
} |
516 |
|
|
517 |
|
|
518 |
|
|
519 |
|
|
520 |
|
@param |
521 |
|
@param |
522 |
|
@param |
523 |
|
@return@link |
524 |
|
@throws |
525 |
|
|
|
|
| 0% |
Uncovered Elements: 24 (24) |
Complexity: 7 |
Complexity Density: 0.44 |
|
526 |
0 |
protected TagOperationResult renameTag(String tag, String newTag, XWikiContext context) throws XWikiException... |
527 |
|
{ |
528 |
|
|
529 |
|
|
530 |
0 |
List<String> docNamesToProcess = getDocumentsWithTag(tag, true, context); |
531 |
0 |
if (StringUtils.equals(tag, newTag) || docNamesToProcess.size() == 0 || StringUtils.isBlank(newTag)) { |
532 |
0 |
return TagOperationResult.NO_EFFECT; |
533 |
|
} |
534 |
|
|
535 |
0 |
String comment = localizePlainOrKey("plugin.tag.editcomment.renamed", tag, newTag); |
536 |
|
|
537 |
0 |
for (String docName : docNamesToProcess) { |
538 |
0 |
XWikiDocument doc = context.getWiki().getDocument(docName, context); |
539 |
0 |
List<String> tags = getTagsFromDocument(doc); |
540 |
|
|
541 |
0 |
if (tags.contains(newTag)) { |
542 |
|
|
543 |
0 |
removeTagFromDocument(tag, doc.getFullName(), context); |
544 |
|
} else { |
545 |
0 |
for (int i = 0; i < tags.size(); i++) { |
546 |
0 |
if (tags.get(i).equalsIgnoreCase(tag)) { |
547 |
0 |
tags.set(i, newTag); |
548 |
|
} |
549 |
|
} |
550 |
0 |
setDocumentTags(doc, tags, context); |
551 |
|
|
552 |
|
|
553 |
0 |
doc.setAuthorReference(context.getUserReference()); |
554 |
|
|
555 |
0 |
context.getWiki().saveDocument(doc, comment, true, context); |
556 |
|
} |
557 |
|
} |
558 |
|
|
559 |
0 |
return TagOperationResult.OK; |
560 |
|
} |
561 |
|
|
562 |
|
|
563 |
|
|
564 |
|
|
565 |
|
@param |
566 |
|
@param |
567 |
|
@return@link |
568 |
|
@throws |
569 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
570 |
0 |
protected TagOperationResult deleteTag(String tag, XWikiContext context) throws XWikiException... |
571 |
|
{ |
572 |
|
|
573 |
|
|
574 |
0 |
List<String> docsToProcess = getDocumentsWithTag(tag, true, context); |
575 |
|
|
576 |
0 |
if (docsToProcess.size() == 0) { |
577 |
0 |
return TagOperationResult.NO_EFFECT; |
578 |
|
} |
579 |
0 |
for (String docName : docsToProcess) { |
580 |
0 |
removeTagFromDocument(tag, docName, context); |
581 |
|
} |
582 |
|
|
583 |
0 |
return TagOperationResult.OK; |
584 |
|
} |
585 |
|
} |