001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.shopping.model;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.Validator;
020    import com.liferay.portal.model.ModelWrapper;
021    
022    import java.util.Date;
023    import java.util.HashMap;
024    import java.util.Map;
025    
026    /**
027     * <p>
028     * This class is a wrapper for {@link ShoppingCart}.
029     * </p>
030     *
031     * @author Brian Wing Shun Chan
032     * @see ShoppingCart
033     * @generated
034     */
035    @ProviderType
036    public class ShoppingCartWrapper implements ShoppingCart,
037            ModelWrapper<ShoppingCart> {
038            public ShoppingCartWrapper(ShoppingCart shoppingCart) {
039                    _shoppingCart = shoppingCart;
040            }
041    
042            @Override
043            public Class<?> getModelClass() {
044                    return ShoppingCart.class;
045            }
046    
047            @Override
048            public String getModelClassName() {
049                    return ShoppingCart.class.getName();
050            }
051    
052            @Override
053            public Map<String, Object> getModelAttributes() {
054                    Map<String, Object> attributes = new HashMap<String, Object>();
055    
056                    attributes.put("cartId", getCartId());
057                    attributes.put("groupId", getGroupId());
058                    attributes.put("companyId", getCompanyId());
059                    attributes.put("userId", getUserId());
060                    attributes.put("userName", getUserName());
061                    attributes.put("createDate", getCreateDate());
062                    attributes.put("modifiedDate", getModifiedDate());
063                    attributes.put("itemIds", getItemIds());
064                    attributes.put("couponCodes", getCouponCodes());
065                    attributes.put("altShipping", getAltShipping());
066                    attributes.put("insure", getInsure());
067    
068                    return attributes;
069            }
070    
071            @Override
072            public void setModelAttributes(Map<String, Object> attributes) {
073                    Long cartId = (Long)attributes.get("cartId");
074    
075                    if (cartId != null) {
076                            setCartId(cartId);
077                    }
078    
079                    Long groupId = (Long)attributes.get("groupId");
080    
081                    if (groupId != null) {
082                            setGroupId(groupId);
083                    }
084    
085                    Long companyId = (Long)attributes.get("companyId");
086    
087                    if (companyId != null) {
088                            setCompanyId(companyId);
089                    }
090    
091                    Long userId = (Long)attributes.get("userId");
092    
093                    if (userId != null) {
094                            setUserId(userId);
095                    }
096    
097                    String userName = (String)attributes.get("userName");
098    
099                    if (userName != null) {
100                            setUserName(userName);
101                    }
102    
103                    Date createDate = (Date)attributes.get("createDate");
104    
105                    if (createDate != null) {
106                            setCreateDate(createDate);
107                    }
108    
109                    Date modifiedDate = (Date)attributes.get("modifiedDate");
110    
111                    if (modifiedDate != null) {
112                            setModifiedDate(modifiedDate);
113                    }
114    
115                    String itemIds = (String)attributes.get("itemIds");
116    
117                    if (itemIds != null) {
118                            setItemIds(itemIds);
119                    }
120    
121                    String couponCodes = (String)attributes.get("couponCodes");
122    
123                    if (couponCodes != null) {
124                            setCouponCodes(couponCodes);
125                    }
126    
127                    Integer altShipping = (Integer)attributes.get("altShipping");
128    
129                    if (altShipping != null) {
130                            setAltShipping(altShipping);
131                    }
132    
133                    Boolean insure = (Boolean)attributes.get("insure");
134    
135                    if (insure != null) {
136                            setInsure(insure);
137                    }
138            }
139    
140            /**
141            * Returns the primary key of this shopping cart.
142            *
143            * @return the primary key of this shopping cart
144            */
145            @Override
146            public long getPrimaryKey() {
147                    return _shoppingCart.getPrimaryKey();
148            }
149    
150            /**
151            * Sets the primary key of this shopping cart.
152            *
153            * @param primaryKey the primary key of this shopping cart
154            */
155            @Override
156            public void setPrimaryKey(long primaryKey) {
157                    _shoppingCart.setPrimaryKey(primaryKey);
158            }
159    
160            /**
161            * Returns the cart ID of this shopping cart.
162            *
163            * @return the cart ID of this shopping cart
164            */
165            @Override
166            public long getCartId() {
167                    return _shoppingCart.getCartId();
168            }
169    
170            /**
171            * Sets the cart ID of this shopping cart.
172            *
173            * @param cartId the cart ID of this shopping cart
174            */
175            @Override
176            public void setCartId(long cartId) {
177                    _shoppingCart.setCartId(cartId);
178            }
179    
180            /**
181            * Returns the group ID of this shopping cart.
182            *
183            * @return the group ID of this shopping cart
184            */
185            @Override
186            public long getGroupId() {
187                    return _shoppingCart.getGroupId();
188            }
189    
190            /**
191            * Sets the group ID of this shopping cart.
192            *
193            * @param groupId the group ID of this shopping cart
194            */
195            @Override
196            public void setGroupId(long groupId) {
197                    _shoppingCart.setGroupId(groupId);
198            }
199    
200            /**
201            * Returns the company ID of this shopping cart.
202            *
203            * @return the company ID of this shopping cart
204            */
205            @Override
206            public long getCompanyId() {
207                    return _shoppingCart.getCompanyId();
208            }
209    
210            /**
211            * Sets the company ID of this shopping cart.
212            *
213            * @param companyId the company ID of this shopping cart
214            */
215            @Override
216            public void setCompanyId(long companyId) {
217                    _shoppingCart.setCompanyId(companyId);
218            }
219    
220            /**
221            * Returns the user ID of this shopping cart.
222            *
223            * @return the user ID of this shopping cart
224            */
225            @Override
226            public long getUserId() {
227                    return _shoppingCart.getUserId();
228            }
229    
230            /**
231            * Sets the user ID of this shopping cart.
232            *
233            * @param userId the user ID of this shopping cart
234            */
235            @Override
236            public void setUserId(long userId) {
237                    _shoppingCart.setUserId(userId);
238            }
239    
240            /**
241            * Returns the user uuid of this shopping cart.
242            *
243            * @return the user uuid of this shopping cart
244            * @throws SystemException if a system exception occurred
245            */
246            @Override
247            public java.lang.String getUserUuid()
248                    throws com.liferay.portal.kernel.exception.SystemException {
249                    return _shoppingCart.getUserUuid();
250            }
251    
252            /**
253            * Sets the user uuid of this shopping cart.
254            *
255            * @param userUuid the user uuid of this shopping cart
256            */
257            @Override
258            public void setUserUuid(java.lang.String userUuid) {
259                    _shoppingCart.setUserUuid(userUuid);
260            }
261    
262            /**
263            * Returns the user name of this shopping cart.
264            *
265            * @return the user name of this shopping cart
266            */
267            @Override
268            public java.lang.String getUserName() {
269                    return _shoppingCart.getUserName();
270            }
271    
272            /**
273            * Sets the user name of this shopping cart.
274            *
275            * @param userName the user name of this shopping cart
276            */
277            @Override
278            public void setUserName(java.lang.String userName) {
279                    _shoppingCart.setUserName(userName);
280            }
281    
282            /**
283            * Returns the create date of this shopping cart.
284            *
285            * @return the create date of this shopping cart
286            */
287            @Override
288            public java.util.Date getCreateDate() {
289                    return _shoppingCart.getCreateDate();
290            }
291    
292            /**
293            * Sets the create date of this shopping cart.
294            *
295            * @param createDate the create date of this shopping cart
296            */
297            @Override
298            public void setCreateDate(java.util.Date createDate) {
299                    _shoppingCart.setCreateDate(createDate);
300            }
301    
302            /**
303            * Returns the modified date of this shopping cart.
304            *
305            * @return the modified date of this shopping cart
306            */
307            @Override
308            public java.util.Date getModifiedDate() {
309                    return _shoppingCart.getModifiedDate();
310            }
311    
312            /**
313            * Sets the modified date of this shopping cart.
314            *
315            * @param modifiedDate the modified date of this shopping cart
316            */
317            @Override
318            public void setModifiedDate(java.util.Date modifiedDate) {
319                    _shoppingCart.setModifiedDate(modifiedDate);
320            }
321    
322            /**
323            * Returns the item IDs of this shopping cart.
324            *
325            * @return the item IDs of this shopping cart
326            */
327            @Override
328            public java.lang.String getItemIds() {
329                    return _shoppingCart.getItemIds();
330            }
331    
332            /**
333            * Sets the item IDs of this shopping cart.
334            *
335            * @param itemIds the item IDs of this shopping cart
336            */
337            @Override
338            public void setItemIds(java.lang.String itemIds) {
339                    _shoppingCart.setItemIds(itemIds);
340            }
341    
342            /**
343            * Returns the coupon codes of this shopping cart.
344            *
345            * @return the coupon codes of this shopping cart
346            */
347            @Override
348            public java.lang.String getCouponCodes() {
349                    return _shoppingCart.getCouponCodes();
350            }
351    
352            /**
353            * Sets the coupon codes of this shopping cart.
354            *
355            * @param couponCodes the coupon codes of this shopping cart
356            */
357            @Override
358            public void setCouponCodes(java.lang.String couponCodes) {
359                    _shoppingCart.setCouponCodes(couponCodes);
360            }
361    
362            /**
363            * Returns the alt shipping of this shopping cart.
364            *
365            * @return the alt shipping of this shopping cart
366            */
367            @Override
368            public int getAltShipping() {
369                    return _shoppingCart.getAltShipping();
370            }
371    
372            /**
373            * Sets the alt shipping of this shopping cart.
374            *
375            * @param altShipping the alt shipping of this shopping cart
376            */
377            @Override
378            public void setAltShipping(int altShipping) {
379                    _shoppingCart.setAltShipping(altShipping);
380            }
381    
382            /**
383            * Returns the insure of this shopping cart.
384            *
385            * @return the insure of this shopping cart
386            */
387            @Override
388            public boolean getInsure() {
389                    return _shoppingCart.getInsure();
390            }
391    
392            /**
393            * Returns <code>true</code> if this shopping cart is insure.
394            *
395            * @return <code>true</code> if this shopping cart is insure; <code>false</code> otherwise
396            */
397            @Override
398            public boolean isInsure() {
399                    return _shoppingCart.isInsure();
400            }
401    
402            /**
403            * Sets whether this shopping cart is insure.
404            *
405            * @param insure the insure of this shopping cart
406            */
407            @Override
408            public void setInsure(boolean insure) {
409                    _shoppingCart.setInsure(insure);
410            }
411    
412            @Override
413            public boolean isNew() {
414                    return _shoppingCart.isNew();
415            }
416    
417            @Override
418            public void setNew(boolean n) {
419                    _shoppingCart.setNew(n);
420            }
421    
422            @Override
423            public boolean isCachedModel() {
424                    return _shoppingCart.isCachedModel();
425            }
426    
427            @Override
428            public void setCachedModel(boolean cachedModel) {
429                    _shoppingCart.setCachedModel(cachedModel);
430            }
431    
432            @Override
433            public boolean isEscapedModel() {
434                    return _shoppingCart.isEscapedModel();
435            }
436    
437            @Override
438            public java.io.Serializable getPrimaryKeyObj() {
439                    return _shoppingCart.getPrimaryKeyObj();
440            }
441    
442            @Override
443            public void setPrimaryKeyObj(java.io.Serializable primaryKeyObj) {
444                    _shoppingCart.setPrimaryKeyObj(primaryKeyObj);
445            }
446    
447            @Override
448            public com.liferay.portlet.expando.model.ExpandoBridge getExpandoBridge() {
449                    return _shoppingCart.getExpandoBridge();
450            }
451    
452            @Override
453            public void setExpandoBridgeAttributes(
454                    com.liferay.portal.model.BaseModel<?> baseModel) {
455                    _shoppingCart.setExpandoBridgeAttributes(baseModel);
456            }
457    
458            @Override
459            public void setExpandoBridgeAttributes(
460                    com.liferay.portlet.expando.model.ExpandoBridge expandoBridge) {
461                    _shoppingCart.setExpandoBridgeAttributes(expandoBridge);
462            }
463    
464            @Override
465            public void setExpandoBridgeAttributes(
466                    com.liferay.portal.service.ServiceContext serviceContext) {
467                    _shoppingCart.setExpandoBridgeAttributes(serviceContext);
468            }
469    
470            @Override
471            public java.lang.Object clone() {
472                    return new ShoppingCartWrapper((ShoppingCart)_shoppingCart.clone());
473            }
474    
475            @Override
476            public int compareTo(
477                    com.liferay.portlet.shopping.model.ShoppingCart shoppingCart) {
478                    return _shoppingCart.compareTo(shoppingCart);
479            }
480    
481            @Override
482            public int hashCode() {
483                    return _shoppingCart.hashCode();
484            }
485    
486            @Override
487            public com.liferay.portal.model.CacheModel<com.liferay.portlet.shopping.model.ShoppingCart> toCacheModel() {
488                    return _shoppingCart.toCacheModel();
489            }
490    
491            @Override
492            public com.liferay.portlet.shopping.model.ShoppingCart toEscapedModel() {
493                    return new ShoppingCartWrapper(_shoppingCart.toEscapedModel());
494            }
495    
496            @Override
497            public com.liferay.portlet.shopping.model.ShoppingCart toUnescapedModel() {
498                    return new ShoppingCartWrapper(_shoppingCart.toUnescapedModel());
499            }
500    
501            @Override
502            public java.lang.String toString() {
503                    return _shoppingCart.toString();
504            }
505    
506            @Override
507            public java.lang.String toXmlString() {
508                    return _shoppingCart.toXmlString();
509            }
510    
511            @Override
512            public void persist()
513                    throws com.liferay.portal.kernel.exception.SystemException {
514                    _shoppingCart.persist();
515            }
516    
517            @Override
518            public void addItemId(long itemId, java.lang.String fields) {
519                    _shoppingCart.addItemId(itemId, fields);
520            }
521    
522            @Override
523            public com.liferay.portlet.shopping.model.ShoppingCoupon getCoupon()
524                    throws com.liferay.portal.kernel.exception.PortalException,
525                            com.liferay.portal.kernel.exception.SystemException {
526                    return _shoppingCart.getCoupon();
527            }
528    
529            @Override
530            public java.util.Map<com.liferay.portlet.shopping.model.ShoppingCartItem, java.lang.Integer> getItems()
531                    throws com.liferay.portal.kernel.exception.SystemException {
532                    return _shoppingCart.getItems();
533            }
534    
535            @Override
536            public int getItemsSize() {
537                    return _shoppingCart.getItemsSize();
538            }
539    
540            @Override
541            public boolean equals(Object obj) {
542                    if (this == obj) {
543                            return true;
544                    }
545    
546                    if (!(obj instanceof ShoppingCartWrapper)) {
547                            return false;
548                    }
549    
550                    ShoppingCartWrapper shoppingCartWrapper = (ShoppingCartWrapper)obj;
551    
552                    if (Validator.equals(_shoppingCart, shoppingCartWrapper._shoppingCart)) {
553                            return true;
554                    }
555    
556                    return false;
557            }
558    
559            /**
560             * @deprecated As of 6.1.0, replaced by {@link #getWrappedModel}
561             */
562            public ShoppingCart getWrappedShoppingCart() {
563                    return _shoppingCart;
564            }
565    
566            @Override
567            public ShoppingCart getWrappedModel() {
568                    return _shoppingCart;
569            }
570    
571            @Override
572            public void resetOriginalValues() {
573                    _shoppingCart.resetOriginalValues();
574            }
575    
576            private ShoppingCart _shoppingCart;
577    }