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