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
38
39
40
41
42
43
44
45
46
47 public class SiteMapEntry implements Comparable<SiteMapEntry>{
48
49
50 private String loc;
51 private String lastmod;
52 private String changefreq;
53 private String priority;
54
55
56 private int level;
57 private String path;
58 private boolean styleAlert;
59 private String pageName;
60 private String from;
61 private String to;
62
63 public SiteMapEntry() {
64 }
65
66
67
68
69 public SiteMapEntry(String loc, String lastmod, String changefreq, String priority, int level) {
70 this.loc = loc;
71 this.lastmod = lastmod;
72 this.changefreq = changefreq;
73 this.priority = priority;
74 this.level = level;
75 }
76
77
78
79
80 public String getTab() {
81 String res = " ";
82 for(int i=1;i<level;i++) {
83 res += " ";
84 }
85 return res;
86 }
87
88
89
90
91
92 public String getLoc() {
93 return loc;
94 }
95
96
97 public void setLoc(String loc) {
98 this.loc = loc;
99 }
100
101
102 public String getLastmod() {
103 return lastmod;
104 }
105
106
107 public void setLastmod(String lastmod) {
108 this.lastmod = lastmod;
109 }
110
111
112 public String getChangefreq() {
113 return changefreq;
114 }
115
116
117 public void setChangefreq(String changefreq) {
118 this.changefreq = changefreq;
119 }
120
121
122 public String getPriority() {
123 return priority;
124 }
125
126
127 public void setPriority(String priority) {
128 this.priority = priority;
129 }
130
131
132 public int getLevel() {
133 return level;
134 }
135
136
137 public void setLevel(int level) {
138 this.level = level;
139 }
140
141
142 public String getPath() {
143 return path;
144 }
145
146
147 public void setPath(String path) {
148 this.path = path;
149 }
150
151
152 public boolean isStyleAlert() {
153 return styleAlert;
154 }
155
156
157 public void setStyleAlert(boolean styleAlert) {
158 this.styleAlert = styleAlert;
159 }
160
161
162 public String getPageName() {
163 return pageName;
164 }
165
166
167 public void setPageName(String pageName) {
168 this.pageName = pageName;
169 }
170
171
172 public String getFrom() {
173 return from;
174 }
175
176
177 public void setFrom(String from) {
178 this.from = from;
179 }
180
181
182 public String getTo() {
183 return to;
184 }
185
186
187 public void setTo(String to) {
188 this.to = to;
189 }
190
191 public String toStringDisplay(){
192 StringBuffer sb = new StringBuffer();
193 sb.append("loc :"+loc);
194 sb.append("lastmod :"+lastmod);
195 sb.append("changefreq :"+changefreq);
196 sb.append("priority :"+priority);
197 return sb.toString();
198 }
199
200 public String toStringSite(){
201 StringBuffer sb = new StringBuffer();
202 sb.append("path :"+path);
203 sb.append("pageName :"+pageName);
204 return sb.toString();
205 }
206
207 public String toStringVirtualUri(){
208 StringBuffer sb = new StringBuffer();
209 sb.append("path :"+path);
210 sb.append("from :"+from);
211 sb.append("to :"+to);
212 return sb.toString();
213 }
214
215
216
217
218 public int compareTo(SiteMapEntry obj) {
219 if(obj == null) {
220 return -1;
221 }
222
223 if (obj==this) {
224 return 0;
225 }
226
227 return (obj).getLoc().compareTo(this.getLoc());
228
229 }
230
231
232
233 @Override
234 public boolean equals(Object obj) {
235
236 if (obj==this) {
237 return true;
238 }
239
240
241 if (obj instanceof SiteMapEntry) {
242 return ((SiteMapEntry)obj).getLoc().equals(this.getLoc());
243 }
244
245 return false;
246 }
247
248 @Override
249 public int hashCode() {
250 int hash = 15;
251 hash = hash * getLoc().hashCode();
252 return hash;
253 }
254
255 }