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.googlesitemap; |
35 |
|
|
36 |
|
import info.magnolia.jcr.util.NodeTypes; |
37 |
|
|
38 |
|
import java.util.ArrayList; |
39 |
|
import java.util.LinkedList; |
40 |
|
import java.util.List; |
41 |
|
|
42 |
|
import javax.jcr.Node; |
43 |
|
import javax.jcr.RepositoryException; |
44 |
|
import javax.jcr.Value; |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 0 |
Complexity Density: - |
|
49 |
|
public class SiteMapNodeTypes { |
50 |
|
|
51 |
|
|
52 |
|
|
|
|
| 97.8% |
Uncovered Elements: 1 (46) |
Complexity: 16 |
Complexity Density: 0.73 |
|
53 |
|
public static class SiteMap { |
54 |
|
public static final String NAME = NodeTypes.MGNL_PREFIX + "siteMap"; |
55 |
|
public static final String TYPE = NodeTypes.MGNL_PREFIX + "googleSiteMapType"; |
56 |
|
public static final String DISPLAY_NAME = NodeTypes.MGNL_PREFIX + "googleSiteMapDisplayName"; |
57 |
|
public static final String INCLUDE_VIRTUAL_URI = NodeTypes.MGNL_PREFIX + "googleSiteMapIncludeVirtualUri"; |
58 |
|
public static final String URL = NodeTypes.MGNL_PREFIX + "googleSiteMapURL"; |
59 |
|
public static final String PAGES = NodeTypes.MGNL_PREFIX + "googleSiteMapPages"; |
60 |
|
public static final String DEFAULT_CHANGEFREQ = NodeTypes.MGNL_PREFIX + "googleSiteMapDefaultChangeFreq"; |
61 |
|
public static final String DEFAULT_PRIORITY = NodeTypes.MGNL_PREFIX + "googleSiteMapDefaultPriority"; |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
66 |
9 |
public static String getType(Node node) throws RepositoryException {... |
67 |
9 |
return node.hasProperty(TYPE) ? node.getProperty(TYPE).getString() : null; |
68 |
|
} |
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
73 |
2 |
public static String getDisplayName(Node node) throws RepositoryException {... |
74 |
2 |
return node.hasProperty(DISPLAY_NAME) ? node.getProperty(DISPLAY_NAME).getString() : null; |
75 |
|
} |
76 |
|
|
77 |
|
|
78 |
|
@link |
79 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
80 |
9 |
public static boolean isVirtualUriMappingIncluded(Node node) throws RepositoryException {... |
81 |
9 |
return node.hasProperty(INCLUDE_VIRTUAL_URI) ? node.getProperty(INCLUDE_VIRTUAL_URI).getBoolean() : Boolean.FALSE; |
82 |
|
} |
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
87 |
32 |
public static String getUrl(Node node) throws RepositoryException {... |
88 |
32 |
return node.hasProperty(URL) ? node.getProperty(URL).getString() : null; |
89 |
|
} |
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
94 |
38 |
public static String getDefaultChangeFreq(Node node) throws RepositoryException {... |
95 |
38 |
return node.hasProperty(DEFAULT_CHANGEFREQ) ? node.getProperty(DEFAULT_CHANGEFREQ).getString() : null; |
96 |
|
} |
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
101 |
38 |
public static Double getDefaultPriority(Node node) throws RepositoryException {... |
102 |
38 |
return node.hasProperty(DEFAULT_PRIORITY) ? node.getProperty(DEFAULT_PRIORITY).getDouble() : null; |
103 |
|
} |
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
108 |
13 |
public static List<String> getPages(Node node) throws RepositoryException {... |
109 |
13 |
if (!node.hasProperty(PAGES)) { |
110 |
1 |
return new ArrayList<String>(); |
111 |
|
} |
112 |
|
|
113 |
12 |
Value[] values = node.getProperty(PAGES).getValues(); |
114 |
12 |
List<String> res = new LinkedList<String>(); |
115 |
12 |
for (Value value : values) { |
116 |
15 |
res.add(value.getString()); |
117 |
|
} |
118 |
12 |
return res; |
119 |
|
} |
120 |
|
|
|
|
| 90.9% |
Uncovered Elements: 1 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
121 |
1 |
public static void update(Node node, String type, String url, String displayName, boolean includeVirtualUri, String defaultChangeFrq, Double defaultPriority, List<String> pages) throws RepositoryException {... |
122 |
1 |
NodeTypes.checkNodeType(node, NAME, TYPE, URL, DISPLAY_NAME, INCLUDE_VIRTUAL_URI, PAGES); |
123 |
1 |
node.setProperty(TYPE, type); |
124 |
1 |
node.setProperty(URL, url); |
125 |
1 |
node.setProperty(DISPLAY_NAME, displayName); |
126 |
1 |
node.setProperty(INCLUDE_VIRTUAL_URI, includeVirtualUri); |
127 |
1 |
node.setProperty(DEFAULT_CHANGEFREQ, defaultChangeFrq); |
128 |
1 |
node.setProperty(DEFAULT_PRIORITY, defaultPriority); |
129 |
1 |
if (pages != null) { |
130 |
1 |
node.setProperty(PAGES, pages.toArray(new String[pages.size()])); |
131 |
|
} |
132 |
|
} |
133 |
|
|
134 |
|
} |
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (22) |
Complexity: 9 |
Complexity Density: 1 |
|
139 |
|
public static class GoogleSiteMap { |
140 |
|
public static final String NAME = NodeTypes.MGNL_PREFIX + "googleSiteMap"; |
141 |
|
public static final String SITEMAP_CHANGEFREQ = NodeTypes.MGNL_PREFIX + "googleSiteMapChangeFreq"; |
142 |
|
public static final String SITEMAP_PRIORITY = NodeTypes.MGNL_PREFIX + "googleSiteMapPriority"; |
143 |
|
public static final String SITEMAP_HIDE_IN_GOOGLESITEMAP = NodeTypes.MGNL_PREFIX + "googleSiteMapHide"; |
144 |
|
public static final String SITEMAP_HIDE_IN_GOOGLESITEMAP_CHILDREN = NodeTypes.MGNL_PREFIX + "googleSiteMapHideChildren"; |
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
149 |
138 |
public static String getChangeFreq(Node node) throws RepositoryException {... |
150 |
138 |
return node.hasProperty(SITEMAP_CHANGEFREQ) ? node.getProperty(SITEMAP_CHANGEFREQ).getString() : null; |
151 |
|
} |
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
156 |
138 |
public static Double getPriority(Node node) throws RepositoryException {... |
157 |
138 |
return node.hasProperty(SITEMAP_PRIORITY) ? node.getProperty(SITEMAP_PRIORITY).getDouble() : null; |
158 |
|
} |
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
163 |
236 |
public static boolean isHide(Node node) throws RepositoryException {... |
164 |
236 |
return node.hasProperty(SITEMAP_HIDE_IN_GOOGLESITEMAP) ? node.getProperty(SITEMAP_HIDE_IN_GOOGLESITEMAP).getBoolean() : Boolean.FALSE; |
165 |
|
} |
166 |
|
|
167 |
|
|
168 |
|
|
169 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
170 |
144 |
public static boolean isHideChildren(Node node) throws RepositoryException {... |
171 |
144 |
return node.hasProperty(SITEMAP_HIDE_IN_GOOGLESITEMAP_CHILDREN) ? node.getProperty(SITEMAP_HIDE_IN_GOOGLESITEMAP_CHILDREN).getBoolean() : Boolean.FALSE; |
172 |
|
} |
173 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
174 |
5 |
public static void update(Node node, String changeFrq, Double priority, boolean hide, boolean hideChildren) throws RepositoryException {... |
175 |
5 |
NodeTypes.checkNodeType(node, NAME, SITEMAP_CHANGEFREQ, SITEMAP_PRIORITY, SITEMAP_HIDE_IN_GOOGLESITEMAP, SITEMAP_HIDE_IN_GOOGLESITEMAP_CHILDREN); |
176 |
5 |
node.setProperty(SITEMAP_CHANGEFREQ, changeFrq); |
177 |
5 |
node.setProperty(SITEMAP_PRIORITY, priority); |
178 |
5 |
node.setProperty(SITEMAP_HIDE_IN_GOOGLESITEMAP, hide); |
179 |
5 |
node.setProperty(SITEMAP_HIDE_IN_GOOGLESITEMAP_CHILDREN, hideChildren); |
180 |
|
} |
181 |
|
} |
182 |
|
} |