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