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