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