Rev 136 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 136 | Rev 194 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | 2 | ||
3 | import java.text.SimpleDateFormat; |
3 | import java.text.SimpleDateFormat; |
4 | import java.util.Date; |
4 | import java.util.Date; |
5 | import java.util.Locale; |
5 | import java.util.Locale; |
6 | 6 | ||
- | 7 | /**
|
|
- | 8 | * Model class Revision.
|
|
- | 9 | *
|
|
- | 10 | * @author Sergio Oliveira
|
|
- | 11 | *
|
|
- | 12 | */
|
|
7 | public class Revision { |
13 | public class Revision { |
8 | - | ||
9 | private static final SimpleDateFormat FORMATTER = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); |
- | |
10 | - | ||
11 | private int id; |
- | |
12 | private Integer revision; |
- | |
13 | private String name; |
- | |
14 | private int languageId; |
- | |
15 | private int userId; |
- | |
16 | private User user; |
- | |
17 | private String currTitle; |
- | |
18 | private String oldTitle; |
- | |
19 | private String newTitle; |
- | |
20 | private String oldBody; |
- | |
21 | private String newBody; |
- | |
22 | private Date createdOn; |
- | |
23 | private String comment; |
- | |
24 | private boolean isSystemPage; |
- | |
25 | private boolean isFrontPage; |
- | |
26 | - | ||
27 | public Revision() { } |
- | |
28 | 14 | ||
29 | public int getId() { |
- | |
30 | return id; |
- | |
- | 15 | /**Attribute constant FORMATTER of Revision. */
|
|
- | 16 | private static final SimpleDateFormat FORMATTER = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); |
|
- | 17 | ||
- | 18 | /** Attribute id of Revision. */
|
|
- | 19 | private int id; |
|
- | 20 | /** Attribute revision of Revision. */
|
|
- | 21 | private Integer revision; |
|
- | 22 | /** Attribute name of Revision. */
|
|
- | 23 | private String name; |
|
- | 24 | /** Attribute languageId of Revision. */
|
|
- | 25 | private int languageId; |
|
- | 26 | /** Attribute userId of Revision. */
|
|
- | 27 | private int userId; |
|
- | 28 | /** Attribute user of Revision. */
|
|
- | 29 | private User user; |
|
- | 30 | /** Attribute currTitle of Revision. */
|
|
- | 31 | private String currTitle; |
|
- | 32 | /** Attribute oldTitle of Revision. */
|
|
- | 33 | private String oldTitle; |
|
- | 34 | /** Attribute newTitle of Revision. */
|
|
- | 35 | private String newTitle; |
|
- | 36 | /** Attribute oldBody of Revision. */
|
|
- | 37 | private String oldBody; |
|
- | 38 | /** Attribute newBody of Revision. */
|
|
- | 39 | private String newBody; |
|
- | 40 | /** Attribute createdOn of Revision. */
|
|
- | 41 | private Date createdOn; |
|
- | 42 | /** Attribute comment of Revision. */
|
|
- | 43 | private String comment; |
|
- | 44 | /** Attribute isSystemPage of Revision. */
|
|
- | 45 | private boolean isSystemPage; |
|
- | 46 | /** Attribute isFrontPage of Revision. */
|
|
- | 47 | private boolean isFrontPage; |
|
- | 48 | ||
- | 49 | /**
|
|
- | 50 | * Default constructor.
|
|
- | 51 | */
|
|
- | 52 | public Revision() { } |
|
- | 53 | ||
- | 54 | /**
|
|
- | 55 | * Gets the id of Revision.
|
|
- | 56 | * @return int
|
|
- | 57 | */
|
|
- | 58 | public int getId() { |
|
- | 59 | return id; |
|
31 | }
|
60 | }
|
32 | - | ||
33 | public void setTitle(String s) { |
- | |
34 | this.currTitle = s; |
- | |
35 | }
|
- | |
36 | - | ||
37 | public String getTitle() { |
- | |
38 | return currTitle; |
- | |
39 | }
|
- | |
40 | - | ||
41 | public void setFrontPage(boolean b) { |
- | |
42 | this.isFrontPage = b; |
- | |
43 | }
|
- | |
44 | - | ||
45 | public boolean isFrontPage() { |
- | |
46 | return isFrontPage; |
- | |
47 | }
|
- | |
48 | - | ||
49 | public void setSystemPage(boolean b) { |
- | |
50 | this.isSystemPage = b; |
- | |
51 | }
|
- | |
52 | - | ||
53 | public boolean isSystemPage() { |
- | |
54 | return isSystemPage; |
- | |
55 | }
|
- | |
56 | - | ||
57 | public String getComment() { |
- | |
58 | return comment; |
- | |
59 | }
|
- | |
60 | - | ||
61 | public void setComment(String s) { |
- | |
62 | this.comment = s; |
- | |
63 | }
|
- | |
64 | 61 | ||
65 | public void setId(int id) { |
- | |
66 | this.id = id; |
- | |
- | 62 | /**
|
|
- | 63 | * Sets the id of Revision.
|
|
- | 64 | * @param s String
|
|
- | 65 | */
|
|
- | 66 | public void setTitle(String s) { |
|
- | 67 | this.currTitle = s; |
|
67 | }
|
68 | }
|
68 | 69 | ||
69 | public Integer getRevision() { |
- | |
70 | return revision; |
- | |
- | 70 | /**
|
|
- | 71 | * Gets the currTitle of Revision.
|
|
- | 72 | * @return String
|
|
- | 73 | */
|
|
- | 74 | public String getTitle() { |
|
- | 75 | return currTitle; |
|
71 | }
|
76 | }
|
72 | 77 | ||
73 | public void setRevision(int revision) { |
- | |
74 | this.revision = revision; |
- | |
- | 78 | /**
|
|
- | 79 | * Sets if isFrontPage of Revision.
|
|
- | 80 | * @param b boolean
|
|
- | 81 | */
|
|
- | 82 | public void setFrontPage(boolean b) { |
|
- | 83 | this.isFrontPage = b; |
|
75 | }
|
84 | }
|
76 | 85 | ||
77 | public String getName() { |
- | |
78 | return name; |
- | |
- | 86 | /**
|
|
- | 87 | * Check if isFrontPage of Revision.
|
|
- | 88 | * @return boolean
|
|
- | 89 | */
|
|
- | 90 | public boolean isFrontPage() { |
|
- | 91 | return isFrontPage; |
|
79 | }
|
92 | }
|
80 | 93 | ||
81 | public void setName(String name) { |
- | |
82 | this.name = name; |
- | |
- | 94 | /**
|
|
- | 95 | * Set if isSystemPage of Revision.
|
|
- | 96 | * @param b boolean
|
|
- | 97 | */
|
|
- | 98 | public void setSystemPage(boolean b) { |
|
- | 99 | this.isSystemPage = b; |
|
83 | }
|
100 | }
|
84 | 101 | ||
85 | public int getLanguageId() { |
- | |
86 | return languageId; |
- | |
- | 102 | /**
|
|
- | 103 | * Checks if isSystemPage of Revision.
|
|
- | 104 | * @return boolean
|
|
- | 105 | */
|
|
- | 106 | public boolean isSystemPage() { |
|
- | 107 | return isSystemPage; |
|
87 | }
|
108 | }
|
88 | 109 | ||
89 | public void setLanguageId(int languageId) { |
- | |
90 | this.languageId = languageId; |
- | |
- | 110 | /**
|
|
- | 111 | * Gets the comment of Revision.
|
|
- | 112 | * @return String
|
|
- | 113 | */
|
|
- | 114 | public String getComment() { |
|
- | 115 | return comment; |
|
91 | }
|
116 | }
|
92 | 117 | ||
93 | public int getUserId() { |
- | |
94 | return userId; |
- | |
- | 118 | /**
|
|
- | 119 | * Sets the comment of Revision.
|
|
- | 120 | * @param s String
|
|
- | 121 | */
|
|
- | 122 | public void setComment(String s) { |
|
- | 123 | this.comment = s; |
|
95 | }
|
124 | }
|
96 | 125 | ||
97 | public void setUserId(int userId) { |
- | |
98 | this.userId = userId; |
- | |
- | 126 | /**
|
|
- | 127 | * Sets the id of Revision.
|
|
- | 128 | * @param id int
|
|
- | 129 | */
|
|
- | 130 | public void setId(int id) { |
|
- | 131 | this.id = id; |
|
99 | }
|
132 | }
|
100 | 133 | ||
101 | public User getUser() { |
- | |
102 | return user; |
- | |
- | 134 | /**
|
|
- | 135 | * Gets the revision of Revision.
|
|
- | 136 | * @return Integer
|
|
- | 137 | */
|
|
- | 138 | public Integer getRevision() { |
|
- | 139 | return revision; |
|
103 | }
|
140 | }
|
104 | 141 | ||
105 | public void setUser(User user) { |
- | |
106 | this.user = user; |
- | |
- | 142 | /**
|
|
- | 143 | * Sets the revision of Revision.
|
|
- | 144 | * @param revision int
|
|
- | 145 | */
|
|
- | 146 | public void setRevision(int revision) { |
|
- | 147 | this.revision = revision; |
|
107 | }
|
148 | }
|
108 | 149 | ||
109 | public String getOldTitle() { |
- | |
110 | return oldTitle; |
- | |
- | 150 | /**
|
|
- | 151 | * Gets the name of Revision.
|
|
- | 152 | * @return String
|
|
- | 153 | */
|
|
- | 154 | public String getName() { |
|
- | 155 | return name; |
|
111 | }
|
156 | }
|
112 | 157 | ||
113 | public void setOldTitle(String oldTitle) { |
- | |
114 | this.oldTitle = oldTitle; |
- | |
- | 158 | /**
|
|
- | 159 | * Sets the name of Revision.
|
|
- | 160 | * @param name String
|
|
- | 161 | */
|
|
- | 162 | public void setName(String name) { |
|
- | 163 | this.name = name; |
|
115 | }
|
164 | }
|
116 | 165 | ||
117 | public String getNewTitle() { |
- | |
118 | return newTitle; |
- | |
- | 166 | /**
|
|
- | 167 | * Gets the languageId of Revision.
|
|
- | 168 | * @return int
|
|
- | 169 | */
|
|
- | 170 | public int getLanguageId() { |
|
- | 171 | return languageId; |
|
119 | }
|
172 | }
|
120 | 173 | ||
121 | public void setNewTitle(String newTitle) { |
- | |
122 | this.newTitle = newTitle; |
- | |
- | 174 | /**
|
|
- | 175 | * Sets the languageId of Revision.
|
|
- | 176 | * @param languageId int
|
|
- | 177 | */
|
|
- | 178 | public void setLanguageId(int languageId) { |
|
- | 179 | this.languageId = languageId; |
|
123 | }
|
180 | }
|
124 | - | ||
125 | public Language getLanguage() { |
- | |
126 | return Language.fromId(languageId); |
- | |
127 | }
|
- | |
128 | - | ||
129 | public Locale getLocale() { |
- | |
130 | return getLanguage() != null ? getLanguage().getLocale() : null; |
- | |
131 | }
|
- | |
132 | - | ||
133 | public String getLang() { |
- | |
134 | return getLocale() != null ? getLocale().toString() : null; |
- | |
135 | }
|
- | |
136 | 181 | ||
137 | public String getOldBody() { |
- | |
138 | return oldBody; |
- | |
- | 182 | /**
|
|
- | 183 | * Gets the userId of Revision.
|
|
- | 184 | * @return int
|
|
- | 185 | */
|
|
- | 186 | public int getUserId() { |
|
- | 187 | return userId; |
|
139 | }
|
188 | }
|
140 | 189 | ||
141 | public void setOldBody(String oldBody) { |
- | |
142 | this.oldBody = oldBody; |
- | |
- | 190 | /**
|
|
- | 191 | * Sets the userId of Revision.
|
|
- | 192 | * @param userId int
|
|
- | 193 | */
|
|
- | 194 | public void setUserId(int userId) { |
|
- | 195 | this.userId = userId; |
|
143 | }
|
196 | }
|
144 | 197 | ||
145 | public String getNewBody() { |
- | |
146 | return newBody; |
- | |
- | 198 | /**
|
|
- | 199 | * Gets the user of Revision.
|
|
- | 200 | * @return user
|
|
- | 201 | */
|
|
- | 202 | public User getUser() { |
|
- | 203 | return user; |
|
147 | }
|
204 | }
|
148 | 205 | ||
149 | public void setNewBody(String newBody) { |
- | |
150 | this.newBody = newBody; |
- | |
- | 206 | /**
|
|
- | 207 | * Sets the user of Revision.
|
|
- | 208 | * @param user User
|
|
- | 209 | */
|
|
- | 210 | public void setUser(User user) { |
|
- | 211 | this.user = user; |
|
151 | }
|
212 | }
|
152 | 213 | ||
153 | public Date getCreatedOn() { |
- | |
154 | return createdOn; |
- | |
- | 214 | /**
|
|
- | 215 | * Gets the oldTitle of Revision.
|
|
- | 216 | * @return String
|
|
- | 217 | */
|
|
- | 218 | public String getOldTitle() { |
|
- | 219 | return oldTitle; |
|
155 | }
|
220 | }
|
156 | - | ||
157 | public String getFormattedCreatedOn() { |
- | |
158 | return FORMATTER.format(createdOn); |
- | |
159 | }
|
- | |
160 | 221 | ||
161 | public void setCreatedOn(Date createdOn) { |
- | |
162 | this.createdOn = createdOn; |
- | |
- | 222 | /**
|
|
- | 223 | * Sets the oldTitle of Revision.
|
|
- | 224 | * @param oldTitle String
|
|
- | 225 | */
|
|
- | 226 | public void setOldTitle(String oldTitle) { |
|
- | 227 | this.oldTitle = oldTitle; |
|
163 | }
|
228 | }
|
164 | - | ||
165 | }
|
229 | |
- | 230 | /**
|
|
- | 231 | * Gets the newTitle of Revision.
|
|
- | 232 | * @return String
|
|
- | 233 | */
|
|
- | 234 | public String getNewTitle() { |
|
- | 235 | return newTitle; |
|
- | 236 | }
|
|
- | 237 | ||
- | 238 | /**
|
|
- | 239 | * Sets the newTitle of Revision.
|
|
- | 240 | * @param newTitle String
|
|
- | 241 | */
|
|
- | 242 | public void setNewTitle(String newTitle) { |
|
- | 243 | this.newTitle = newTitle; |
|
- | 244 | }
|
|
- | 245 | ||
- | 246 | /**
|
|
- | 247 | * Gets the language of Revision.
|
|
- | 248 | * @return Language
|
|
- | 249 | */
|
|
- | 250 | public Language getLanguage() { |
|
- | 251 | return Language.fromId(languageId); |
|
- | 252 | }
|
|
- | 253 | ||
- | 254 | /**
|
|
- | 255 | * Gets the locale of Revision.
|
|
- | 256 | * @return Locale
|
|
- | 257 | */
|
|
- | 258 | public Locale getLocale() { |
|
- | 259 | return getLanguage() != null ? getLanguage().getLocale() : null; |
|
- | 260 | }
|
|
- | 261 | ||
- | 262 | /**
|
|
- | 263 | * Gets the lang of Revision.
|
|
- | 264 | * @return String
|
|
- | 265 | */
|
|
- | 266 | public String getLang() { |
|
- | 267 | return getLocale() != null ? getLocale().toString() : null; |
|
- | 268 | }
|
|
- | 269 | ||
- | 270 | /**
|
|
- | 271 | * Gets the oldBody of Revision.
|
|
- | 272 | * @return String
|
|
- | 273 | */
|
|
- | 274 | public String getOldBody() { |
|
- | 275 | return oldBody; |
|
- | 276 | }
|
|
- | 277 | ||
- | 278 | /**
|
|
- | 279 | * Sets the oldBody of Revision.
|
|
- | 280 | * @param oldBody String
|
|
- | 281 | */
|
|
- | 282 | public void setOldBody(String oldBody) { |
|
- | 283 | this.oldBody = oldBody; |
|
- | 284 | }
|
|
- | 285 | ||
- | 286 | /**
|
|
- | 287 | * Gets the newBody of Revision.
|
|
- | 288 | * @return String
|
|
- | 289 | */
|
|
- | 290 | public String getNewBody() { |
|
- | 291 | return newBody; |
|
- | 292 | }
|
|
- | 293 | ||
- | 294 | /**
|
|
- | 295 | * Sets the newBody of Revision.
|
|
- | 296 | * @param newBody String
|
|
- | 297 | */
|
|
- | 298 | public void setNewBody(String newBody) { |
|
- | 299 | this.newBody = newBody; |
|
- | 300 | }
|
|
- | 301 | ||
- | 302 | /**
|
|
- | 303 | * Gets the createdOn date of Revision.
|
|
- | 304 | * @return Date
|
|
- | 305 | */
|
|
- | 306 | public Date getCreatedOn() { |
|
- | 307 | return createdOn; |
|
- | 308 | }
|
|
- | 309 | ||
- | 310 | /**
|
|
- | 311 | * Gets the formatted createdOn date of Revision.
|
|
- | 312 | * @return String
|
|
- | 313 | */
|
|
- | 314 | public String getFormattedCreatedOn() { |
|
- | 315 | return FORMATTER.format(createdOn); |
|
- | 316 | }
|
|
- | 317 | ||
- | 318 | /**
|
|
- | 319 | * Sets the createdOn date of Revision.
|
|
- | 320 | * @param createdOn Date
|
|
- | 321 | */
|
|
- | 322 | public void setCreatedOn(Date createdOn) { |
|
- | 323 | this.createdOn = createdOn; |
|
- | 324 | }
|
|
- | 325 | ||
- | 326 | }
|