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.ShoppingOrderItem;
022    
023    import java.io.Serializable;
024    
025    import java.util.Date;
026    
027    /**
028     * The cache model class for representing ShoppingOrderItem in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see ShoppingOrderItem
032     * @generated
033     */
034    public class ShoppingOrderItemCacheModel implements CacheModel<ShoppingOrderItem>,
035            Serializable {
036            @Override
037            public String toString() {
038                    StringBundler sb = new StringBundler(21);
039    
040                    sb.append("{orderItemId=");
041                    sb.append(orderItemId);
042                    sb.append(", orderId=");
043                    sb.append(orderId);
044                    sb.append(", itemId=");
045                    sb.append(itemId);
046                    sb.append(", sku=");
047                    sb.append(sku);
048                    sb.append(", name=");
049                    sb.append(name);
050                    sb.append(", description=");
051                    sb.append(description);
052                    sb.append(", properties=");
053                    sb.append(properties);
054                    sb.append(", price=");
055                    sb.append(price);
056                    sb.append(", quantity=");
057                    sb.append(quantity);
058                    sb.append(", shippedDate=");
059                    sb.append(shippedDate);
060                    sb.append("}");
061    
062                    return sb.toString();
063            }
064    
065            public ShoppingOrderItem toEntityModel() {
066                    ShoppingOrderItemImpl shoppingOrderItemImpl = new ShoppingOrderItemImpl();
067    
068                    shoppingOrderItemImpl.setOrderItemId(orderItemId);
069                    shoppingOrderItemImpl.setOrderId(orderId);
070    
071                    if (itemId == null) {
072                            shoppingOrderItemImpl.setItemId(StringPool.BLANK);
073                    }
074                    else {
075                            shoppingOrderItemImpl.setItemId(itemId);
076                    }
077    
078                    if (sku == null) {
079                            shoppingOrderItemImpl.setSku(StringPool.BLANK);
080                    }
081                    else {
082                            shoppingOrderItemImpl.setSku(sku);
083                    }
084    
085                    if (name == null) {
086                            shoppingOrderItemImpl.setName(StringPool.BLANK);
087                    }
088                    else {
089                            shoppingOrderItemImpl.setName(name);
090                    }
091    
092                    if (description == null) {
093                            shoppingOrderItemImpl.setDescription(StringPool.BLANK);
094                    }
095                    else {
096                            shoppingOrderItemImpl.setDescription(description);
097                    }
098    
099                    if (properties == null) {
100                            shoppingOrderItemImpl.setProperties(StringPool.BLANK);
101                    }
102                    else {
103                            shoppingOrderItemImpl.setProperties(properties);
104                    }
105    
106                    shoppingOrderItemImpl.setPrice(price);
107                    shoppingOrderItemImpl.setQuantity(quantity);
108    
109                    if (shippedDate == Long.MIN_VALUE) {
110                            shoppingOrderItemImpl.setShippedDate(null);
111                    }
112                    else {
113                            shoppingOrderItemImpl.setShippedDate(new Date(shippedDate));
114                    }
115    
116                    shoppingOrderItemImpl.resetOriginalValues();
117    
118                    return shoppingOrderItemImpl;
119            }
120    
121            public long orderItemId;
122            public long orderId;
123            public String itemId;
124            public String sku;
125            public String name;
126            public String description;
127            public String properties;
128            public double price;
129            public int quantity;
130            public long shippedDate;
131    }