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.impl;
016    
017    import com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.kernel.util.StringPool;
019    import com.liferay.portal.model.CacheModel;
020    
021    import com.liferay.portlet.shopping.model.ShoppingCart;
022    
023    import java.io.Serializable;
024    
025    import java.util.Date;
026    
027    /**
028     * The cache model class for representing ShoppingCart in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see ShoppingCart
032     * @generated
033     */
034    public class ShoppingCartCacheModel implements CacheModel<ShoppingCart>,
035            Serializable {
036            @Override
037            public String toString() {
038                    StringBundler sb = new StringBundler(23);
039    
040                    sb.append("{cartId=");
041                    sb.append(cartId);
042                    sb.append(", groupId=");
043                    sb.append(groupId);
044                    sb.append(", companyId=");
045                    sb.append(companyId);
046                    sb.append(", userId=");
047                    sb.append(userId);
048                    sb.append(", userName=");
049                    sb.append(userName);
050                    sb.append(", createDate=");
051                    sb.append(createDate);
052                    sb.append(", modifiedDate=");
053                    sb.append(modifiedDate);
054                    sb.append(", itemIds=");
055                    sb.append(itemIds);
056                    sb.append(", couponCodes=");
057                    sb.append(couponCodes);
058                    sb.append(", altShipping=");
059                    sb.append(altShipping);
060                    sb.append(", insure=");
061                    sb.append(insure);
062                    sb.append("}");
063    
064                    return sb.toString();
065            }
066    
067            public ShoppingCart toEntityModel() {
068                    ShoppingCartImpl shoppingCartImpl = new ShoppingCartImpl();
069    
070                    shoppingCartImpl.setCartId(cartId);
071                    shoppingCartImpl.setGroupId(groupId);
072                    shoppingCartImpl.setCompanyId(companyId);
073                    shoppingCartImpl.setUserId(userId);
074    
075                    if (userName == null) {
076                            shoppingCartImpl.setUserName(StringPool.BLANK);
077                    }
078                    else {
079                            shoppingCartImpl.setUserName(userName);
080                    }
081    
082                    if (createDate == Long.MIN_VALUE) {
083                            shoppingCartImpl.setCreateDate(null);
084                    }
085                    else {
086                            shoppingCartImpl.setCreateDate(new Date(createDate));
087                    }
088    
089                    if (modifiedDate == Long.MIN_VALUE) {
090                            shoppingCartImpl.setModifiedDate(null);
091                    }
092                    else {
093                            shoppingCartImpl.setModifiedDate(new Date(modifiedDate));
094                    }
095    
096                    if (itemIds == null) {
097                            shoppingCartImpl.setItemIds(StringPool.BLANK);
098                    }
099                    else {
100                            shoppingCartImpl.setItemIds(itemIds);
101                    }
102    
103                    if (couponCodes == null) {
104                            shoppingCartImpl.setCouponCodes(StringPool.BLANK);
105                    }
106                    else {
107                            shoppingCartImpl.setCouponCodes(couponCodes);
108                    }
109    
110                    shoppingCartImpl.setAltShipping(altShipping);
111                    shoppingCartImpl.setInsure(insure);
112    
113                    shoppingCartImpl.resetOriginalValues();
114    
115                    return shoppingCartImpl;
116            }
117    
118            public long cartId;
119            public long groupId;
120            public long companyId;
121            public long userId;
122            public String userName;
123            public long createDate;
124            public long modifiedDate;
125            public String itemIds;
126            public String couponCodes;
127            public int altShipping;
128            public boolean insure;
129    }