1
14
15 package com.liferay.portlet.asset.model.impl;
16
17 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
18 import com.liferay.portal.kernel.exception.SystemException;
19 import com.liferay.portal.kernel.util.GetterUtil;
20 import com.liferay.portal.kernel.util.HtmlUtil;
21 import com.liferay.portal.kernel.util.StringBundler;
22 import com.liferay.portal.model.impl.BaseModelImpl;
23 import com.liferay.portal.service.ServiceContext;
24 import com.liferay.portal.util.PortalUtil;
25
26 import com.liferay.portlet.asset.model.AssetCategoryProperty;
27 import com.liferay.portlet.asset.model.AssetCategoryPropertySoap;
28 import com.liferay.portlet.expando.model.ExpandoBridge;
29 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
30
31 import java.io.Serializable;
32
33 import java.lang.reflect.Proxy;
34
35 import java.sql.Types;
36
37 import java.util.ArrayList;
38 import java.util.Date;
39 import java.util.List;
40
41
60 public class AssetCategoryPropertyModelImpl extends BaseModelImpl<AssetCategoryProperty> {
61 public static final String TABLE_NAME = "AssetCategoryProperty";
62 public static final Object[][] TABLE_COLUMNS = {
63 { "categoryPropertyId", new Integer(Types.BIGINT) },
64 { "companyId", new Integer(Types.BIGINT) },
65 { "userId", new Integer(Types.BIGINT) },
66 { "userName", new Integer(Types.VARCHAR) },
67 { "createDate", new Integer(Types.TIMESTAMP) },
68 { "modifiedDate", new Integer(Types.TIMESTAMP) },
69 { "categoryId", new Integer(Types.BIGINT) },
70 { "key_", new Integer(Types.VARCHAR) },
71 { "value", new Integer(Types.VARCHAR) }
72 };
73 public static final String TABLE_SQL_CREATE = "create table AssetCategoryProperty (categoryPropertyId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,categoryId LONG,key_ VARCHAR(75) null,value VARCHAR(75) null)";
74 public static final String TABLE_SQL_DROP = "drop table AssetCategoryProperty";
75 public static final String ORDER_BY_JPQL = " ORDER BY assetCategoryProperty.key ASC";
76 public static final String ORDER_BY_SQL = " ORDER BY AssetCategoryProperty.key_ ASC";
77 public static final String DATA_SOURCE = "liferayDataSource";
78 public static final String SESSION_FACTORY = "liferaySessionFactory";
79 public static final String TX_MANAGER = "liferayTransactionManager";
80 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
81 "value.object.entity.cache.enabled.com.liferay.portlet.asset.model.AssetCategoryProperty"),
82 true);
83 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
84 "value.object.finder.cache.enabled.com.liferay.portlet.asset.model.AssetCategoryProperty"),
85 true);
86
87 public static AssetCategoryProperty toModel(
88 AssetCategoryPropertySoap soapModel) {
89 AssetCategoryProperty model = new AssetCategoryPropertyImpl();
90
91 model.setCategoryPropertyId(soapModel.getCategoryPropertyId());
92 model.setCompanyId(soapModel.getCompanyId());
93 model.setUserId(soapModel.getUserId());
94 model.setUserName(soapModel.getUserName());
95 model.setCreateDate(soapModel.getCreateDate());
96 model.setModifiedDate(soapModel.getModifiedDate());
97 model.setCategoryId(soapModel.getCategoryId());
98 model.setKey(soapModel.getKey());
99 model.setValue(soapModel.getValue());
100
101 return model;
102 }
103
104 public static List<AssetCategoryProperty> toModels(
105 AssetCategoryPropertySoap[] soapModels) {
106 List<AssetCategoryProperty> models = new ArrayList<AssetCategoryProperty>(soapModels.length);
107
108 for (AssetCategoryPropertySoap soapModel : soapModels) {
109 models.add(toModel(soapModel));
110 }
111
112 return models;
113 }
114
115 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
116 "lock.expiration.time.com.liferay.portlet.asset.model.AssetCategoryProperty"));
117
118 public AssetCategoryPropertyModelImpl() {
119 }
120
121 public long getPrimaryKey() {
122 return _categoryPropertyId;
123 }
124
125 public void setPrimaryKey(long pk) {
126 setCategoryPropertyId(pk);
127 }
128
129 public Serializable getPrimaryKeyObj() {
130 return new Long(_categoryPropertyId);
131 }
132
133 public long getCategoryPropertyId() {
134 return _categoryPropertyId;
135 }
136
137 public void setCategoryPropertyId(long categoryPropertyId) {
138 _categoryPropertyId = categoryPropertyId;
139 }
140
141 public long getCompanyId() {
142 return _companyId;
143 }
144
145 public void setCompanyId(long companyId) {
146 _companyId = companyId;
147 }
148
149 public long getUserId() {
150 return _userId;
151 }
152
153 public void setUserId(long userId) {
154 _userId = userId;
155 }
156
157 public String getUserUuid() throws SystemException {
158 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
159 }
160
161 public void setUserUuid(String userUuid) {
162 _userUuid = userUuid;
163 }
164
165 public String getUserName() {
166 return GetterUtil.getString(_userName);
167 }
168
169 public void setUserName(String userName) {
170 _userName = userName;
171 }
172
173 public Date getCreateDate() {
174 return _createDate;
175 }
176
177 public void setCreateDate(Date createDate) {
178 _createDate = createDate;
179 }
180
181 public Date getModifiedDate() {
182 return _modifiedDate;
183 }
184
185 public void setModifiedDate(Date modifiedDate) {
186 _modifiedDate = modifiedDate;
187 }
188
189 public long getCategoryId() {
190 return _categoryId;
191 }
192
193 public void setCategoryId(long categoryId) {
194 _categoryId = categoryId;
195
196 if (!_setOriginalCategoryId) {
197 _setOriginalCategoryId = true;
198
199 _originalCategoryId = categoryId;
200 }
201 }
202
203 public long getOriginalCategoryId() {
204 return _originalCategoryId;
205 }
206
207 public String getKey() {
208 return GetterUtil.getString(_key);
209 }
210
211 public void setKey(String key) {
212 _key = key;
213
214 if (_originalKey == null) {
215 _originalKey = key;
216 }
217 }
218
219 public String getOriginalKey() {
220 return GetterUtil.getString(_originalKey);
221 }
222
223 public String getValue() {
224 return GetterUtil.getString(_value);
225 }
226
227 public void setValue(String value) {
228 _value = value;
229 }
230
231 public AssetCategoryProperty toEscapedModel() {
232 if (isEscapedModel()) {
233 return (AssetCategoryProperty)this;
234 }
235 else {
236 AssetCategoryProperty model = new AssetCategoryPropertyImpl();
237
238 model.setNew(isNew());
239 model.setEscapedModel(true);
240
241 model.setCategoryPropertyId(getCategoryPropertyId());
242 model.setCompanyId(getCompanyId());
243 model.setUserId(getUserId());
244 model.setUserName(HtmlUtil.escape(getUserName()));
245 model.setCreateDate(getCreateDate());
246 model.setModifiedDate(getModifiedDate());
247 model.setCategoryId(getCategoryId());
248 model.setKey(HtmlUtil.escape(getKey()));
249 model.setValue(HtmlUtil.escape(getValue()));
250
251 model = (AssetCategoryProperty)Proxy.newProxyInstance(AssetCategoryProperty.class.getClassLoader(),
252 new Class[] { AssetCategoryProperty.class },
253 new ReadOnlyBeanHandler(model));
254
255 return model;
256 }
257 }
258
259 public ExpandoBridge getExpandoBridge() {
260 if (_expandoBridge == null) {
261 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
262 AssetCategoryProperty.class.getName(), getPrimaryKey());
263 }
264
265 return _expandoBridge;
266 }
267
268 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
269 getExpandoBridge().setAttributes(serviceContext);
270 }
271
272 public Object clone() {
273 AssetCategoryPropertyImpl clone = new AssetCategoryPropertyImpl();
274
275 clone.setCategoryPropertyId(getCategoryPropertyId());
276 clone.setCompanyId(getCompanyId());
277 clone.setUserId(getUserId());
278 clone.setUserName(getUserName());
279 clone.setCreateDate(getCreateDate());
280 clone.setModifiedDate(getModifiedDate());
281 clone.setCategoryId(getCategoryId());
282 clone.setKey(getKey());
283 clone.setValue(getValue());
284
285 return clone;
286 }
287
288 public int compareTo(AssetCategoryProperty assetCategoryProperty) {
289 int value = 0;
290
291 value = getKey().compareTo(assetCategoryProperty.getKey());
292
293 if (value != 0) {
294 return value;
295 }
296
297 return 0;
298 }
299
300 public boolean equals(Object obj) {
301 if (obj == null) {
302 return false;
303 }
304
305 AssetCategoryProperty assetCategoryProperty = null;
306
307 try {
308 assetCategoryProperty = (AssetCategoryProperty)obj;
309 }
310 catch (ClassCastException cce) {
311 return false;
312 }
313
314 long pk = assetCategoryProperty.getPrimaryKey();
315
316 if (getPrimaryKey() == pk) {
317 return true;
318 }
319 else {
320 return false;
321 }
322 }
323
324 public int hashCode() {
325 return (int)getPrimaryKey();
326 }
327
328 public String toString() {
329 StringBundler sb = new StringBundler(19);
330
331 sb.append("{categoryPropertyId=");
332 sb.append(getCategoryPropertyId());
333 sb.append(", companyId=");
334 sb.append(getCompanyId());
335 sb.append(", userId=");
336 sb.append(getUserId());
337 sb.append(", userName=");
338 sb.append(getUserName());
339 sb.append(", createDate=");
340 sb.append(getCreateDate());
341 sb.append(", modifiedDate=");
342 sb.append(getModifiedDate());
343 sb.append(", categoryId=");
344 sb.append(getCategoryId());
345 sb.append(", key=");
346 sb.append(getKey());
347 sb.append(", value=");
348 sb.append(getValue());
349 sb.append("}");
350
351 return sb.toString();
352 }
353
354 public String toXmlString() {
355 StringBundler sb = new StringBundler(31);
356
357 sb.append("<model><model-name>");
358 sb.append("com.liferay.portlet.asset.model.AssetCategoryProperty");
359 sb.append("</model-name>");
360
361 sb.append(
362 "<column><column-name>categoryPropertyId</column-name><column-value><![CDATA[");
363 sb.append(getCategoryPropertyId());
364 sb.append("]]></column-value></column>");
365 sb.append(
366 "<column><column-name>companyId</column-name><column-value><![CDATA[");
367 sb.append(getCompanyId());
368 sb.append("]]></column-value></column>");
369 sb.append(
370 "<column><column-name>userId</column-name><column-value><![CDATA[");
371 sb.append(getUserId());
372 sb.append("]]></column-value></column>");
373 sb.append(
374 "<column><column-name>userName</column-name><column-value><![CDATA[");
375 sb.append(getUserName());
376 sb.append("]]></column-value></column>");
377 sb.append(
378 "<column><column-name>createDate</column-name><column-value><![CDATA[");
379 sb.append(getCreateDate());
380 sb.append("]]></column-value></column>");
381 sb.append(
382 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
383 sb.append(getModifiedDate());
384 sb.append("]]></column-value></column>");
385 sb.append(
386 "<column><column-name>categoryId</column-name><column-value><![CDATA[");
387 sb.append(getCategoryId());
388 sb.append("]]></column-value></column>");
389 sb.append(
390 "<column><column-name>key</column-name><column-value><![CDATA[");
391 sb.append(getKey());
392 sb.append("]]></column-value></column>");
393 sb.append(
394 "<column><column-name>value</column-name><column-value><![CDATA[");
395 sb.append(getValue());
396 sb.append("]]></column-value></column>");
397
398 sb.append("</model>");
399
400 return sb.toString();
401 }
402
403 private long _categoryPropertyId;
404 private long _companyId;
405 private long _userId;
406 private String _userUuid;
407 private String _userName;
408 private Date _createDate;
409 private Date _modifiedDate;
410 private long _categoryId;
411 private long _originalCategoryId;
412 private boolean _setOriginalCategoryId;
413 private String _key;
414 private String _originalKey;
415 private String _value;
416 private transient ExpandoBridge _expandoBridge;
417 }