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