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.kernel.util.HtmlUtil;
28 import com.liferay.portal.model.impl.BaseModelImpl;
29 import com.liferay.portal.util.PropsUtil;
30
31 import com.liferay.portlet.shopping.model.ShoppingCart;
32 import com.liferay.portlet.shopping.model.ShoppingCartSoap;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.ArrayList;
41 import java.util.Date;
42 import java.util.List;
43
44
64 public class ShoppingCartModelImpl extends BaseModelImpl {
65 public static final String TABLE_NAME = "ShoppingCart";
66 public static final Object[][] TABLE_COLUMNS = {
67 { "cartId", new Integer(Types.BIGINT) },
68
69
70 { "groupId", new Integer(Types.BIGINT) },
71
72
73 { "companyId", new Integer(Types.BIGINT) },
74
75
76 { "userId", new Integer(Types.BIGINT) },
77
78
79 { "userName", new Integer(Types.VARCHAR) },
80
81
82 { "createDate", new Integer(Types.TIMESTAMP) },
83
84
85 { "modifiedDate", new Integer(Types.TIMESTAMP) },
86
87
88 { "itemIds", new Integer(Types.VARCHAR) },
89
90
91 { "couponCodes", new Integer(Types.VARCHAR) },
92
93
94 { "altShipping", new Integer(Types.INTEGER) },
95
96
97 { "insure", new Integer(Types.BOOLEAN) }
98 };
99 public static final String TABLE_SQL_CREATE = "create table ShoppingCart (cartId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,itemIds STRING null,couponCodes VARCHAR(75) null,altShipping INTEGER,insure BOOLEAN)";
100 public static final String TABLE_SQL_DROP = "drop table ShoppingCart";
101 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
102 "value.object.finder.cache.enabled.com.liferay.portlet.shopping.model.ShoppingCart"),
103 true);
104
105 public static ShoppingCart toModel(ShoppingCartSoap soapModel) {
106 ShoppingCart model = new ShoppingCartImpl();
107
108 model.setCartId(soapModel.getCartId());
109 model.setGroupId(soapModel.getGroupId());
110 model.setCompanyId(soapModel.getCompanyId());
111 model.setUserId(soapModel.getUserId());
112 model.setUserName(soapModel.getUserName());
113 model.setCreateDate(soapModel.getCreateDate());
114 model.setModifiedDate(soapModel.getModifiedDate());
115 model.setItemIds(soapModel.getItemIds());
116 model.setCouponCodes(soapModel.getCouponCodes());
117 model.setAltShipping(soapModel.getAltShipping());
118 model.setInsure(soapModel.getInsure());
119
120 return model;
121 }
122
123 public static List<ShoppingCart> toModels(ShoppingCartSoap[] soapModels) {
124 List<ShoppingCart> models = new ArrayList<ShoppingCart>(soapModels.length);
125
126 for (ShoppingCartSoap soapModel : soapModels) {
127 models.add(toModel(soapModel));
128 }
129
130 return models;
131 }
132
133 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
134 "lock.expiration.time.com.liferay.portlet.shopping.model.ShoppingCart"));
135
136 public ShoppingCartModelImpl() {
137 }
138
139 public long getPrimaryKey() {
140 return _cartId;
141 }
142
143 public void setPrimaryKey(long pk) {
144 setCartId(pk);
145 }
146
147 public Serializable getPrimaryKeyObj() {
148 return new Long(_cartId);
149 }
150
151 public long getCartId() {
152 return _cartId;
153 }
154
155 public void setCartId(long cartId) {
156 if (cartId != _cartId) {
157 _cartId = cartId;
158 }
159 }
160
161 public long getGroupId() {
162 return _groupId;
163 }
164
165 public void setGroupId(long groupId) {
166 if (groupId != _groupId) {
167 _groupId = groupId;
168 }
169 }
170
171 public long getCompanyId() {
172 return _companyId;
173 }
174
175 public void setCompanyId(long companyId) {
176 if (companyId != _companyId) {
177 _companyId = companyId;
178 }
179 }
180
181 public long getUserId() {
182 return _userId;
183 }
184
185 public void setUserId(long userId) {
186 if (userId != _userId) {
187 _userId = userId;
188 }
189 }
190
191 public String getUserName() {
192 return GetterUtil.getString(_userName);
193 }
194
195 public void setUserName(String userName) {
196 if (((userName == null) && (_userName != null)) ||
197 ((userName != null) && (_userName == null)) ||
198 ((userName != null) && (_userName != null) &&
199 !userName.equals(_userName))) {
200 _userName = userName;
201 }
202 }
203
204 public Date getCreateDate() {
205 return _createDate;
206 }
207
208 public void setCreateDate(Date createDate) {
209 if (((createDate == null) && (_createDate != null)) ||
210 ((createDate != null) && (_createDate == null)) ||
211 ((createDate != null) && (_createDate != null) &&
212 !createDate.equals(_createDate))) {
213 _createDate = createDate;
214 }
215 }
216
217 public Date getModifiedDate() {
218 return _modifiedDate;
219 }
220
221 public void setModifiedDate(Date modifiedDate) {
222 if (((modifiedDate == null) && (_modifiedDate != null)) ||
223 ((modifiedDate != null) && (_modifiedDate == null)) ||
224 ((modifiedDate != null) && (_modifiedDate != null) &&
225 !modifiedDate.equals(_modifiedDate))) {
226 _modifiedDate = modifiedDate;
227 }
228 }
229
230 public String getItemIds() {
231 return GetterUtil.getString(_itemIds);
232 }
233
234 public void setItemIds(String itemIds) {
235 if (((itemIds == null) && (_itemIds != null)) ||
236 ((itemIds != null) && (_itemIds == null)) ||
237 ((itemIds != null) && (_itemIds != null) &&
238 !itemIds.equals(_itemIds))) {
239 _itemIds = itemIds;
240 }
241 }
242
243 public String getCouponCodes() {
244 return GetterUtil.getString(_couponCodes);
245 }
246
247 public void setCouponCodes(String couponCodes) {
248 if (((couponCodes == null) && (_couponCodes != null)) ||
249 ((couponCodes != null) && (_couponCodes == null)) ||
250 ((couponCodes != null) && (_couponCodes != null) &&
251 !couponCodes.equals(_couponCodes))) {
252 _couponCodes = couponCodes;
253 }
254 }
255
256 public int getAltShipping() {
257 return _altShipping;
258 }
259
260 public void setAltShipping(int altShipping) {
261 if (altShipping != _altShipping) {
262 _altShipping = altShipping;
263 }
264 }
265
266 public boolean getInsure() {
267 return _insure;
268 }
269
270 public boolean isInsure() {
271 return _insure;
272 }
273
274 public void setInsure(boolean insure) {
275 if (insure != _insure) {
276 _insure = insure;
277 }
278 }
279
280 public ShoppingCart toEscapedModel() {
281 if (isEscapedModel()) {
282 return (ShoppingCart)this;
283 }
284 else {
285 ShoppingCart model = new ShoppingCartImpl();
286
287 model.setEscapedModel(true);
288
289 model.setCartId(getCartId());
290 model.setGroupId(getGroupId());
291 model.setCompanyId(getCompanyId());
292 model.setUserId(getUserId());
293 model.setUserName(HtmlUtil.escape(getUserName()));
294 model.setCreateDate(getCreateDate());
295 model.setModifiedDate(getModifiedDate());
296 model.setItemIds(HtmlUtil.escape(getItemIds()));
297 model.setCouponCodes(HtmlUtil.escape(getCouponCodes()));
298 model.setAltShipping(getAltShipping());
299 model.setInsure(getInsure());
300
301 model = (ShoppingCart)Proxy.newProxyInstance(ShoppingCart.class.getClassLoader(),
302 new Class[] { ShoppingCart.class },
303 new ReadOnlyBeanHandler(model));
304
305 return model;
306 }
307 }
308
309 public Object clone() {
310 ShoppingCartImpl clone = new ShoppingCartImpl();
311
312 clone.setCartId(getCartId());
313 clone.setGroupId(getGroupId());
314 clone.setCompanyId(getCompanyId());
315 clone.setUserId(getUserId());
316 clone.setUserName(getUserName());
317 clone.setCreateDate(getCreateDate());
318 clone.setModifiedDate(getModifiedDate());
319 clone.setItemIds(getItemIds());
320 clone.setCouponCodes(getCouponCodes());
321 clone.setAltShipping(getAltShipping());
322 clone.setInsure(getInsure());
323
324 return clone;
325 }
326
327 public int compareTo(Object obj) {
328 if (obj == null) {
329 return -1;
330 }
331
332 ShoppingCartImpl shoppingCart = (ShoppingCartImpl)obj;
333
334 long pk = shoppingCart.getPrimaryKey();
335
336 if (getPrimaryKey() < pk) {
337 return -1;
338 }
339 else if (getPrimaryKey() > pk) {
340 return 1;
341 }
342 else {
343 return 0;
344 }
345 }
346
347 public boolean equals(Object obj) {
348 if (obj == null) {
349 return false;
350 }
351
352 ShoppingCartImpl shoppingCart = null;
353
354 try {
355 shoppingCart = (ShoppingCartImpl)obj;
356 }
357 catch (ClassCastException cce) {
358 return false;
359 }
360
361 long pk = shoppingCart.getPrimaryKey();
362
363 if (getPrimaryKey() == pk) {
364 return true;
365 }
366 else {
367 return false;
368 }
369 }
370
371 public int hashCode() {
372 return (int)getPrimaryKey();
373 }
374
375 private long _cartId;
376 private long _groupId;
377 private long _companyId;
378 private long _userId;
379 private String _userName;
380 private Date _createDate;
381 private Date _modifiedDate;
382 private String _itemIds;
383 private String _couponCodes;
384 private int _altShipping;
385 private boolean _insure;
386 }