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.bean; |
35 |
|
|
36 |
|
|
37 |
|
import info.magnolia.jcr.util.NodeTypes; |
38 |
|
import info.magnolia.module.googlesitemap.GoogleSiteMapConfiguration; |
39 |
|
import info.magnolia.module.googlesitemap.SiteMapNodeTypes; |
40 |
|
|
41 |
|
import javax.jcr.Node; |
42 |
|
import javax.jcr.RepositoryException; |
43 |
|
import javax.xml.bind.annotation.XmlElement; |
44 |
|
import javax.xml.bind.annotation.XmlRootElement; |
45 |
|
import javax.xml.bind.annotation.XmlTransient; |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
@XmlRootElement(name="url") |
|
|
| 78.6% |
Uncovered Elements: 12 (56) |
Complexity: 14 |
Complexity Density: 0.39 |
|
52 |
|
public class SiteMapEntry implements Comparable<SiteMapEntry>{ |
53 |
|
|
54 |
|
public final static String PRIORITY_NAME = "priority"; |
55 |
|
public final static String CHANGE_FREQ_NAME = "changefreq"; |
56 |
|
public final static String SITE_ALERT_NAME = "styleAlert"; |
57 |
|
public final static String PATH_NAME = "path"; |
58 |
|
public final static String PAGE_NAME = "pageName"; |
59 |
|
public final static String FROM_NAME = "from"; |
60 |
|
public final static String TO_NAME = "to"; |
61 |
|
|
62 |
|
|
63 |
|
private String loc; |
64 |
|
private String lastmod; |
65 |
|
private String changefreq; |
66 |
|
private Double priority; |
67 |
|
private boolean hide; |
68 |
|
private boolean hideChildren; |
69 |
|
|
70 |
|
|
71 |
|
private int level; |
72 |
|
private String path; |
73 |
|
private boolean styleAlert; |
74 |
|
private String pageName; |
75 |
|
private String from; |
76 |
|
private String to; |
77 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
78 |
3 |
public SiteMapEntry() {... |
79 |
|
} |
80 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
81 |
108 |
public SiteMapEntry(GoogleSiteMapConfiguration configuration, String loc, Node page, int rootLevel, String changefreq, Double priority) throws RepositoryException {... |
82 |
108 |
this.loc = loc; |
83 |
108 |
this.lastmod = configuration.getFastDateFormat().format(NodeTypes.LastModified.getLastModified(page)); |
84 |
108 |
this.path = page.getPath(); |
85 |
108 |
this.level = page.getDepth() - rootLevel; |
86 |
108 |
this.changefreq = SiteMapNodeTypes.GoogleSiteMap.getChangeFreq(page) != null ? SiteMapNodeTypes.GoogleSiteMap.getChangeFreq(page) : changefreq; |
87 |
108 |
this.priority = SiteMapNodeTypes.GoogleSiteMap.getPriority(page) != null ? SiteMapNodeTypes.GoogleSiteMap.getPriority(page) : priority; |
88 |
108 |
this.hide = SiteMapNodeTypes.GoogleSiteMap.isHide(page); |
89 |
108 |
this.hideChildren = SiteMapNodeTypes.GoogleSiteMap.isHideChildren(page); |
90 |
|
} |
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
96 |
|
@XmlElement... |
97 |
|
public String getLoc() { |
98 |
|
return loc; |
99 |
|
} |
100 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
101 |
|
public void setLoc(String loc) {... |
102 |
|
this.loc = loc; |
103 |
|
} |
104 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
105 |
|
@XmlElement... |
106 |
|
public String getLastmod() { |
107 |
|
return lastmod; |
108 |
|
} |
109 |
|
|
110 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
111 |
|
public void setLastmod(String lastmod) {... |
112 |
|
this.lastmod = lastmod; |
113 |
|
} |
114 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
115 |
|
@XmlElement... |
116 |
|
public String getChangefreq() { |
117 |
|
return changefreq; |
118 |
|
} |
119 |
|
|
120 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
121 |
|
public void setChangefreq(String changefreq) {... |
122 |
|
this.changefreq = changefreq; |
123 |
|
} |
124 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
125 |
|
@XmlElement... |
126 |
|
public Double getPriority() { |
127 |
|
return priority; |
128 |
|
} |
129 |
|
|
130 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
131 |
|
public void setPriority(Double priority) {... |
132 |
|
this.priority = priority; |
133 |
|
} |
134 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
135 |
|
@XmlTransient... |
136 |
|
public int getLevel() { |
137 |
|
return level; |
138 |
|
} |
139 |
|
|
140 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
141 |
|
public void setLevel(int level) {... |
142 |
|
this.level = level; |
143 |
|
} |
144 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
145 |
|
@XmlTransient... |
146 |
|
public String getPath() { |
147 |
|
return path; |
148 |
|
} |
149 |
|
|
150 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
151 |
|
public void setPath(String path) {... |
152 |
|
this.path = path; |
153 |
|
} |
154 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
155 |
|
@XmlTransient... |
156 |
|
public boolean isStyleAlert() { |
157 |
|
return styleAlert; |
158 |
|
} |
159 |
|
|
160 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
161 |
|
public void setStyleAlert(boolean styleAlert) {... |
162 |
|
this.styleAlert = styleAlert; |
163 |
|
} |
164 |
|
|
165 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
166 |
|
@XmlTransient... |
167 |
|
public String getPageName() { |
168 |
|
return pageName; |
169 |
|
} |
170 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
171 |
|
public void setPageName(String pageName) {... |
172 |
|
this.pageName = pageName; |
173 |
|
} |
174 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
175 |
|
@XmlTransient... |
176 |
|
public String getFrom() { |
177 |
|
return from; |
178 |
|
} |
179 |
|
|
180 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
181 |
|
public void setFrom(String from) {... |
182 |
|
this.from = from; |
183 |
|
} |
184 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
185 |
|
@XmlTransient... |
186 |
|
public String getTo() { |
187 |
|
return to; |
188 |
|
} |
189 |
|
|
190 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
191 |
|
public void setTo(String to) {... |
192 |
|
this.to = to; |
193 |
|
} |
194 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
195 |
|
@XmlTransient... |
196 |
|
public boolean isHide() { |
197 |
|
return hide; |
198 |
|
} |
199 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
200 |
|
public void setHide(boolean hide) {... |
201 |
|
this.hide = hide; |
202 |
|
} |
203 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
204 |
|
@XmlTransient... |
205 |
|
public boolean isHideChildren() { |
206 |
|
return hideChildren; |
207 |
|
} |
208 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
209 |
|
public void setHideChildren(boolean hideChildren) {... |
210 |
|
this.hideChildren = hideChildren; |
211 |
|
} |
212 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
213 |
80 |
public String toStringDisplay(){... |
214 |
80 |
StringBuffer sb = new StringBuffer(); |
215 |
80 |
sb.append("loc :"+loc); |
216 |
80 |
sb.append("lastmod :"+lastmod); |
217 |
80 |
sb.append("changefreq :"+changefreq); |
218 |
80 |
sb.append("priority :"+priority); |
219 |
80 |
return sb.toString(); |
220 |
|
} |
221 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
222 |
48 |
public String toStringSite(){... |
223 |
48 |
StringBuffer sb = new StringBuffer(); |
224 |
48 |
sb.append("path :"+path); |
225 |
48 |
sb.append("pageName :" + pageName); |
226 |
48 |
return sb.toString(); |
227 |
|
} |
228 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
229 |
0 |
public String toStringVirtualUri(){... |
230 |
0 |
StringBuffer sb = new StringBuffer(); |
231 |
0 |
sb.append("path :"+path); |
232 |
0 |
sb.append("from :"+from); |
233 |
0 |
sb.append("to :"+to); |
234 |
0 |
return sb.toString(); |
235 |
|
} |
236 |
|
|
237 |
|
|
238 |
|
|
239 |
|
|
|
|
| 55.6% |
Uncovered Elements: 4 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
240 |
10 |
@Override... |
241 |
|
public int compareTo(SiteMapEntry obj) { |
242 |
10 |
if(obj == null) { |
243 |
0 |
return -1; |
244 |
|
} |
245 |
|
|
246 |
10 |
if (obj==this) { |
247 |
0 |
return 0; |
248 |
|
} |
249 |
|
|
250 |
10 |
return (obj).getLoc().compareTo(this.getLoc()); |
251 |
|
|
252 |
|
} |
253 |
|
|
254 |
|
|
255 |
|
|
|
|
| 77.8% |
Uncovered Elements: 2 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
256 |
13 |
@Override... |
257 |
|
public boolean equals(Object obj) { |
258 |
|
|
259 |
13 |
if (obj==this) { |
260 |
12 |
return true; |
261 |
|
} |
262 |
|
|
263 |
|
|
264 |
1 |
if (obj instanceof SiteMapEntry) { |
265 |
1 |
return ((SiteMapEntry)obj).getLoc().equals(this.getLoc()); |
266 |
|
} |
267 |
|
|
268 |
0 |
return false; |
269 |
|
} |
270 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
271 |
236 |
@Override... |
272 |
|
public int hashCode() { |
273 |
236 |
int hash = 15; |
274 |
236 |
hash = hash * getLoc().hashCode(); |
275 |
236 |
return hash; |
276 |
|
} |
277 |
|
|
278 |
|
} |