1
22
23 package com.liferay.portlet.blogs.model.impl;
24
25 import com.liferay.portal.kernel.util.GetterUtil;
26 import com.liferay.portal.model.impl.BaseModelImpl;
27 import com.liferay.portal.util.PropsUtil;
28
29 import com.liferay.util.XSSUtil;
30
31 import java.io.Serializable;
32
33 import java.sql.Types;
34
35 import java.util.Date;
36
37
57 public class BlogsCategoryModelImpl extends BaseModelImpl {
58 public static String TABLE_NAME = "BlogsCategory";
59 public static Object[][] TABLE_COLUMNS = {
60 { "categoryId", new Integer(Types.BIGINT) },
61 { "companyId", new Integer(Types.BIGINT) },
62 { "userId", new Integer(Types.BIGINT) },
63 { "userName", new Integer(Types.VARCHAR) },
64 { "createDate", new Integer(Types.TIMESTAMP) },
65 { "modifiedDate", new Integer(Types.TIMESTAMP) },
66 { "parentCategoryId", new Integer(Types.BIGINT) },
67 { "name", new Integer(Types.VARCHAR) },
68 { "description", new Integer(Types.VARCHAR) }
69 };
70 public static String TABLE_SQL_CREATE = "create table BlogsCategory (categoryId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,parentCategoryId LONG,name VARCHAR(75) null,description STRING null)";
71 public static String TABLE_SQL_DROP = "drop table BlogsCategory";
72 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
73 "xss.allow.com.liferay.portlet.blogs.model.BlogsCategory"),
74 XSS_ALLOW);
75 public static boolean XSS_ALLOW_USERNAME = GetterUtil.getBoolean(PropsUtil.get(
76 "xss.allow.com.liferay.portlet.blogs.model.BlogsCategory.userName"),
77 XSS_ALLOW_BY_MODEL);
78 public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
79 "xss.allow.com.liferay.portlet.blogs.model.BlogsCategory.name"),
80 XSS_ALLOW_BY_MODEL);
81 public static boolean XSS_ALLOW_DESCRIPTION = GetterUtil.getBoolean(PropsUtil.get(
82 "xss.allow.com.liferay.portlet.blogs.model.BlogsCategory.description"),
83 XSS_ALLOW_BY_MODEL);
84 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
85 "lock.expiration.time.com.liferay.portlet.blogs.model.BlogsCategoryModel"));
86
87 public BlogsCategoryModelImpl() {
88 }
89
90 public long getPrimaryKey() {
91 return _categoryId;
92 }
93
94 public void setPrimaryKey(long pk) {
95 setCategoryId(pk);
96 }
97
98 public Serializable getPrimaryKeyObj() {
99 return new Long(_categoryId);
100 }
101
102 public long getCategoryId() {
103 return _categoryId;
104 }
105
106 public void setCategoryId(long categoryId) {
107 if (categoryId != _categoryId) {
108 _categoryId = categoryId;
109 }
110 }
111
112 public long getCompanyId() {
113 return _companyId;
114 }
115
116 public void setCompanyId(long companyId) {
117 if (companyId != _companyId) {
118 _companyId = companyId;
119 }
120 }
121
122 public long getUserId() {
123 return _userId;
124 }
125
126 public void setUserId(long userId) {
127 if (userId != _userId) {
128 _userId = userId;
129 }
130 }
131
132 public String getUserName() {
133 return GetterUtil.getString(_userName);
134 }
135
136 public void setUserName(String userName) {
137 if (((userName == null) && (_userName != null)) ||
138 ((userName != null) && (_userName == null)) ||
139 ((userName != null) && (_userName != null) &&
140 !userName.equals(_userName))) {
141 if (!XSS_ALLOW_USERNAME) {
142 userName = XSSUtil.strip(userName);
143 }
144
145 _userName = userName;
146 }
147 }
148
149 public Date getCreateDate() {
150 return _createDate;
151 }
152
153 public void setCreateDate(Date createDate) {
154 if (((createDate == null) && (_createDate != null)) ||
155 ((createDate != null) && (_createDate == null)) ||
156 ((createDate != null) && (_createDate != null) &&
157 !createDate.equals(_createDate))) {
158 _createDate = createDate;
159 }
160 }
161
162 public Date getModifiedDate() {
163 return _modifiedDate;
164 }
165
166 public void setModifiedDate(Date modifiedDate) {
167 if (((modifiedDate == null) && (_modifiedDate != null)) ||
168 ((modifiedDate != null) && (_modifiedDate == null)) ||
169 ((modifiedDate != null) && (_modifiedDate != null) &&
170 !modifiedDate.equals(_modifiedDate))) {
171 _modifiedDate = modifiedDate;
172 }
173 }
174
175 public long getParentCategoryId() {
176 return _parentCategoryId;
177 }
178
179 public void setParentCategoryId(long parentCategoryId) {
180 if (parentCategoryId != _parentCategoryId) {
181 _parentCategoryId = parentCategoryId;
182 }
183 }
184
185 public String getName() {
186 return GetterUtil.getString(_name);
187 }
188
189 public void setName(String name) {
190 if (((name == null) && (_name != null)) ||
191 ((name != null) && (_name == null)) ||
192 ((name != null) && (_name != null) && !name.equals(_name))) {
193 if (!XSS_ALLOW_NAME) {
194 name = XSSUtil.strip(name);
195 }
196
197 _name = name;
198 }
199 }
200
201 public String getDescription() {
202 return GetterUtil.getString(_description);
203 }
204
205 public void setDescription(String description) {
206 if (((description == null) && (_description != null)) ||
207 ((description != null) && (_description == null)) ||
208 ((description != null) && (_description != null) &&
209 !description.equals(_description))) {
210 if (!XSS_ALLOW_DESCRIPTION) {
211 description = XSSUtil.strip(description);
212 }
213
214 _description = description;
215 }
216 }
217
218 public Object clone() {
219 BlogsCategoryImpl clone = new BlogsCategoryImpl();
220 clone.setCategoryId(getCategoryId());
221 clone.setCompanyId(getCompanyId());
222 clone.setUserId(getUserId());
223 clone.setUserName(getUserName());
224 clone.setCreateDate(getCreateDate());
225 clone.setModifiedDate(getModifiedDate());
226 clone.setParentCategoryId(getParentCategoryId());
227 clone.setName(getName());
228 clone.setDescription(getDescription());
229
230 return clone;
231 }
232
233 public int compareTo(Object obj) {
234 if (obj == null) {
235 return -1;
236 }
237
238 BlogsCategoryImpl blogsCategory = (BlogsCategoryImpl)obj;
239 int value = 0;
240 value = getName().toLowerCase().compareTo(blogsCategory.getName()
241 .toLowerCase());
242
243 if (value != 0) {
244 return value;
245 }
246
247 return 0;
248 }
249
250 public boolean equals(Object obj) {
251 if (obj == null) {
252 return false;
253 }
254
255 BlogsCategoryImpl blogsCategory = null;
256
257 try {
258 blogsCategory = (BlogsCategoryImpl)obj;
259 }
260 catch (ClassCastException cce) {
261 return false;
262 }
263
264 long pk = blogsCategory.getPrimaryKey();
265
266 if (getPrimaryKey() == pk) {
267 return true;
268 }
269 else {
270 return false;
271 }
272 }
273
274 public int hashCode() {
275 return (int)getPrimaryKey();
276 }
277
278 private long _categoryId;
279 private long _companyId;
280 private long _userId;
281 private String _userName;
282 private Date _createDate;
283 private Date _modifiedDate;
284 private long _parentCategoryId;
285 private String _name;
286 private String _description;
287 }