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