001    /**
002     * Copyright (c) 2000-2010 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.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.util.GetterUtil;
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.impl.BaseModelImpl;
022    import com.liferay.portal.service.ServiceContext;
023    
024    import com.liferay.portlet.expando.model.ExpandoBridge;
025    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
026    import com.liferay.portlet.shopping.model.ShoppingOrderItem;
027    import com.liferay.portlet.shopping.model.ShoppingOrderItemModel;
028    
029    import java.io.Serializable;
030    
031    import java.lang.reflect.Proxy;
032    
033    import java.sql.Types;
034    
035    import java.util.Date;
036    
037    /**
038     * <p>
039     * This interface is a model that represents the ShoppingOrderItem table in the
040     * database.
041     * </p>
042     *
043     * @author    Brian Wing Shun Chan
044     * @see       ShoppingOrderItemImpl
045     * @see       com.liferay.portlet.shopping.model.ShoppingOrderItem
046     * @see       com.liferay.portlet.shopping.model.ShoppingOrderItemModel
047     * @generated
048     */
049    public class ShoppingOrderItemModelImpl extends BaseModelImpl<ShoppingOrderItem>
050            implements ShoppingOrderItemModel {
051            public static final String TABLE_NAME = "ShoppingOrderItem";
052            public static final Object[][] TABLE_COLUMNS = {
053                            { "orderItemId", new Integer(Types.BIGINT) },
054                            { "orderId", new Integer(Types.BIGINT) },
055                            { "itemId", new Integer(Types.VARCHAR) },
056                            { "sku", new Integer(Types.VARCHAR) },
057                            { "name", new Integer(Types.VARCHAR) },
058                            { "description", new Integer(Types.VARCHAR) },
059                            { "properties", new Integer(Types.VARCHAR) },
060                            { "price", new Integer(Types.DOUBLE) },
061                            { "quantity", new Integer(Types.INTEGER) },
062                            { "shippedDate", new Integer(Types.TIMESTAMP) }
063                    };
064            public static final String TABLE_SQL_CREATE = "create table ShoppingOrderItem (orderItemId LONG not null primary key,orderId LONG,itemId VARCHAR(75) null,sku VARCHAR(75) null,name VARCHAR(200) null,description STRING null,properties STRING null,price DOUBLE,quantity INTEGER,shippedDate DATE null)";
065            public static final String TABLE_SQL_DROP = "drop table ShoppingOrderItem";
066            public static final String ORDER_BY_JPQL = " ORDER BY shoppingOrderItem.name ASC, shoppingOrderItem.description ASC";
067            public static final String ORDER_BY_SQL = " ORDER BY ShoppingOrderItem.name ASC, ShoppingOrderItem.description ASC";
068            public static final String DATA_SOURCE = "liferayDataSource";
069            public static final String SESSION_FACTORY = "liferaySessionFactory";
070            public static final String TX_MANAGER = "liferayTransactionManager";
071            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
072                                    "value.object.entity.cache.enabled.com.liferay.portlet.shopping.model.ShoppingOrderItem"),
073                            true);
074            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
075                                    "value.object.finder.cache.enabled.com.liferay.portlet.shopping.model.ShoppingOrderItem"),
076                            true);
077            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
078                                    "lock.expiration.time.com.liferay.portlet.shopping.model.ShoppingOrderItem"));
079    
080            public ShoppingOrderItemModelImpl() {
081            }
082    
083            public long getPrimaryKey() {
084                    return _orderItemId;
085            }
086    
087            public void setPrimaryKey(long pk) {
088                    setOrderItemId(pk);
089            }
090    
091            public Serializable getPrimaryKeyObj() {
092                    return new Long(_orderItemId);
093            }
094    
095            public long getOrderItemId() {
096                    return _orderItemId;
097            }
098    
099            public void setOrderItemId(long orderItemId) {
100                    _orderItemId = orderItemId;
101            }
102    
103            public long getOrderId() {
104                    return _orderId;
105            }
106    
107            public void setOrderId(long orderId) {
108                    _orderId = orderId;
109            }
110    
111            public String getItemId() {
112                    if (_itemId == null) {
113                            return StringPool.BLANK;
114                    }
115                    else {
116                            return _itemId;
117                    }
118            }
119    
120            public void setItemId(String itemId) {
121                    _itemId = itemId;
122            }
123    
124            public String getSku() {
125                    if (_sku == null) {
126                            return StringPool.BLANK;
127                    }
128                    else {
129                            return _sku;
130                    }
131            }
132    
133            public void setSku(String sku) {
134                    _sku = sku;
135            }
136    
137            public String getName() {
138                    if (_name == null) {
139                            return StringPool.BLANK;
140                    }
141                    else {
142                            return _name;
143                    }
144            }
145    
146            public void setName(String name) {
147                    _name = name;
148            }
149    
150            public String getDescription() {
151                    if (_description == null) {
152                            return StringPool.BLANK;
153                    }
154                    else {
155                            return _description;
156                    }
157            }
158    
159            public void setDescription(String description) {
160                    _description = description;
161            }
162    
163            public String getProperties() {
164                    if (_properties == null) {
165                            return StringPool.BLANK;
166                    }
167                    else {
168                            return _properties;
169                    }
170            }
171    
172            public void setProperties(String properties) {
173                    _properties = properties;
174            }
175    
176            public double getPrice() {
177                    return _price;
178            }
179    
180            public void setPrice(double price) {
181                    _price = price;
182            }
183    
184            public int getQuantity() {
185                    return _quantity;
186            }
187    
188            public void setQuantity(int quantity) {
189                    _quantity = quantity;
190            }
191    
192            public Date getShippedDate() {
193                    return _shippedDate;
194            }
195    
196            public void setShippedDate(Date shippedDate) {
197                    _shippedDate = shippedDate;
198            }
199    
200            public ShoppingOrderItem toEscapedModel() {
201                    if (isEscapedModel()) {
202                            return (ShoppingOrderItem)this;
203                    }
204                    else {
205                            return (ShoppingOrderItem)Proxy.newProxyInstance(ShoppingOrderItem.class.getClassLoader(),
206                                    new Class[] { ShoppingOrderItem.class },
207                                    new AutoEscapeBeanHandler(this));
208                    }
209            }
210    
211            public ExpandoBridge getExpandoBridge() {
212                    if (_expandoBridge == null) {
213                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
214                                            ShoppingOrderItem.class.getName(), getPrimaryKey());
215                    }
216    
217                    return _expandoBridge;
218            }
219    
220            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
221                    getExpandoBridge().setAttributes(serviceContext);
222            }
223    
224            public Object clone() {
225                    ShoppingOrderItemImpl clone = new ShoppingOrderItemImpl();
226    
227                    clone.setOrderItemId(getOrderItemId());
228                    clone.setOrderId(getOrderId());
229                    clone.setItemId(getItemId());
230                    clone.setSku(getSku());
231                    clone.setName(getName());
232                    clone.setDescription(getDescription());
233                    clone.setProperties(getProperties());
234                    clone.setPrice(getPrice());
235                    clone.setQuantity(getQuantity());
236                    clone.setShippedDate(getShippedDate());
237    
238                    return clone;
239            }
240    
241            public int compareTo(ShoppingOrderItem shoppingOrderItem) {
242                    int value = 0;
243    
244                    value = getName().compareTo(shoppingOrderItem.getName());
245    
246                    if (value != 0) {
247                            return value;
248                    }
249    
250                    value = getDescription().compareTo(shoppingOrderItem.getDescription());
251    
252                    if (value != 0) {
253                            return value;
254                    }
255    
256                    return 0;
257            }
258    
259            public boolean equals(Object obj) {
260                    if (obj == null) {
261                            return false;
262                    }
263    
264                    ShoppingOrderItem shoppingOrderItem = null;
265    
266                    try {
267                            shoppingOrderItem = (ShoppingOrderItem)obj;
268                    }
269                    catch (ClassCastException cce) {
270                            return false;
271                    }
272    
273                    long pk = shoppingOrderItem.getPrimaryKey();
274    
275                    if (getPrimaryKey() == pk) {
276                            return true;
277                    }
278                    else {
279                            return false;
280                    }
281            }
282    
283            public int hashCode() {
284                    return (int)getPrimaryKey();
285            }
286    
287            public String toString() {
288                    StringBundler sb = new StringBundler(21);
289    
290                    sb.append("{orderItemId=");
291                    sb.append(getOrderItemId());
292                    sb.append(", orderId=");
293                    sb.append(getOrderId());
294                    sb.append(", itemId=");
295                    sb.append(getItemId());
296                    sb.append(", sku=");
297                    sb.append(getSku());
298                    sb.append(", name=");
299                    sb.append(getName());
300                    sb.append(", description=");
301                    sb.append(getDescription());
302                    sb.append(", properties=");
303                    sb.append(getProperties());
304                    sb.append(", price=");
305                    sb.append(getPrice());
306                    sb.append(", quantity=");
307                    sb.append(getQuantity());
308                    sb.append(", shippedDate=");
309                    sb.append(getShippedDate());
310                    sb.append("}");
311    
312                    return sb.toString();
313            }
314    
315            public String toXmlString() {
316                    StringBundler sb = new StringBundler(34);
317    
318                    sb.append("<model><model-name>");
319                    sb.append("com.liferay.portlet.shopping.model.ShoppingOrderItem");
320                    sb.append("</model-name>");
321    
322                    sb.append(
323                            "<column><column-name>orderItemId</column-name><column-value><![CDATA[");
324                    sb.append(getOrderItemId());
325                    sb.append("]]></column-value></column>");
326                    sb.append(
327                            "<column><column-name>orderId</column-name><column-value><![CDATA[");
328                    sb.append(getOrderId());
329                    sb.append("]]></column-value></column>");
330                    sb.append(
331                            "<column><column-name>itemId</column-name><column-value><![CDATA[");
332                    sb.append(getItemId());
333                    sb.append("]]></column-value></column>");
334                    sb.append(
335                            "<column><column-name>sku</column-name><column-value><![CDATA[");
336                    sb.append(getSku());
337                    sb.append("]]></column-value></column>");
338                    sb.append(
339                            "<column><column-name>name</column-name><column-value><![CDATA[");
340                    sb.append(getName());
341                    sb.append("]]></column-value></column>");
342                    sb.append(
343                            "<column><column-name>description</column-name><column-value><![CDATA[");
344                    sb.append(getDescription());
345                    sb.append("]]></column-value></column>");
346                    sb.append(
347                            "<column><column-name>properties</column-name><column-value><![CDATA[");
348                    sb.append(getProperties());
349                    sb.append("]]></column-value></column>");
350                    sb.append(
351                            "<column><column-name>price</column-name><column-value><![CDATA[");
352                    sb.append(getPrice());
353                    sb.append("]]></column-value></column>");
354                    sb.append(
355                            "<column><column-name>quantity</column-name><column-value><![CDATA[");
356                    sb.append(getQuantity());
357                    sb.append("]]></column-value></column>");
358                    sb.append(
359                            "<column><column-name>shippedDate</column-name><column-value><![CDATA[");
360                    sb.append(getShippedDate());
361                    sb.append("]]></column-value></column>");
362    
363                    sb.append("</model>");
364    
365                    return sb.toString();
366            }
367    
368            private long _orderItemId;
369            private long _orderId;
370            private String _itemId;
371            private String _sku;
372            private String _name;
373            private String _description;
374            private String _properties;
375            private double _price;
376            private int _quantity;
377            private Date _shippedDate;
378            private transient ExpandoBridge _expandoBridge;
379    }