1
22
23 package com.liferay.portlet.shopping.model.impl;
24
25 import com.liferay.portal.kernel.util.GetterUtil;
26 import com.liferay.portal.model.impl.BaseModelImpl;
27 import com.liferay.portal.util.PropsUtil;
28
29 import com.liferay.util.XSSUtil;
30
31 import java.io.Serializable;
32
33 import java.sql.Types;
34
35 import java.util.Date;
36
37
57 public class ShoppingOrderItemModelImpl extends BaseModelImpl {
58 public static String TABLE_NAME = "ShoppingOrderItem";
59 public static Object[][] TABLE_COLUMNS = {
60 { "orderItemId", new Integer(Types.BIGINT) },
61 { "orderId", new Integer(Types.BIGINT) },
62 { "itemId", new Integer(Types.VARCHAR) },
63 { "sku", new Integer(Types.VARCHAR) },
64 { "name", new Integer(Types.VARCHAR) },
65 { "description", new Integer(Types.VARCHAR) },
66 { "properties", new Integer(Types.VARCHAR) },
67 { "price", new Integer(Types.DOUBLE) },
68 { "quantity", new Integer(Types.INTEGER) },
69 { "shippedDate", new Integer(Types.TIMESTAMP) }
70 };
71 public static 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)";
72 public static String TABLE_SQL_DROP = "drop table ShoppingOrderItem";
73 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
74 "xss.allow.com.liferay.portlet.shopping.model.ShoppingOrderItem"),
75 XSS_ALLOW);
76 public static boolean XSS_ALLOW_ITEMID = GetterUtil.getBoolean(PropsUtil.get(
77 "xss.allow.com.liferay.portlet.shopping.model.ShoppingOrderItem.itemId"),
78 XSS_ALLOW_BY_MODEL);
79 public static boolean XSS_ALLOW_SKU = GetterUtil.getBoolean(PropsUtil.get(
80 "xss.allow.com.liferay.portlet.shopping.model.ShoppingOrderItem.sku"),
81 XSS_ALLOW_BY_MODEL);
82 public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
83 "xss.allow.com.liferay.portlet.shopping.model.ShoppingOrderItem.name"),
84 XSS_ALLOW_BY_MODEL);
85 public static boolean XSS_ALLOW_DESCRIPTION = GetterUtil.getBoolean(PropsUtil.get(
86 "xss.allow.com.liferay.portlet.shopping.model.ShoppingOrderItem.description"),
87 XSS_ALLOW_BY_MODEL);
88 public static boolean XSS_ALLOW_PROPERTIES = GetterUtil.getBoolean(PropsUtil.get(
89 "xss.allow.com.liferay.portlet.shopping.model.ShoppingOrderItem.properties"),
90 XSS_ALLOW_BY_MODEL);
91 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
92 "lock.expiration.time.com.liferay.portlet.shopping.model.ShoppingOrderItemModel"));
93
94 public ShoppingOrderItemModelImpl() {
95 }
96
97 public long getPrimaryKey() {
98 return _orderItemId;
99 }
100
101 public void setPrimaryKey(long pk) {
102 setOrderItemId(pk);
103 }
104
105 public Serializable getPrimaryKeyObj() {
106 return new Long(_orderItemId);
107 }
108
109 public long getOrderItemId() {
110 return _orderItemId;
111 }
112
113 public void setOrderItemId(long orderItemId) {
114 if (orderItemId != _orderItemId) {
115 _orderItemId = orderItemId;
116 }
117 }
118
119 public long getOrderId() {
120 return _orderId;
121 }
122
123 public void setOrderId(long orderId) {
124 if (orderId != _orderId) {
125 _orderId = orderId;
126 }
127 }
128
129 public String getItemId() {
130 return GetterUtil.getString(_itemId);
131 }
132
133 public void setItemId(String itemId) {
134 if (((itemId == null) && (_itemId != null)) ||
135 ((itemId != null) && (_itemId == null)) ||
136 ((itemId != null) && (_itemId != null) &&
137 !itemId.equals(_itemId))) {
138 if (!XSS_ALLOW_ITEMID) {
139 itemId = XSSUtil.strip(itemId);
140 }
141
142 _itemId = itemId;
143 }
144 }
145
146 public String getSku() {
147 return GetterUtil.getString(_sku);
148 }
149
150 public void setSku(String sku) {
151 if (((sku == null) && (_sku != null)) ||
152 ((sku != null) && (_sku == null)) ||
153 ((sku != null) && (_sku != null) && !sku.equals(_sku))) {
154 if (!XSS_ALLOW_SKU) {
155 sku = XSSUtil.strip(sku);
156 }
157
158 _sku = sku;
159 }
160 }
161
162 public String getName() {
163 return GetterUtil.getString(_name);
164 }
165
166 public void setName(String name) {
167 if (((name == null) && (_name != null)) ||
168 ((name != null) && (_name == null)) ||
169 ((name != null) && (_name != null) && !name.equals(_name))) {
170 if (!XSS_ALLOW_NAME) {
171 name = XSSUtil.strip(name);
172 }
173
174 _name = name;
175 }
176 }
177
178 public String getDescription() {
179 return GetterUtil.getString(_description);
180 }
181
182 public void setDescription(String description) {
183 if (((description == null) && (_description != null)) ||
184 ((description != null) && (_description == null)) ||
185 ((description != null) && (_description != null) &&
186 !description.equals(_description))) {
187 if (!XSS_ALLOW_DESCRIPTION) {
188 description = XSSUtil.strip(description);
189 }
190
191 _description = description;
192 }
193 }
194
195 public String getProperties() {
196 return GetterUtil.getString(_properties);
197 }
198
199 public void setProperties(String properties) {
200 if (((properties == null) && (_properties != null)) ||
201 ((properties != null) && (_properties == null)) ||
202 ((properties != null) && (_properties != null) &&
203 !properties.equals(_properties))) {
204 if (!XSS_ALLOW_PROPERTIES) {
205 properties = XSSUtil.strip(properties);
206 }
207
208 _properties = properties;
209 }
210 }
211
212 public double getPrice() {
213 return _price;
214 }
215
216 public void setPrice(double price) {
217 if (price != _price) {
218 _price = price;
219 }
220 }
221
222 public int getQuantity() {
223 return _quantity;
224 }
225
226 public void setQuantity(int quantity) {
227 if (quantity != _quantity) {
228 _quantity = quantity;
229 }
230 }
231
232 public Date getShippedDate() {
233 return _shippedDate;
234 }
235
236 public void setShippedDate(Date shippedDate) {
237 if (((shippedDate == null) && (_shippedDate != null)) ||
238 ((shippedDate != null) && (_shippedDate == null)) ||
239 ((shippedDate != null) && (_shippedDate != null) &&
240 !shippedDate.equals(_shippedDate))) {
241 _shippedDate = shippedDate;
242 }
243 }
244
245 public Object clone() {
246 ShoppingOrderItemImpl clone = new ShoppingOrderItemImpl();
247 clone.setOrderItemId(getOrderItemId());
248 clone.setOrderId(getOrderId());
249 clone.setItemId(getItemId());
250 clone.setSku(getSku());
251 clone.setName(getName());
252 clone.setDescription(getDescription());
253 clone.setProperties(getProperties());
254 clone.setPrice(getPrice());
255 clone.setQuantity(getQuantity());
256 clone.setShippedDate(getShippedDate());
257
258 return clone;
259 }
260
261 public int compareTo(Object obj) {
262 if (obj == null) {
263 return -1;
264 }
265
266 ShoppingOrderItemImpl shoppingOrderItem = (ShoppingOrderItemImpl)obj;
267 int value = 0;
268 value = getName().compareTo(shoppingOrderItem.getName());
269
270 if (value != 0) {
271 return value;
272 }
273
274 value = getDescription().compareTo(shoppingOrderItem.getDescription());
275
276 if (value != 0) {
277 return value;
278 }
279
280 return 0;
281 }
282
283 public boolean equals(Object obj) {
284 if (obj == null) {
285 return false;
286 }
287
288 ShoppingOrderItemImpl shoppingOrderItem = null;
289
290 try {
291 shoppingOrderItem = (ShoppingOrderItemImpl)obj;
292 }
293 catch (ClassCastException cce) {
294 return false;
295 }
296
297 long pk = shoppingOrderItem.getPrimaryKey();
298
299 if (getPrimaryKey() == pk) {
300 return true;
301 }
302 else {
303 return false;
304 }
305 }
306
307 public int hashCode() {
308 return (int)getPrimaryKey();
309 }
310
311 private long _orderItemId;
312 private long _orderId;
313 private String _itemId;
314 private String _sku;
315 private String _name;
316 private String _description;
317 private String _properties;
318 private double _price;
319 private int _quantity;
320 private Date _shippedDate;
321 }