1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package com.xpn.xwiki.plugin.rightsmanager; |
22 |
|
|
23 |
|
import java.text.MessageFormat; |
24 |
|
|
25 |
|
import org.slf4j.Logger; |
26 |
|
import org.slf4j.LoggerFactory; |
27 |
|
|
28 |
|
import com.xpn.xwiki.XWikiContext; |
29 |
|
import com.xpn.xwiki.XWikiException; |
30 |
|
import com.xpn.xwiki.api.Api; |
31 |
|
import com.xpn.xwiki.api.Document; |
32 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
@version |
38 |
|
@since |
39 |
|
@since |
40 |
|
|
|
|
| 15.4% |
Uncovered Elements: 11 (13) |
Complexity: 4 |
Complexity Density: 0.4 |
|
41 |
|
public class RightsManagerRightsApi extends Api |
42 |
|
{ |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
public static final String CONTEXT_LASTERRORCODE = RightsManagerPluginApi.CONTEXT_LASTERRORCODE; |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
public static final String CONTEXT_LASTEXCEPTION = RightsManagerPluginApi.CONTEXT_LASTEXCEPTION; |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
protected static final Logger LOGGER = LoggerFactory.getLogger(RightsManagerRightsApi.class); |
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
@param |
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
63 |
22 |
public RightsManagerRightsApi(XWikiContext context)... |
64 |
|
{ |
65 |
22 |
super(context); |
66 |
|
} |
67 |
|
|
68 |
|
|
69 |
|
@link@link |
70 |
|
|
71 |
|
@param@link |
72 |
|
@param |
73 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
74 |
0 |
private void logError(String comment, XWikiException e)... |
75 |
|
{ |
76 |
0 |
LOGGER.error(comment, e); |
77 |
|
|
78 |
0 |
this.context.put(CONTEXT_LASTERRORCODE, e.getCode()); |
79 |
0 |
this.context.put(CONTEXT_LASTEXCEPTION, e); |
80 |
|
} |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
@param |
88 |
|
@return |
89 |
|
@throws |
90 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
91 |
0 |
public Document getParentPreference(String spaceOrPage) throws XWikiException... |
92 |
|
{ |
93 |
0 |
Document parent = null; |
94 |
|
|
95 |
0 |
try { |
96 |
0 |
XWikiDocument xdoc = RightsManager.getInstance().getParentPreference(spaceOrPage, this.context); |
97 |
|
|
98 |
0 |
parent = convert(xdoc); |
99 |
|
} catch (RightsManagerException e) { |
100 |
0 |
logError( |
101 |
|
MessageFormat.format("Try to get parent rights preference for [{0}]", new Object[] { spaceOrPage }), e); |
102 |
|
} |
103 |
|
|
104 |
0 |
return parent; |
105 |
|
} |
106 |
|
} |