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