1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
package info.magnolia.module.blossom.support; |
35 |
|
|
36 |
|
import javax.jcr.RepositoryException; |
37 |
|
|
38 |
|
import info.magnolia.cms.beans.config.ContentRepository; |
39 |
|
import info.magnolia.cms.core.Content; |
40 |
|
import info.magnolia.cms.core.HierarchyManager; |
41 |
|
import info.magnolia.cms.core.ItemType; |
42 |
|
import info.magnolia.cms.core.NodeData; |
43 |
|
import info.magnolia.cms.util.ContentUtil; |
44 |
|
import info.magnolia.context.MgnlContext; |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
@since |
50 |
|
@deprecated |
51 |
|
|
52 |
|
@Deprecated |
|
|
| 0% |
Uncovered Elements: 38 (38) |
Complexity: 12 |
Complexity Density: 0.52 |
|
53 |
|
public class RepositoryUtils { |
54 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
55 |
0 |
public static Content getWebsiteContentByUuid(String uuid) {... |
56 |
0 |
try { |
57 |
0 |
HierarchyManager hierarchyManager = MgnlContext.getSystemContext().getHierarchyManager(ContentRepository.WEBSITE); |
58 |
0 |
return hierarchyManager.getContentByUUID(uuid); |
59 |
|
} catch (RepositoryException e) { |
60 |
0 |
return null; |
61 |
|
} |
62 |
|
} |
63 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
64 |
0 |
public static String getLocalContentNodeUuid() {... |
65 |
0 |
Content content = getLocalContentNode(); |
66 |
0 |
if (content != null) { |
67 |
0 |
return content.getUUID(); |
68 |
|
} |
69 |
0 |
return null; |
70 |
|
} |
71 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
72 |
0 |
public static String getLocalNodeData(String name) {... |
73 |
0 |
return getNodeData(getLocalContentNode(), name); |
74 |
|
} |
75 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
76 |
0 |
public static String getNodeData(Content content, String name) {... |
77 |
0 |
if (content == null) { |
78 |
0 |
return null; |
79 |
|
} |
80 |
0 |
NodeData data = content.getNodeData(name); |
81 |
0 |
if (data == null) { |
82 |
0 |
return null; |
83 |
|
} |
84 |
0 |
return data.getString(); |
85 |
|
} |
86 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
87 |
0 |
public static boolean hasNodeData(Content content, String name) throws RepositoryException {... |
88 |
0 |
return content != null && content.hasNodeData(name); |
89 |
|
} |
90 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
91 |
|
public static Content getLocalContentNode() {... |
92 |
|
return MgnlContext.getWebContext().getAggregationState().getCurrentContent(); |
93 |
|
} |
94 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
95 |
0 |
public static Content createContentNode(HierarchyManager hierarchyManager, String absolutePath, String name) throws RepositoryException {... |
96 |
0 |
Content dialogsNode = ContentUtil.createPath(hierarchyManager, absolutePath, ItemType.CONTENT, true); |
97 |
0 |
return dialogsNode.createContent(name, ItemType.CONTENTNODE); |
98 |
|
} |
99 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
100 |
0 |
public static void deleteContent(HierarchyManager hierarchyManager, String absolutePath) throws RepositoryException {... |
101 |
0 |
if (hierarchyManager.isExist(absolutePath)) { |
102 |
0 |
Content content = hierarchyManager.getContent(absolutePath); |
103 |
0 |
Content parent = content.getParent(); |
104 |
0 |
content.delete(); |
105 |
0 |
parent.save(); |
106 |
|
} |
107 |
|
} |
108 |
|
} |