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