001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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 clone = new ShoppingOrderItemImpl();
231    
232                    clone.setOrderItemId(getOrderItemId());
233                    clone.setOrderId(getOrderId());
234                    clone.setItemId(getItemId());
235                    clone.setSku(getSku());
236                    clone.setName(getName());
237                    clone.setDescription(getDescription());
238                    clone.setProperties(getProperties());
239                    clone.setPrice(getPrice());
240                    clone.setQuantity(getQuantity());
241                    clone.setShippedDate(getShippedDate());
242    
243                    return clone;
244            }
245    
246            public int compareTo(ShoppingOrderItem shoppingOrderItem) {
247                    int value = 0;
248    
249                    value = getName().compareTo(shoppingOrderItem.getName());
250    
251                    if (value != 0) {
252                            return value;
253                    }
254    
255                    value = getDescription().compareTo(shoppingOrderItem.getDescription());
256    
257                    if (value != 0) {
258                            return value;
259                    }
260    
261                    return 0;
262            }
263    
264            public boolean equals(Object obj) {
265                    if (obj == null) {
266                            return false;
267                    }
268    
269                    ShoppingOrderItem shoppingOrderItem = null;
270    
271                    try {
272                            shoppingOrderItem = (ShoppingOrderItem)obj;
273                    }
274                    catch (ClassCastException cce) {
275                            return false;
276                    }
277    
278                    long pk = shoppingOrderItem.getPrimaryKey();
279    
280                    if (getPrimaryKey() == pk) {
281                            return true;
282                    }
283                    else {
284                            return false;
285                    }
286            }
287    
288            public int hashCode() {
289                    return (int)getPrimaryKey();
290            }
291    
292            public String toString() {
293                    StringBundler sb = new StringBundler(21);
294    
295                    sb.append("{orderItemId=");
296                    sb.append(getOrderItemId());
297                    sb.append(", orderId=");
298                    sb.append(getOrderId());
299                    sb.append(", itemId=");
300                    sb.append(getItemId());
301                    sb.append(", sku=");
302                    sb.append(getSku());
303                    sb.append(", name=");
304                    sb.append(getName());
305                    sb.append(", description=");
306                    sb.append(getDescription());
307                    sb.append(", properties=");
308                    sb.append(getProperties());
309                    sb.append(", price=");
310                    sb.append(getPrice());
311                    sb.append(", quantity=");
312                    sb.append(getQuantity());
313                    sb.append(", shippedDate=");
314                    sb.append(getShippedDate());
315                    sb.append("}");
316    
317                    return sb.toString();
318            }
319    
320            public String toXmlString() {
321                    StringBundler sb = new StringBundler(34);
322    
323                    sb.append("<model><model-name>");
324                    sb.append("com.liferay.portlet.shopping.model.ShoppingOrderItem");
325                    sb.append("</model-name>");
326    
327                    sb.append(
328                            "<column><column-name>orderItemId</column-name><column-value><![CDATA[");
329                    sb.append(getOrderItemId());
330                    sb.append("]]></column-value></column>");
331                    sb.append(
332                            "<column><column-name>orderId</column-name><column-value><![CDATA[");
333                    sb.append(getOrderId());
334                    sb.append("]]></column-value></column>");
335                    sb.append(
336                            "<column><column-name>itemId</column-name><column-value><![CDATA[");
337                    sb.append(getItemId());
338                    sb.append("]]></column-value></column>");
339                    sb.append(
340                            "<column><column-name>sku</column-name><column-value><![CDATA[");
341                    sb.append(getSku());
342                    sb.append("]]></column-value></column>");
343                    sb.append(
344                            "<column><column-name>name</column-name><column-value><![CDATA[");
345                    sb.append(getName());
346                    sb.append("]]></column-value></column>");
347                    sb.append(
348                            "<column><column-name>description</column-name><column-value><![CDATA[");
349                    sb.append(getDescription());
350                    sb.append("]]></column-value></column>");
351                    sb.append(
352                            "<column><column-name>properties</column-name><column-value><![CDATA[");
353                    sb.append(getProperties());
354                    sb.append("]]></column-value></column>");
355                    sb.append(
356                            "<column><column-name>price</column-name><column-value><![CDATA[");
357                    sb.append(getPrice());
358                    sb.append("]]></column-value></column>");
359                    sb.append(
360                            "<column><column-name>quantity</column-name><column-value><![CDATA[");
361                    sb.append(getQuantity());
362                    sb.append("]]></column-value></column>");
363                    sb.append(
364                            "<column><column-name>shippedDate</column-name><column-value><![CDATA[");
365                    sb.append(getShippedDate());
366                    sb.append("]]></column-value></column>");
367    
368                    sb.append("</model>");
369    
370                    return sb.toString();
371            }
372    
373            private long _orderItemId;
374            private long _orderId;
375            private String _itemId;
376            private String _sku;
377            private String _name;
378            private String _description;
379            private String _properties;
380            private double _price;
381            private int _quantity;
382            private Date _shippedDate;
383            private transient ExpandoBridge _expandoBridge;
384    }