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