1
22
23 package com.liferay.portlet.shopping.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.model.impl.BaseModelImpl;
28 import com.liferay.portal.util.PropsUtil;
29
30 import com.liferay.portlet.shopping.model.ShoppingCategory;
31
32 import com.liferay.util.Html;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.Date;
41
42
62 public class ShoppingCategoryModelImpl extends BaseModelImpl {
63 public static final String TABLE_NAME = "ShoppingCategory";
64 public static final Object[][] TABLE_COLUMNS = {
65 { "categoryId", new Integer(Types.BIGINT) },
66
67
68 { "groupId", new Integer(Types.BIGINT) },
69
70
71 { "companyId", new Integer(Types.BIGINT) },
72
73
74 { "userId", new Integer(Types.BIGINT) },
75
76
77 { "userName", new Integer(Types.VARCHAR) },
78
79
80 { "createDate", new Integer(Types.TIMESTAMP) },
81
82
83 { "modifiedDate", new Integer(Types.TIMESTAMP) },
84
85
86 { "parentCategoryId", new Integer(Types.BIGINT) },
87
88
89 { "name", new Integer(Types.VARCHAR) },
90
91
92 { "description", new Integer(Types.VARCHAR) }
93 };
94 public static final 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)";
95 public static final String TABLE_SQL_DROP = "drop table ShoppingCategory";
96 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
97 "value.object.finder.cache.enabled.com.liferay.portlet.shopping.model.ShoppingCategory"),
98 true);
99 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
100 "lock.expiration.time.com.liferay.portlet.shopping.model.ShoppingCategory"));
101
102 public ShoppingCategoryModelImpl() {
103 }
104
105 public long getPrimaryKey() {
106 return _categoryId;
107 }
108
109 public void setPrimaryKey(long pk) {
110 setCategoryId(pk);
111 }
112
113 public Serializable getPrimaryKeyObj() {
114 return new Long(_categoryId);
115 }
116
117 public long getCategoryId() {
118 return _categoryId;
119 }
120
121 public void setCategoryId(long categoryId) {
122 if (categoryId != _categoryId) {
123 _categoryId = categoryId;
124 }
125 }
126
127 public long getGroupId() {
128 return _groupId;
129 }
130
131 public void setGroupId(long groupId) {
132 if (groupId != _groupId) {
133 _groupId = groupId;
134 }
135 }
136
137 public long getCompanyId() {
138 return _companyId;
139 }
140
141 public void setCompanyId(long companyId) {
142 if (companyId != _companyId) {
143 _companyId = companyId;
144 }
145 }
146
147 public long getUserId() {
148 return _userId;
149 }
150
151 public void setUserId(long userId) {
152 if (userId != _userId) {
153 _userId = userId;
154 }
155 }
156
157 public String getUserName() {
158 return GetterUtil.getString(_userName);
159 }
160
161 public void setUserName(String userName) {
162 if (((userName == null) && (_userName != null)) ||
163 ((userName != null) && (_userName == null)) ||
164 ((userName != null) && (_userName != null) &&
165 !userName.equals(_userName))) {
166 _userName = userName;
167 }
168 }
169
170 public Date getCreateDate() {
171 return _createDate;
172 }
173
174 public void setCreateDate(Date createDate) {
175 if (((createDate == null) && (_createDate != null)) ||
176 ((createDate != null) && (_createDate == null)) ||
177 ((createDate != null) && (_createDate != null) &&
178 !createDate.equals(_createDate))) {
179 _createDate = createDate;
180 }
181 }
182
183 public Date getModifiedDate() {
184 return _modifiedDate;
185 }
186
187 public void setModifiedDate(Date modifiedDate) {
188 if (((modifiedDate == null) && (_modifiedDate != null)) ||
189 ((modifiedDate != null) && (_modifiedDate == null)) ||
190 ((modifiedDate != null) && (_modifiedDate != null) &&
191 !modifiedDate.equals(_modifiedDate))) {
192 _modifiedDate = modifiedDate;
193 }
194 }
195
196 public long getParentCategoryId() {
197 return _parentCategoryId;
198 }
199
200 public void setParentCategoryId(long parentCategoryId) {
201 if (parentCategoryId != _parentCategoryId) {
202 _parentCategoryId = parentCategoryId;
203 }
204 }
205
206 public String getName() {
207 return GetterUtil.getString(_name);
208 }
209
210 public void setName(String name) {
211 if (((name == null) && (_name != null)) ||
212 ((name != null) && (_name == null)) ||
213 ((name != null) && (_name != null) && !name.equals(_name))) {
214 _name = name;
215 }
216 }
217
218 public String getDescription() {
219 return GetterUtil.getString(_description);
220 }
221
222 public void setDescription(String description) {
223 if (((description == null) && (_description != null)) ||
224 ((description != null) && (_description == null)) ||
225 ((description != null) && (_description != null) &&
226 !description.equals(_description))) {
227 _description = description;
228 }
229 }
230
231 public ShoppingCategory toEscapedModel() {
232 if (isEscapedModel()) {
233 return (ShoppingCategory)this;
234 }
235 else {
236 ShoppingCategory model = new ShoppingCategoryImpl();
237
238 model.setEscapedModel(true);
239
240 model.setCategoryId(getCategoryId());
241 model.setGroupId(getGroupId());
242 model.setCompanyId(getCompanyId());
243 model.setUserId(getUserId());
244 model.setUserName(Html.escape(getUserName()));
245 model.setCreateDate(getCreateDate());
246 model.setModifiedDate(getModifiedDate());
247 model.setParentCategoryId(getParentCategoryId());
248 model.setName(Html.escape(getName()));
249 model.setDescription(Html.escape(getDescription()));
250
251 model = (ShoppingCategory)Proxy.newProxyInstance(ShoppingCategory.class.getClassLoader(),
252 new Class[] { ShoppingCategory.class },
253 new ReadOnlyBeanHandler(model));
254
255 return model;
256 }
257 }
258
259 public Object clone() {
260 ShoppingCategoryImpl clone = new ShoppingCategoryImpl();
261
262 clone.setCategoryId(getCategoryId());
263 clone.setGroupId(getGroupId());
264 clone.setCompanyId(getCompanyId());
265 clone.setUserId(getUserId());
266 clone.setUserName(getUserName());
267 clone.setCreateDate(getCreateDate());
268 clone.setModifiedDate(getModifiedDate());
269 clone.setParentCategoryId(getParentCategoryId());
270 clone.setName(getName());
271 clone.setDescription(getDescription());
272
273 return clone;
274 }
275
276 public int compareTo(Object obj) {
277 if (obj == null) {
278 return -1;
279 }
280
281 ShoppingCategoryImpl shoppingCategory = (ShoppingCategoryImpl)obj;
282
283 int value = 0;
284
285 if (getParentCategoryId() < shoppingCategory.getParentCategoryId()) {
286 value = -1;
287 }
288 else if (getParentCategoryId() > shoppingCategory.getParentCategoryId()) {
289 value = 1;
290 }
291 else {
292 value = 0;
293 }
294
295 if (value != 0) {
296 return value;
297 }
298
299 value = getName().toLowerCase().compareTo(shoppingCategory.getName()
300 .toLowerCase());
301
302 if (value != 0) {
303 return value;
304 }
305
306 return 0;
307 }
308
309 public boolean equals(Object obj) {
310 if (obj == null) {
311 return false;
312 }
313
314 ShoppingCategoryImpl shoppingCategory = null;
315
316 try {
317 shoppingCategory = (ShoppingCategoryImpl)obj;
318 }
319 catch (ClassCastException cce) {
320 return false;
321 }
322
323 long pk = shoppingCategory.getPrimaryKey();
324
325 if (getPrimaryKey() == pk) {
326 return true;
327 }
328 else {
329 return false;
330 }
331 }
332
333 public int hashCode() {
334 return (int)getPrimaryKey();
335 }
336
337 private long _categoryId;
338 private long _groupId;
339 private long _companyId;
340 private long _userId;
341 private String _userName;
342 private Date _createDate;
343 private Date _modifiedDate;
344 private long _parentCategoryId;
345 private String _name;
346 private String _description;
347 }