1
19
20 package com.liferay.portlet.shopping.model.impl;
21
22 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23 import com.liferay.portal.kernel.util.GetterUtil;
24 import com.liferay.portal.kernel.util.HtmlUtil;
25 import com.liferay.portal.model.impl.BaseModelImpl;
26
27 import com.liferay.portlet.shopping.model.ShoppingOrderItem;
28 import com.liferay.portlet.shopping.model.ShoppingOrderItemSoap;
29
30 import java.io.Serializable;
31
32 import java.lang.reflect.Proxy;
33
34 import java.sql.Types;
35
36 import java.util.ArrayList;
37 import java.util.Date;
38 import java.util.List;
39
40
60 public class ShoppingOrderItemModelImpl extends BaseModelImpl {
61 public static final String TABLE_NAME = "ShoppingOrderItem";
62 public static final Object[][] TABLE_COLUMNS = {
63 { "orderItemId", new Integer(Types.BIGINT) },
64
65
66 { "orderId", new Integer(Types.BIGINT) },
67
68
69 { "itemId", new Integer(Types.VARCHAR) },
70
71
72 { "sku", new Integer(Types.VARCHAR) },
73
74
75 { "name", new Integer(Types.VARCHAR) },
76
77
78 { "description", new Integer(Types.VARCHAR) },
79
80
81 { "properties", new Integer(Types.VARCHAR) },
82
83
84 { "price", new Integer(Types.DOUBLE) },
85
86
87 { "quantity", new Integer(Types.INTEGER) },
88
89
90 { "shippedDate", new Integer(Types.TIMESTAMP) }
91 };
92 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)";
93 public static final String TABLE_SQL_DROP = "drop table ShoppingOrderItem";
94 public static final String DATA_SOURCE = "liferayDataSource";
95 public static final String SESSION_FACTORY = "liferaySessionFactory";
96 public static final String TX_MANAGER = "liferayTransactionManager";
97 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
98 "value.object.finder.cache.enabled.com.liferay.portlet.shopping.model.ShoppingOrderItem"),
99 true);
100
101 public static ShoppingOrderItem toModel(ShoppingOrderItemSoap soapModel) {
102 ShoppingOrderItem model = new ShoppingOrderItemImpl();
103
104 model.setOrderItemId(soapModel.getOrderItemId());
105 model.setOrderId(soapModel.getOrderId());
106 model.setItemId(soapModel.getItemId());
107 model.setSku(soapModel.getSku());
108 model.setName(soapModel.getName());
109 model.setDescription(soapModel.getDescription());
110 model.setProperties(soapModel.getProperties());
111 model.setPrice(soapModel.getPrice());
112 model.setQuantity(soapModel.getQuantity());
113 model.setShippedDate(soapModel.getShippedDate());
114
115 return model;
116 }
117
118 public static List<ShoppingOrderItem> toModels(
119 ShoppingOrderItemSoap[] soapModels) {
120 List<ShoppingOrderItem> models = new ArrayList<ShoppingOrderItem>(soapModels.length);
121
122 for (ShoppingOrderItemSoap soapModel : soapModels) {
123 models.add(toModel(soapModel));
124 }
125
126 return models;
127 }
128
129 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
130 "lock.expiration.time.com.liferay.portlet.shopping.model.ShoppingOrderItem"));
131
132 public ShoppingOrderItemModelImpl() {
133 }
134
135 public long getPrimaryKey() {
136 return _orderItemId;
137 }
138
139 public void setPrimaryKey(long pk) {
140 setOrderItemId(pk);
141 }
142
143 public Serializable getPrimaryKeyObj() {
144 return new Long(_orderItemId);
145 }
146
147 public long getOrderItemId() {
148 return _orderItemId;
149 }
150
151 public void setOrderItemId(long orderItemId) {
152 if (orderItemId != _orderItemId) {
153 _orderItemId = orderItemId;
154 }
155 }
156
157 public long getOrderId() {
158 return _orderId;
159 }
160
161 public void setOrderId(long orderId) {
162 if (orderId != _orderId) {
163 _orderId = orderId;
164 }
165 }
166
167 public String getItemId() {
168 return GetterUtil.getString(_itemId);
169 }
170
171 public void setItemId(String itemId) {
172 if (((itemId == null) && (_itemId != null)) ||
173 ((itemId != null) && (_itemId == null)) ||
174 ((itemId != null) && (_itemId != null) &&
175 !itemId.equals(_itemId))) {
176 _itemId = itemId;
177 }
178 }
179
180 public String getSku() {
181 return GetterUtil.getString(_sku);
182 }
183
184 public void setSku(String sku) {
185 if (((sku == null) && (_sku != null)) ||
186 ((sku != null) && (_sku == null)) ||
187 ((sku != null) && (_sku != null) && !sku.equals(_sku))) {
188 _sku = sku;
189 }
190 }
191
192 public String getName() {
193 return GetterUtil.getString(_name);
194 }
195
196 public void setName(String name) {
197 if (((name == null) && (_name != null)) ||
198 ((name != null) && (_name == null)) ||
199 ((name != null) && (_name != null) && !name.equals(_name))) {
200 _name = name;
201 }
202 }
203
204 public String getDescription() {
205 return GetterUtil.getString(_description);
206 }
207
208 public void setDescription(String description) {
209 if (((description == null) && (_description != null)) ||
210 ((description != null) && (_description == null)) ||
211 ((description != null) && (_description != null) &&
212 !description.equals(_description))) {
213 _description = description;
214 }
215 }
216
217 public String getProperties() {
218 return GetterUtil.getString(_properties);
219 }
220
221 public void setProperties(String properties) {
222 if (((properties == null) && (_properties != null)) ||
223 ((properties != null) && (_properties == null)) ||
224 ((properties != null) && (_properties != null) &&
225 !properties.equals(_properties))) {
226 _properties = properties;
227 }
228 }
229
230 public double getPrice() {
231 return _price;
232 }
233
234 public void setPrice(double price) {
235 if (price != _price) {
236 _price = price;
237 }
238 }
239
240 public int getQuantity() {
241 return _quantity;
242 }
243
244 public void setQuantity(int quantity) {
245 if (quantity != _quantity) {
246 _quantity = quantity;
247 }
248 }
249
250 public Date getShippedDate() {
251 return _shippedDate;
252 }
253
254 public void setShippedDate(Date shippedDate) {
255 if (((shippedDate == null) && (_shippedDate != null)) ||
256 ((shippedDate != null) && (_shippedDate == null)) ||
257 ((shippedDate != null) && (_shippedDate != null) &&
258 !shippedDate.equals(_shippedDate))) {
259 _shippedDate = shippedDate;
260 }
261 }
262
263 public ShoppingOrderItem toEscapedModel() {
264 if (isEscapedModel()) {
265 return (ShoppingOrderItem)this;
266 }
267 else {
268 ShoppingOrderItem model = new ShoppingOrderItemImpl();
269
270 model.setNew(isNew());
271 model.setEscapedModel(true);
272
273 model.setOrderItemId(getOrderItemId());
274 model.setOrderId(getOrderId());
275 model.setItemId(HtmlUtil.escape(getItemId()));
276 model.setSku(HtmlUtil.escape(getSku()));
277 model.setName(HtmlUtil.escape(getName()));
278 model.setDescription(HtmlUtil.escape(getDescription()));
279 model.setProperties(HtmlUtil.escape(getProperties()));
280 model.setPrice(getPrice());
281 model.setQuantity(getQuantity());
282 model.setShippedDate(getShippedDate());
283
284 model = (ShoppingOrderItem)Proxy.newProxyInstance(ShoppingOrderItem.class.getClassLoader(),
285 new Class[] { ShoppingOrderItem.class },
286 new ReadOnlyBeanHandler(model));
287
288 return model;
289 }
290 }
291
292 public Object clone() {
293 ShoppingOrderItemImpl clone = new ShoppingOrderItemImpl();
294
295 clone.setOrderItemId(getOrderItemId());
296 clone.setOrderId(getOrderId());
297 clone.setItemId(getItemId());
298 clone.setSku(getSku());
299 clone.setName(getName());
300 clone.setDescription(getDescription());
301 clone.setProperties(getProperties());
302 clone.setPrice(getPrice());
303 clone.setQuantity(getQuantity());
304 clone.setShippedDate(getShippedDate());
305
306 return clone;
307 }
308
309 public int compareTo(Object obj) {
310 if (obj == null) {
311 return -1;
312 }
313
314 ShoppingOrderItemImpl shoppingOrderItem = (ShoppingOrderItemImpl)obj;
315
316 int value = 0;
317
318 value = getName().compareTo(shoppingOrderItem.getName());
319
320 if (value != 0) {
321 return value;
322 }
323
324 value = getDescription().compareTo(shoppingOrderItem.getDescription());
325
326 if (value != 0) {
327 return value;
328 }
329
330 return 0;
331 }
332
333 public boolean equals(Object obj) {
334 if (obj == null) {
335 return false;
336 }
337
338 ShoppingOrderItemImpl shoppingOrderItem = null;
339
340 try {
341 shoppingOrderItem = (ShoppingOrderItemImpl)obj;
342 }
343 catch (ClassCastException cce) {
344 return false;
345 }
346
347 long pk = shoppingOrderItem.getPrimaryKey();
348
349 if (getPrimaryKey() == pk) {
350 return true;
351 }
352 else {
353 return false;
354 }
355 }
356
357 public int hashCode() {
358 return (int)getPrimaryKey();
359 }
360
361 private long _orderItemId;
362 private long _orderId;
363 private String _itemId;
364 private String _sku;
365 private String _name;
366 private String _description;
367 private String _properties;
368 private double _price;
369 private int _quantity;
370 private Date _shippedDate;
371 }