Clover Coverage Report - Google Sitemap Module 2.0.3
Coverage timestamp: Fri Mar 14 2014 11:34:22 CET
../../../../../img/srcFileCovDistChart7.png 10% of files have more coverage
57   257   34   1.97
10   150   0.6   29
29     1.17  
1    
 
  SiteMapEntry       Line # 46 57 0% 34 30 68.8% 0.6875
 
No Tests
 
1    /**
2    * This file Copyright (c) 2012 Magnolia International
3    * Ltd. (http://www.magnolia-cms.com). All rights reserved.
4    *
5    *
6    * This file is dual-licensed under both the Magnolia
7    * Network Agreement and the GNU General Public License.
8    * You may elect to use one or the other of these licenses.
9    *
10    * This file is distributed in the hope that it will be
11    * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
12    * implied warranty of MERCHANTABILITY or FITNESS FOR A
13    * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
14    * Redistribution, except as permitted by whichever of the GPL
15    * or MNA you select, is prohibited.
16    *
17    * 1. For the GPL license (GPL), you can redistribute and/or
18    * modify this file under the terms of the GNU General
19    * Public License, Version 3, as published by the Free Software
20    * Foundation. You should have received a copy of the GNU
21    * General Public License, Version 3 along with this program;
22    * if not, write to the Free Software Foundation, Inc., 51
23    * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24    *
25    * 2. For the Magnolia Network Agreement (MNA), this file
26    * and the accompanying materials are made available under the
27    * terms of the MNA which accompanies this distribution, and
28    * is available at http://www.magnolia-cms.com/mna.html
29    *
30    * Any modifications to this file must keep this entire header
31    * intact.
32    *
33    */
34    package info.magnolia.module.googlesitemap.bean;
35   
36   
37    import javax.xml.bind.annotation.XmlElement;
38    import javax.xml.bind.annotation.XmlRootElement;
39    import javax.xml.bind.annotation.XmlTransient;
40   
41    /**
42    * Simple POJO containing relevant informations for the display.
43    * This bean is used as well for the XML and configuration rendering.
44    */
45    @XmlRootElement(name="url")
 
46    public class SiteMapEntry implements Comparable<SiteMapEntry>{
47   
48    // Used to display xml siteMaps Infos
49    private String loc;
50    private String lastmod;
51    private String changefreq;
52    private String priority;
53   
54    // Used to display edit Infos
55    private int level;
56    private String path;
57    private boolean styleAlert;
58    private String pageName;
59    private String from;
60    private String to;
61   
 
62  0 toggle public SiteMapEntry() {
63    }
64   
65    /**
66    * Fields Constructor.
67    */
 
68  33 toggle public SiteMapEntry(String loc, String lastmod, String changefreq, String priority, int level) {
69  33 this.loc = loc;
70  33 this.lastmod = lastmod;
71  33 this.changefreq = changefreq;
72  33 this.priority = priority;
73  33 this.level = level;
74    }
75   
76    /**
77    * Used to define the tabulation for the site hierarchy.
78    */
 
79  0 toggle @XmlTransient
80    public String getTab() {
81  0 String res = "&nbsp;";
82  0 for(int i=1;i<level;i++) {
83  0 res += "&nbsp;&nbsp;&nbsp;";
84    }
85  0 return res;
86    }
87   
88   
89    /**
90    * Getter and Setter Section.
91    */
 
92  68 toggle @XmlElement
93    public String getLoc() {
94  68 return loc;
95    }
96   
 
97  0 toggle public void setLoc(String loc) {
98  0 this.loc = loc;
99    }
100   
 
101  0 toggle @XmlElement
102    public String getLastmod() {
103  0 return lastmod;
104    }
105   
106   
 
107  0 toggle public void setLastmod(String lastmod) {
108  0 this.lastmod = lastmod;
109    }
110   
 
111  8 toggle @XmlElement
112    public String getChangefreq() {
113  8 return changefreq;
114    }
115   
116   
 
117  0 toggle public void setChangefreq(String changefreq) {
118  0 this.changefreq = changefreq;
119    }
120   
 
121  8 toggle @XmlElement
122    public String getPriority() {
123  8 return priority;
124    }
125   
126   
 
127  0 toggle public void setPriority(String priority) {
128  0 this.priority = priority;
129    }
130   
 
131  3 toggle @XmlTransient
132    public int getLevel() {
133  3 return level;
134    }
135   
136   
 
137  0 toggle public void setLevel(int level) {
138  0 this.level = level;
139    }
140   
 
141  1 toggle @XmlTransient
142    public String getPath() {
143  1 return path;
144    }
145   
146   
 
147  9 toggle public void setPath(String path) {
148  9 this.path = path;
149    }
150   
 
151  9 toggle @XmlTransient
152    public boolean isStyleAlert() {
153  9 return styleAlert;
154    }
155   
156   
 
157  9 toggle public void setStyleAlert(boolean styleAlert) {
158  9 this.styleAlert = styleAlert;
159    }
160   
161   
 
162  0 toggle @XmlTransient
163    public String getPageName() {
164  0 return pageName;
165    }
166   
167   
 
168  6 toggle public void setPageName(String pageName) {
169  6 this.pageName = pageName;
170    }
171   
 
172  1 toggle @XmlTransient
173    public String getFrom() {
174  1 return from;
175    }
176   
177   
 
178  3 toggle public void setFrom(String from) {
179  3 this.from = from;
180    }
181   
182   
 
183  3 toggle public String getTo() {
184  3 return to;
185    }
186   
187   
 
188  3 toggle public void setTo(String to) {
189  3 this.to = to;
190    }
191   
 
192  33 toggle public String toStringDisplay(){
193  33 StringBuffer sb = new StringBuffer();
194  33 sb.append("loc :"+loc);
195  33 sb.append("lastmod :"+lastmod);
196  33 sb.append("changefreq :"+changefreq);
197  33 sb.append("priority :"+priority);
198  33 return sb.toString();
199    }
200   
 
201  6 toggle public String toStringSite(){
202  6 StringBuffer sb = new StringBuffer();
203  6 sb.append("path :"+path);
204  6 sb.append("pageName :"+pageName);
205  6 return sb.toString();
206    }
207   
 
208  3 toggle public String toStringVirtualUri(){
209  3 StringBuffer sb = new StringBuffer();
210  3 sb.append("path :"+path);
211  3 sb.append("from :"+from);
212  3 sb.append("to :"+to);
213  3 return sb.toString();
214    }
215   
216    /**
217    * Implementation for the Comparable Interface.
218    */
 
219  9 toggle @Override
220    public int compareTo(SiteMapEntry obj) {
221  9 if(obj == null) {
222  0 return -1;
223    }
224   
225  9 if (obj==this) {
226  0 return 0;
227    }
228   
229  9 return (obj).getLoc().compareTo(this.getLoc());
230   
231    }
232    /**
233    * Used for to check the unicity in the set.
234    */
 
235  2 toggle @Override
236    public boolean equals(Object obj) {
237    // Check if this is the same object
238  2 if (obj==this) {
239  0 return true;
240    }
241   
242    // Check Class Type
243  2 if (obj instanceof SiteMapEntry) {
244  2 return ((SiteMapEntry)obj).getLoc().equals(this.getLoc());
245    }
246   
247  0 return false;
248    }
249   
 
250  16 toggle @Override
251    public int hashCode() {
252  16 int hash = 15;
253  16 hash = hash * getLoc().hashCode();
254  16 return hash;
255    }
256   
257    }