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