Kawai Wiki

Rev

Rev 108 | Rev 195 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
11 soliveira 1
package org.kawai.model;
2
 
52 soliveira 3
import java.text.SimpleDateFormat;
22 soliveira 4
import java.util.Date;
41 soliveira 5
import java.util.Locale;
22 soliveira 6
 
194 helio.frota 7
/**
8
 * Model class Page.
9
 *
10
 * @author Sergio Oliveira
11
 *
12
 */
11 soliveira 13
public class Page {
14
 
194 helio.frota 15
    /** Attribute FORMATTER of Page. */
16
    private static final SimpleDateFormat FORMATTER = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
17
 
18
    /** Attribute LEFT_COLUMN of Page. */
19
    public static final String LEFT_COLUMN = "LeftColumn";
20
    /** Attribute CSS of Page. */
21
    public static final String CSS = "CSS";
22
    /** Attribute PRINT_CSS of Page. */
23
    public static final String PRINT_CSS = "PrintCSS";
24
    /** Attribute LOGO of Page. */
25
    public static final String LOGO = "logo";
26
    /** Attribute JAVASCRIPT of Page. */
27
    public static final String JAVASCRIPT = "JavaScript";
28
 
29
    /** Attribute id of Page. */
30
    private int id;
31
    /** Attribute name of Page. */
32
    private String name;
33
    /** Attribute title of Page. */
34
    private String title;
35
    /** Attribute body of Page. */
36
    private String body;
37
    /** Attribute isSystemPage of Page. */
38
    private boolean isSystemPage;
39
    /** Attribute languageId of Page. */
40
    private int languageId;
41
    /** Attribute modifiedById of Page. */
42
    private int modifiedById;
43
    /** Attribute modifiedBy of Page. */
44
    private User modifiedBy;
45
    /** Attribute modifiedOn of Page. */
46
    private Date modifiedOn;
47
    /** Attribute createdById of Page. */
48
    private int createdById;
49
    /** Attribute createdBy of Page. */
50
    private User createdBy;
51
    /** Attribute createdOn of Page. */
52
    private Date createdOn;
53
    /** Attribute isFrontPage of Page. */
54
    private boolean isFrontPage;
55
    /** Attribute isDeleted of Page. */
56
    private Boolean isDeleted;
57
    /** Attribute isPreview of Page. */
58
    private boolean isPreview;
59
    /** Attribute isNew of Page. */
60
    private boolean isNew;
61
    /** Attribute isRevision of Page. */
62
    private boolean isRevision;
63
    /** Attribute revisionNumber of Page. */
64
    private int revisionNumber;
65
    /** Attribute comment of Page. */
66
    private String comment;
67
 
68
    public Page() { }
69
 
70
    public void setPreview(Preview preview) {
71
        this.isPreview = true;
72
        this.title = preview.getTitle();
73
        this.body = preview.getBody();
86 soliveira 74
    }
75
 
194 helio.frota 76
    public void setComment(String s) {
77
        this.comment = s;
86 soliveira 78
    }
79
 
194 helio.frota 80
    public String getComment() {
81
        return comment;
86 soliveira 82
    }
83
 
194 helio.frota 84
    public boolean isRevision() {
85
        return isRevision;
86 soliveira 86
    }
87
 
194 helio.frota 88
    public void setRevision(boolean isRevision) {
89
        this.isRevision = isRevision;
11 soliveira 90
    }
91
 
194 helio.frota 92
    public int getRevisionNumber() {
93
        return revisionNumber;
11 soliveira 94
    }
95
 
194 helio.frota 96
    public void setRevisionNumber(int revisionNumber) {
97
        this.revisionNumber = revisionNumber;
11 soliveira 98
    }
99
 
194 helio.frota 100
    public int getId() {
101
        return id;
11 soliveira 102
    }
103
 
194 helio.frota 104
    public void setId(int id) {
105
        this.id = id;
11 soliveira 106
    }
107
 
194 helio.frota 108
    public String getName() {
109
        return name;
11 soliveira 110
    }
111
 
194 helio.frota 112
    public void setName(String name) {
113
        this.name = name;
11 soliveira 114
    }
115
 
194 helio.frota 116
    public String getTitle() {
117
        return title;
11 soliveira 118
    }
22 soliveira 119
 
194 helio.frota 120
    public void setTitle(String title) {
121
        this.title = title;
22 soliveira 122
    }
123
 
194 helio.frota 124
    public String getBody() {
125
        return body;
22 soliveira 126
    }
127
 
194 helio.frota 128
    public void setBody(String body) {
129
        this.body = body;
22 soliveira 130
    }
131
 
194 helio.frota 132
    public boolean isSystemPage() {
133
        return isSystemPage;
22 soliveira 134
    }
135
 
194 helio.frota 136
    public void setSystemPage(boolean isSystemPage) {
137
        this.isSystemPage = isSystemPage;
22 soliveira 138
    }
139
 
194 helio.frota 140
    public int getLanguageId() {
141
        return languageId;
22 soliveira 142
    }
143
 
194 helio.frota 144
    public void setLanguageId(int languageId) {
145
        this.languageId = languageId;
22 soliveira 146
    }
147
 
194 helio.frota 148
    public Language getLanguage() {
149
        return Language.fromId(languageId);
22 soliveira 150
    }
151
 
194 helio.frota 152
    public Locale getLocale() {
153
        return getLanguage() != null ? getLanguage().getLocale() : null;
22 soliveira 154
    }
155
 
194 helio.frota 156
    public String getLang() {
157
        return getLocale() != null ? getLocale().toString() : null;
22 soliveira 158
    }
159
 
194 helio.frota 160
    public int getModifiedById() {
161
        return modifiedById;
22 soliveira 162
    }
163
 
194 helio.frota 164
    public boolean isModified() {
165
        return modifiedById > 0;
22 soliveira 166
    }
194 helio.frota 167
 
168
    public void setModifiedById(int modifiedById) {
169
        this.modifiedById = modifiedById;
25 soliveira 170
    }
22 soliveira 171
 
194 helio.frota 172
    public Date getModifiedOn() {
173
        return modifiedOn;
25 soliveira 174
    }
175
 
194 helio.frota 176
    public String getFormattedModifiedOn() {
177
        return modifiedOn != null ? FORMATTER.format(modifiedOn) : null;
25 soliveira 178
    }
179
 
194 helio.frota 180
    public void setModifiedOn(Date modifiedOn) {
181
        this.modifiedOn = modifiedOn;
25 soliveira 182
    }
183
 
194 helio.frota 184
    public int getCreatedById() {
185
        return createdById;
186
    }
187
 
188
    public void setCreatedById(int createdById) {
189
        this.createdById = createdById;
190
    }
191
 
192
    public Date getCreatedOn() {
193
        return createdOn;
194
    }
195
 
196
    public String getFormattedCreatedOn() {
197
        return createdOn != null ? FORMATTER.format(createdOn) : null;
198
    }
199
 
200
    public void setCreatedOn(Date createdOn) {
201
        this.createdOn = createdOn;
202
    }
203
 
204
    public void setFrontPage(boolean isFrontPage) {
205
        this.isFrontPage = isFrontPage;
206
    }
207
 
208
    public boolean isFrontPage() {
209
        return isFrontPage;
210
    }
211
 
212
    public User getModifiedBy() {
213
        return modifiedBy;
214
    }
215
 
216
    public void setModifiedBy(User modifiedBy) {
217
        this.modifiedBy = modifiedBy;
218
    }
219
 
220
    public User getCreatedBy() {
221
        return createdBy;
222
    }
223
 
224
    public void setCreatedBy(User createdBy) {
225
        this.createdBy = createdBy;
226
    }
227
 
228
    public boolean isCSS() {
229
        return name.equals(CSS) || name.equals(PRINT_CSS);
230
    }
231
 
232
    public Boolean isDeleted() {
233
        return isDeleted;
234
    }
235
 
236
    public boolean getDeleted() {
237
        return isDeleted != null ? isDeleted : false;
238
    }
239
 
240
    public void setDeleted(Boolean b) {
241
        this.isDeleted = b;
242
    }
243
 
244
    public void setPreview(boolean b) {
245
        this.isPreview = b;
246
    }
247
 
248
    public boolean isPreview() {
249
        return isPreview;
250
    }
251
 
252
    public boolean isNew() {
253
        return isNew;
254
    }
255
 
256
    public void setNew(boolean b) {
257
        this.isNew = b;
258
    }
259
 
260
    @Override
22 soliveira 261
    public String toString() {
194 helio.frota 262
        return "Page:[name=" + name + ";language=" + getLanguage() + "]";
22 soliveira 263
    }
194 helio.frota 264
 
265
}