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.ShoppingItemField;
31 import com.liferay.portlet.shopping.model.ShoppingItemFieldSoap;
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.List;
41
42
62 public class ShoppingItemFieldModelImpl extends BaseModelImpl {
63 public static final String TABLE_NAME = "ShoppingItemField";
64 public static final Object[][] TABLE_COLUMNS = {
65 { "itemFieldId", new Integer(Types.BIGINT) },
66
67
68 { "itemId", new Integer(Types.BIGINT) },
69
70
71 { "name", new Integer(Types.VARCHAR) },
72
73
74 { "values_", new Integer(Types.VARCHAR) },
75
76
77 { "description", new Integer(Types.VARCHAR) }
78 };
79 public static final String TABLE_SQL_CREATE = "create table ShoppingItemField (itemFieldId LONG not null primary key,itemId LONG,name VARCHAR(75) null,values_ STRING null,description STRING null)";
80 public static final String TABLE_SQL_DROP = "drop table ShoppingItemField";
81 public static final String DATA_SOURCE = "liferayDataSource";
82 public static final String SESSION_FACTORY = "liferaySessionFactory";
83 public static final String TX_MANAGER = "liferayTransactionManager";
84 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
85 "value.object.finder.cache.enabled.com.liferay.portlet.shopping.model.ShoppingItemField"),
86 true);
87
88 public static ShoppingItemField toModel(ShoppingItemFieldSoap soapModel) {
89 ShoppingItemField model = new ShoppingItemFieldImpl();
90
91 model.setItemFieldId(soapModel.getItemFieldId());
92 model.setItemId(soapModel.getItemId());
93 model.setName(soapModel.getName());
94 model.setValues(soapModel.getValues());
95 model.setDescription(soapModel.getDescription());
96
97 return model;
98 }
99
100 public static List<ShoppingItemField> toModels(
101 ShoppingItemFieldSoap[] soapModels) {
102 List<ShoppingItemField> models = new ArrayList<ShoppingItemField>(soapModels.length);
103
104 for (ShoppingItemFieldSoap soapModel : soapModels) {
105 models.add(toModel(soapModel));
106 }
107
108 return models;
109 }
110
111 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
112 "lock.expiration.time.com.liferay.portlet.shopping.model.ShoppingItemField"));
113
114 public ShoppingItemFieldModelImpl() {
115 }
116
117 public long getPrimaryKey() {
118 return _itemFieldId;
119 }
120
121 public void setPrimaryKey(long pk) {
122 setItemFieldId(pk);
123 }
124
125 public Serializable getPrimaryKeyObj() {
126 return new Long(_itemFieldId);
127 }
128
129 public long getItemFieldId() {
130 return _itemFieldId;
131 }
132
133 public void setItemFieldId(long itemFieldId) {
134 if (itemFieldId != _itemFieldId) {
135 _itemFieldId = itemFieldId;
136 }
137 }
138
139 public long getItemId() {
140 return _itemId;
141 }
142
143 public void setItemId(long itemId) {
144 if (itemId != _itemId) {
145 _itemId = itemId;
146 }
147 }
148
149 public String getName() {
150 return GetterUtil.getString(_name);
151 }
152
153 public void setName(String name) {
154 if (((name == null) && (_name != null)) ||
155 ((name != null) && (_name == null)) ||
156 ((name != null) && (_name != null) && !name.equals(_name))) {
157 _name = name;
158 }
159 }
160
161 public String getValues() {
162 return GetterUtil.getString(_values);
163 }
164
165 public void setValues(String values) {
166 if (((values == null) && (_values != null)) ||
167 ((values != null) && (_values == null)) ||
168 ((values != null) && (_values != null) &&
169 !values.equals(_values))) {
170 _values = values;
171 }
172 }
173
174 public String getDescription() {
175 return GetterUtil.getString(_description);
176 }
177
178 public void setDescription(String description) {
179 if (((description == null) && (_description != null)) ||
180 ((description != null) && (_description == null)) ||
181 ((description != null) && (_description != null) &&
182 !description.equals(_description))) {
183 _description = description;
184 }
185 }
186
187 public ShoppingItemField toEscapedModel() {
188 if (isEscapedModel()) {
189 return (ShoppingItemField)this;
190 }
191 else {
192 ShoppingItemField model = new ShoppingItemFieldImpl();
193
194 model.setNew(isNew());
195 model.setEscapedModel(true);
196
197 model.setItemFieldId(getItemFieldId());
198 model.setItemId(getItemId());
199 model.setName(HtmlUtil.escape(getName()));
200 model.setValues(HtmlUtil.escape(getValues()));
201 model.setDescription(HtmlUtil.escape(getDescription()));
202
203 model = (ShoppingItemField)Proxy.newProxyInstance(ShoppingItemField.class.getClassLoader(),
204 new Class[] { ShoppingItemField.class },
205 new ReadOnlyBeanHandler(model));
206
207 return model;
208 }
209 }
210
211 public Object clone() {
212 ShoppingItemFieldImpl clone = new ShoppingItemFieldImpl();
213
214 clone.setItemFieldId(getItemFieldId());
215 clone.setItemId(getItemId());
216 clone.setName(getName());
217 clone.setValues(getValues());
218 clone.setDescription(getDescription());
219
220 return clone;
221 }
222
223 public int compareTo(Object obj) {
224 if (obj == null) {
225 return -1;
226 }
227
228 ShoppingItemFieldImpl shoppingItemField = (ShoppingItemFieldImpl)obj;
229
230 int value = 0;
231
232 if (getItemId() < shoppingItemField.getItemId()) {
233 value = -1;
234 }
235 else if (getItemId() > shoppingItemField.getItemId()) {
236 value = 1;
237 }
238 else {
239 value = 0;
240 }
241
242 if (value != 0) {
243 return value;
244 }
245
246 value = getName().toLowerCase()
247 .compareTo(shoppingItemField.getName().toLowerCase());
248
249 if (value != 0) {
250 return value;
251 }
252
253 return 0;
254 }
255
256 public boolean equals(Object obj) {
257 if (obj == null) {
258 return false;
259 }
260
261 ShoppingItemFieldImpl shoppingItemField = null;
262
263 try {
264 shoppingItemField = (ShoppingItemFieldImpl)obj;
265 }
266 catch (ClassCastException cce) {
267 return false;
268 }
269
270 long pk = shoppingItemField.getPrimaryKey();
271
272 if (getPrimaryKey() == pk) {
273 return true;
274 }
275 else {
276 return false;
277 }
278 }
279
280 public int hashCode() {
281 return (int)getPrimaryKey();
282 }
283
284 private long _itemFieldId;
285 private long _itemId;
286 private String _name;
287 private String _values;
288 private String _description;
289 }