001
014
015 package com.liferay.portlet.shopping.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.util.GetterUtil;
019 import com.liferay.portal.kernel.util.StringBundler;
020 import com.liferay.portal.kernel.util.StringPool;
021 import com.liferay.portal.model.impl.BaseModelImpl;
022 import com.liferay.portal.service.ServiceContext;
023
024 import com.liferay.portlet.expando.model.ExpandoBridge;
025 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
026 import com.liferay.portlet.shopping.model.ShoppingItemField;
027 import com.liferay.portlet.shopping.model.ShoppingItemFieldModel;
028
029 import java.io.Serializable;
030
031 import java.lang.reflect.Proxy;
032
033 import java.sql.Types;
034
035
052 public class ShoppingItemFieldModelImpl extends BaseModelImpl<ShoppingItemField>
053 implements ShoppingItemFieldModel {
054 public static final String TABLE_NAME = "ShoppingItemField";
055 public static final Object[][] TABLE_COLUMNS = {
056 { "itemFieldId", new Integer(Types.BIGINT) },
057 { "itemId", new Integer(Types.BIGINT) },
058 { "name", new Integer(Types.VARCHAR) },
059 { "values_", new Integer(Types.VARCHAR) },
060 { "description", new Integer(Types.VARCHAR) }
061 };
062 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)";
063 public static final String TABLE_SQL_DROP = "drop table ShoppingItemField";
064 public static final String ORDER_BY_JPQL = " ORDER BY shoppingItemField.itemId ASC, shoppingItemField.name ASC";
065 public static final String ORDER_BY_SQL = " ORDER BY ShoppingItemField.itemId ASC, ShoppingItemField.name ASC";
066 public static final String DATA_SOURCE = "liferayDataSource";
067 public static final String SESSION_FACTORY = "liferaySessionFactory";
068 public static final String TX_MANAGER = "liferayTransactionManager";
069 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
070 "value.object.entity.cache.enabled.com.liferay.portlet.shopping.model.ShoppingItemField"),
071 true);
072 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
073 "value.object.finder.cache.enabled.com.liferay.portlet.shopping.model.ShoppingItemField"),
074 true);
075 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
076 "lock.expiration.time.com.liferay.portlet.shopping.model.ShoppingItemField"));
077
078 public ShoppingItemFieldModelImpl() {
079 }
080
081 public long getPrimaryKey() {
082 return _itemFieldId;
083 }
084
085 public void setPrimaryKey(long pk) {
086 setItemFieldId(pk);
087 }
088
089 public Serializable getPrimaryKeyObj() {
090 return new Long(_itemFieldId);
091 }
092
093 public long getItemFieldId() {
094 return _itemFieldId;
095 }
096
097 public void setItemFieldId(long itemFieldId) {
098 _itemFieldId = itemFieldId;
099 }
100
101 public long getItemId() {
102 return _itemId;
103 }
104
105 public void setItemId(long itemId) {
106 _itemId = itemId;
107 }
108
109 public String getName() {
110 if (_name == null) {
111 return StringPool.BLANK;
112 }
113 else {
114 return _name;
115 }
116 }
117
118 public void setName(String name) {
119 _name = name;
120 }
121
122 public String getValues() {
123 if (_values == null) {
124 return StringPool.BLANK;
125 }
126 else {
127 return _values;
128 }
129 }
130
131 public void setValues(String values) {
132 _values = values;
133 }
134
135 public String getDescription() {
136 if (_description == null) {
137 return StringPool.BLANK;
138 }
139 else {
140 return _description;
141 }
142 }
143
144 public void setDescription(String description) {
145 _description = description;
146 }
147
148 public ShoppingItemField toEscapedModel() {
149 if (isEscapedModel()) {
150 return (ShoppingItemField)this;
151 }
152 else {
153 return (ShoppingItemField)Proxy.newProxyInstance(ShoppingItemField.class.getClassLoader(),
154 new Class[] { ShoppingItemField.class },
155 new AutoEscapeBeanHandler(this));
156 }
157 }
158
159 public ExpandoBridge getExpandoBridge() {
160 if (_expandoBridge == null) {
161 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
162 ShoppingItemField.class.getName(), getPrimaryKey());
163 }
164
165 return _expandoBridge;
166 }
167
168 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
169 getExpandoBridge().setAttributes(serviceContext);
170 }
171
172 public Object clone() {
173 ShoppingItemFieldImpl clone = new ShoppingItemFieldImpl();
174
175 clone.setItemFieldId(getItemFieldId());
176 clone.setItemId(getItemId());
177 clone.setName(getName());
178 clone.setValues(getValues());
179 clone.setDescription(getDescription());
180
181 return clone;
182 }
183
184 public int compareTo(ShoppingItemField shoppingItemField) {
185 int value = 0;
186
187 if (getItemId() < shoppingItemField.getItemId()) {
188 value = -1;
189 }
190 else if (getItemId() > shoppingItemField.getItemId()) {
191 value = 1;
192 }
193 else {
194 value = 0;
195 }
196
197 if (value != 0) {
198 return value;
199 }
200
201 value = getName().toLowerCase()
202 .compareTo(shoppingItemField.getName().toLowerCase());
203
204 if (value != 0) {
205 return value;
206 }
207
208 return 0;
209 }
210
211 public boolean equals(Object obj) {
212 if (obj == null) {
213 return false;
214 }
215
216 ShoppingItemField shoppingItemField = null;
217
218 try {
219 shoppingItemField = (ShoppingItemField)obj;
220 }
221 catch (ClassCastException cce) {
222 return false;
223 }
224
225 long pk = shoppingItemField.getPrimaryKey();
226
227 if (getPrimaryKey() == pk) {
228 return true;
229 }
230 else {
231 return false;
232 }
233 }
234
235 public int hashCode() {
236 return (int)getPrimaryKey();
237 }
238
239 public String toString() {
240 StringBundler sb = new StringBundler(11);
241
242 sb.append("{itemFieldId=");
243 sb.append(getItemFieldId());
244 sb.append(", itemId=");
245 sb.append(getItemId());
246 sb.append(", name=");
247 sb.append(getName());
248 sb.append(", values=");
249 sb.append(getValues());
250 sb.append(", description=");
251 sb.append(getDescription());
252 sb.append("}");
253
254 return sb.toString();
255 }
256
257 public String toXmlString() {
258 StringBundler sb = new StringBundler(19);
259
260 sb.append("<model><model-name>");
261 sb.append("com.liferay.portlet.shopping.model.ShoppingItemField");
262 sb.append("</model-name>");
263
264 sb.append(
265 "<column><column-name>itemFieldId</column-name><column-value><![CDATA[");
266 sb.append(getItemFieldId());
267 sb.append("]]></column-value></column>");
268 sb.append(
269 "<column><column-name>itemId</column-name><column-value><![CDATA[");
270 sb.append(getItemId());
271 sb.append("]]></column-value></column>");
272 sb.append(
273 "<column><column-name>name</column-name><column-value><![CDATA[");
274 sb.append(getName());
275 sb.append("]]></column-value></column>");
276 sb.append(
277 "<column><column-name>values</column-name><column-value><![CDATA[");
278 sb.append(getValues());
279 sb.append("]]></column-value></column>");
280 sb.append(
281 "<column><column-name>description</column-name><column-value><![CDATA[");
282 sb.append(getDescription());
283 sb.append("]]></column-value></column>");
284
285 sb.append("</model>");
286
287 return sb.toString();
288 }
289
290 private long _itemFieldId;
291 private long _itemId;
292 private String _name;
293 private String _values;
294 private String _description;
295 private transient ExpandoBridge _expandoBridge;
296 }