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;
35
36 import javax.inject.Singleton;
37
38 import org.apache.commons.lang3.StringUtils;
39 import org.apache.commons.lang3.time.FastDateFormat;
40
41
42
43
44
45
46 @Singleton
47 public class GoogleSiteMapConfiguration {
48
49 public static final String WORKSPACE = "googleSitemaps";
50
51 private String dateFormat = "yyyy-MM-dd";
52 private FastDateFormat fastDateFormat;
53
54 public static final double DEFAULT_PRIORITY = 0.5;
55 public static final String DEFAULT_CHANGE_FREQUENCY = "weekly";
56 private String changeFrequency;
57 private Double priority;
58
59
60
61 public GoogleSiteMapConfiguration() {
62 }
63
64
65
66
67 public String getDateFormat() {
68 return dateFormat;
69 }
70
71
72 public void setDateFormat(String dateFormat) {
73 this.dateFormat = dateFormat;
74 this.fastDateFormat = FastDateFormat.getInstance(this.dateFormat);
75 }
76
77
78
79
80 public FastDateFormat getFastDateFormat() {
81 if(this.fastDateFormat == null) {
82 this.fastDateFormat = FastDateFormat.getInstance(getDateFormat());
83 }
84 return this.fastDateFormat;
85 }
86
87 public String getChangeFrequency() {
88 return StringUtils.isBlank(changeFrequency) ? DEFAULT_CHANGE_FREQUENCY : changeFrequency;
89 }
90
91 public void setChangeFrequency(String changeFrequency) {
92 this.changeFrequency = changeFrequency;
93 }
94
95 public Double getPriority() {
96 return priority == null ? DEFAULT_PRIORITY : priority;
97 }
98
99 public void setPriority(Double priority) {
100 this.priority = priority;
101 }
102
103 }