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.model.CacheModel;
019    
020    import com.liferay.portlet.shopping.model.ShoppingItemPrice;
021    
022    import java.io.Externalizable;
023    import java.io.IOException;
024    import java.io.ObjectInput;
025    import java.io.ObjectOutput;
026    
027    /**
028     * The cache model class for representing ShoppingItemPrice in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see ShoppingItemPrice
032     * @generated
033     */
034    public class ShoppingItemPriceCacheModel implements CacheModel<ShoppingItemPrice>,
035            Externalizable {
036            @Override
037            public String toString() {
038                    StringBundler sb = new StringBundler(21);
039    
040                    sb.append("{itemPriceId=");
041                    sb.append(itemPriceId);
042                    sb.append(", itemId=");
043                    sb.append(itemId);
044                    sb.append(", minQuantity=");
045                    sb.append(minQuantity);
046                    sb.append(", maxQuantity=");
047                    sb.append(maxQuantity);
048                    sb.append(", price=");
049                    sb.append(price);
050                    sb.append(", discount=");
051                    sb.append(discount);
052                    sb.append(", taxable=");
053                    sb.append(taxable);
054                    sb.append(", shipping=");
055                    sb.append(shipping);
056                    sb.append(", useShippingFormula=");
057                    sb.append(useShippingFormula);
058                    sb.append(", status=");
059                    sb.append(status);
060                    sb.append("}");
061    
062                    return sb.toString();
063            }
064    
065            @Override
066            public ShoppingItemPrice toEntityModel() {
067                    ShoppingItemPriceImpl shoppingItemPriceImpl = new ShoppingItemPriceImpl();
068    
069                    shoppingItemPriceImpl.setItemPriceId(itemPriceId);
070                    shoppingItemPriceImpl.setItemId(itemId);
071                    shoppingItemPriceImpl.setMinQuantity(minQuantity);
072                    shoppingItemPriceImpl.setMaxQuantity(maxQuantity);
073                    shoppingItemPriceImpl.setPrice(price);
074                    shoppingItemPriceImpl.setDiscount(discount);
075                    shoppingItemPriceImpl.setTaxable(taxable);
076                    shoppingItemPriceImpl.setShipping(shipping);
077                    shoppingItemPriceImpl.setUseShippingFormula(useShippingFormula);
078                    shoppingItemPriceImpl.setStatus(status);
079    
080                    shoppingItemPriceImpl.resetOriginalValues();
081    
082                    return shoppingItemPriceImpl;
083            }
084    
085            @Override
086            public void readExternal(ObjectInput objectInput) throws IOException {
087                    itemPriceId = objectInput.readLong();
088                    itemId = objectInput.readLong();
089                    minQuantity = objectInput.readInt();
090                    maxQuantity = objectInput.readInt();
091                    price = objectInput.readDouble();
092                    discount = objectInput.readDouble();
093                    taxable = objectInput.readBoolean();
094                    shipping = objectInput.readDouble();
095                    useShippingFormula = objectInput.readBoolean();
096                    status = objectInput.readInt();
097            }
098    
099            @Override
100            public void writeExternal(ObjectOutput objectOutput)
101                    throws IOException {
102                    objectOutput.writeLong(itemPriceId);
103                    objectOutput.writeLong(itemId);
104                    objectOutput.writeInt(minQuantity);
105                    objectOutput.writeInt(maxQuantity);
106                    objectOutput.writeDouble(price);
107                    objectOutput.writeDouble(discount);
108                    objectOutput.writeBoolean(taxable);
109                    objectOutput.writeDouble(shipping);
110                    objectOutput.writeBoolean(useShippingFormula);
111                    objectOutput.writeInt(status);
112            }
113    
114            public long itemPriceId;
115            public long itemId;
116            public int minQuantity;
117            public int maxQuantity;
118            public double price;
119            public double discount;
120            public boolean taxable;
121            public double shipping;
122            public boolean useShippingFormula;
123            public int status;
124    }