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