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            public ShoppingItemPrice toEntityModel() {
066                    ShoppingItemPriceImpl shoppingItemPriceImpl = new ShoppingItemPriceImpl();
067    
068                    shoppingItemPriceImpl.setItemPriceId(itemPriceId);
069                    shoppingItemPriceImpl.setItemId(itemId);
070                    shoppingItemPriceImpl.setMinQuantity(minQuantity);
071                    shoppingItemPriceImpl.setMaxQuantity(maxQuantity);
072                    shoppingItemPriceImpl.setPrice(price);
073                    shoppingItemPriceImpl.setDiscount(discount);
074                    shoppingItemPriceImpl.setTaxable(taxable);
075                    shoppingItemPriceImpl.setShipping(shipping);
076                    shoppingItemPriceImpl.setUseShippingFormula(useShippingFormula);
077                    shoppingItemPriceImpl.setStatus(status);
078    
079                    shoppingItemPriceImpl.resetOriginalValues();
080    
081                    return shoppingItemPriceImpl;
082            }
083    
084            public void readExternal(ObjectInput objectInput) throws IOException {
085                    itemPriceId = objectInput.readLong();
086                    itemId = objectInput.readLong();
087                    minQuantity = objectInput.readInt();
088                    maxQuantity = objectInput.readInt();
089                    price = objectInput.readDouble();
090                    discount = objectInput.readDouble();
091                    taxable = objectInput.readBoolean();
092                    shipping = objectInput.readDouble();
093                    useShippingFormula = objectInput.readBoolean();
094                    status = objectInput.readInt();
095            }
096    
097            public void writeExternal(ObjectOutput objectOutput)
098                    throws IOException {
099                    objectOutput.writeLong(itemPriceId);
100                    objectOutput.writeLong(itemId);
101                    objectOutput.writeInt(minQuantity);
102                    objectOutput.writeInt(maxQuantity);
103                    objectOutput.writeDouble(price);
104                    objectOutput.writeDouble(discount);
105                    objectOutput.writeBoolean(taxable);
106                    objectOutput.writeDouble(shipping);
107                    objectOutput.writeBoolean(useShippingFormula);
108                    objectOutput.writeInt(status);
109            }
110    
111            public long itemPriceId;
112            public long itemId;
113            public int minQuantity;
114            public int maxQuantity;
115            public double price;
116            public double discount;
117            public boolean taxable;
118            public double shipping;
119            public boolean useShippingFormula;
120            public int status;
121    }