1
22
23 package com.liferay.portlet.shopping.model.impl;
24
25 import com.liferay.portal.kernel.util.GetterUtil;
26 import com.liferay.portal.model.impl.BaseModelImpl;
27 import com.liferay.portal.util.PropsUtil;
28
29 import com.liferay.util.XSSUtil;
30
31 import java.io.Serializable;
32
33 import java.sql.Types;
34
35
55 public class ShoppingItemFieldModelImpl extends BaseModelImpl {
56 public static String TABLE_NAME = "ShoppingItemField";
57 public static Object[][] TABLE_COLUMNS = {
58 { "itemFieldId", new Integer(Types.BIGINT) },
59 { "itemId", new Integer(Types.BIGINT) },
60 { "name", new Integer(Types.VARCHAR) },
61 { "values_", new Integer(Types.VARCHAR) },
62 { "description", new Integer(Types.VARCHAR) }
63 };
64 public static 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)";
65 public static String TABLE_SQL_DROP = "drop table ShoppingItemField";
66 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
67 "xss.allow.com.liferay.portlet.shopping.model.ShoppingItemField"),
68 XSS_ALLOW);
69 public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
70 "xss.allow.com.liferay.portlet.shopping.model.ShoppingItemField.name"),
71 XSS_ALLOW_BY_MODEL);
72 public static boolean XSS_ALLOW_VALUES = GetterUtil.getBoolean(PropsUtil.get(
73 "xss.allow.com.liferay.portlet.shopping.model.ShoppingItemField.values"),
74 XSS_ALLOW_BY_MODEL);
75 public static boolean XSS_ALLOW_DESCRIPTION = GetterUtil.getBoolean(PropsUtil.get(
76 "xss.allow.com.liferay.portlet.shopping.model.ShoppingItemField.description"),
77 XSS_ALLOW_BY_MODEL);
78 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
79 "lock.expiration.time.com.liferay.portlet.shopping.model.ShoppingItemFieldModel"));
80
81 public ShoppingItemFieldModelImpl() {
82 }
83
84 public long getPrimaryKey() {
85 return _itemFieldId;
86 }
87
88 public void setPrimaryKey(long pk) {
89 setItemFieldId(pk);
90 }
91
92 public Serializable getPrimaryKeyObj() {
93 return new Long(_itemFieldId);
94 }
95
96 public long getItemFieldId() {
97 return _itemFieldId;
98 }
99
100 public void setItemFieldId(long itemFieldId) {
101 if (itemFieldId != _itemFieldId) {
102 _itemFieldId = itemFieldId;
103 }
104 }
105
106 public long getItemId() {
107 return _itemId;
108 }
109
110 public void setItemId(long itemId) {
111 if (itemId != _itemId) {
112 _itemId = itemId;
113 }
114 }
115
116 public String getName() {
117 return GetterUtil.getString(_name);
118 }
119
120 public void setName(String name) {
121 if (((name == null) && (_name != null)) ||
122 ((name != null) && (_name == null)) ||
123 ((name != null) && (_name != null) && !name.equals(_name))) {
124 if (!XSS_ALLOW_NAME) {
125 name = XSSUtil.strip(name);
126 }
127
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 if (!XSS_ALLOW_VALUES) {
142 values = XSSUtil.strip(values);
143 }
144
145 _values = values;
146 }
147 }
148
149 public String getDescription() {
150 return GetterUtil.getString(_description);
151 }
152
153 public void setDescription(String description) {
154 if (((description == null) && (_description != null)) ||
155 ((description != null) && (_description == null)) ||
156 ((description != null) && (_description != null) &&
157 !description.equals(_description))) {
158 if (!XSS_ALLOW_DESCRIPTION) {
159 description = XSSUtil.strip(description);
160 }
161
162 _description = description;
163 }
164 }
165
166 public Object clone() {
167 ShoppingItemFieldImpl clone = new ShoppingItemFieldImpl();
168 clone.setItemFieldId(getItemFieldId());
169 clone.setItemId(getItemId());
170 clone.setName(getName());
171 clone.setValues(getValues());
172 clone.setDescription(getDescription());
173
174 return clone;
175 }
176
177 public int compareTo(Object obj) {
178 if (obj == null) {
179 return -1;
180 }
181
182 ShoppingItemFieldImpl shoppingItemField = (ShoppingItemFieldImpl)obj;
183 int value = 0;
184
185 if (getItemId() < shoppingItemField.getItemId()) {
186 value = -1;
187 }
188 else if (getItemId() > shoppingItemField.getItemId()) {
189 value = 1;
190 }
191 else {
192 value = 0;
193 }
194
195 if (value != 0) {
196 return value;
197 }
198
199 value = getName().toLowerCase().compareTo(shoppingItemField.getName()
200 .toLowerCase());
201
202 if (value != 0) {
203 return value;
204 }
205
206 return 0;
207 }
208
209 public boolean equals(Object obj) {
210 if (obj == null) {
211 return false;
212 }
213
214 ShoppingItemFieldImpl shoppingItemField = null;
215
216 try {
217 shoppingItemField = (ShoppingItemFieldImpl)obj;
218 }
219 catch (ClassCastException cce) {
220 return false;
221 }
222
223 long pk = shoppingItemField.getPrimaryKey();
224
225 if (getPrimaryKey() == pk) {
226 return true;
227 }
228 else {
229 return false;
230 }
231 }
232
233 public int hashCode() {
234 return (int)getPrimaryKey();
235 }
236
237 private long _itemFieldId;
238 private long _itemId;
239 private String _name;
240 private String _values;
241 private String _description;
242 }