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.model.components; |
35 |
|
|
36 |
|
import info.magnolia.cms.core.MgnlNodeType; |
37 |
|
import info.magnolia.jcr.util.SessionUtil; |
38 |
|
import info.magnolia.module.googlesitemap.GoogleSiteMapConfiguration; |
39 |
|
import info.magnolia.module.googlesitemap.bean.SiteMapEntry; |
40 |
|
import info.magnolia.module.googlesitemap.model.SiteMapModel; |
41 |
|
import info.magnolia.module.googlesitemap.service.SiteMapService; |
42 |
|
import info.magnolia.rendering.model.RenderingModel; |
43 |
|
import info.magnolia.rendering.template.RenderableDefinition; |
44 |
|
|
45 |
|
import java.util.ArrayList; |
46 |
|
import java.util.Iterator; |
47 |
|
import java.util.List; |
48 |
|
|
49 |
|
import javax.inject.Inject; |
50 |
|
import javax.jcr.Node; |
51 |
|
import javax.jcr.Property; |
52 |
|
import javax.jcr.PropertyIterator; |
53 |
|
import javax.jcr.RepositoryException; |
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
@version |
59 |
|
|
60 |
|
|
|
|
| 94.7% |
Uncovered Elements: 1 (19) |
Complexity: 5 |
Complexity Density: 0.45 |
|
61 |
|
public class SiteComponent extends SiteMapModel<RenderableDefinition>{ |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
67 |
3
|
@Inject... |
68 |
|
public SiteComponent(Node content, RenderableDefinition definition, RenderingModel< ? > parent, SiteMapService siteMapService) { |
69 |
3
|
super(content, definition, parent, siteMapService); |
70 |
|
} |
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
|
|
| 93.8% |
Uncovered Elements: 1 (16) |
Complexity: 4 |
Complexity Density: 0.4 |
|
76 |
3
|
public Iterator<SiteMapEntry> getSiteMapEntry(String type) throws RepositoryException {... |
77 |
3
|
List<SiteMapEntry> res = new ArrayList<SiteMapEntry>(); |
78 |
|
|
79 |
3
|
if(!content.hasNode(GoogleSiteMapConfiguration.SITE_DIALOG_CONFIGURATION_NAME)) { |
80 |
1
|
return res.iterator(); |
81 |
|
} |
82 |
|
|
83 |
|
|
84 |
2
|
PropertyIterator properties = content.getNode(GoogleSiteMapConfiguration.SITE_DIALOG_CONFIGURATION_NAME).getProperties(); |
85 |
|
|
86 |
5
|
while(properties.hasNext()) { |
87 |
3
|
Property property = properties.nextProperty(); |
88 |
3
|
if(!property.getName().startsWith(MgnlNodeType.JCR_PREFIX)) { |
89 |
3
|
Node node = SessionUtil.getNode(this.content.getSession().getWorkspace().getName(), property.getString()); |
90 |
|
|
91 |
3
|
res.addAll(siteMapService.getSiteMapBeanForSite(node, true)); |
92 |
|
} |
93 |
|
} |
94 |
|
|
95 |
|
|
96 |
2
|
return res.iterator(); |
97 |
|
} |
98 |
|
} |