001
014
015 package com.liferay.portlet.asset.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.util.GetterUtil;
020 import com.liferay.portal.kernel.util.StringBundler;
021 import com.liferay.portal.kernel.util.StringPool;
022 import com.liferay.portal.model.impl.BaseModelImpl;
023 import com.liferay.portal.service.ServiceContext;
024 import com.liferay.portal.util.PortalUtil;
025
026 import com.liferay.portlet.asset.model.AssetCategoryProperty;
027 import com.liferay.portlet.asset.model.AssetCategoryPropertyModel;
028 import com.liferay.portlet.asset.model.AssetCategoryPropertySoap;
029 import com.liferay.portlet.expando.model.ExpandoBridge;
030 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
031
032 import java.io.Serializable;
033
034 import java.lang.reflect.Proxy;
035
036 import java.sql.Types;
037
038 import java.util.ArrayList;
039 import java.util.Date;
040 import java.util.List;
041
042
059 public class AssetCategoryPropertyModelImpl extends BaseModelImpl<AssetCategoryProperty>
060 implements AssetCategoryPropertyModel {
061 public static final String TABLE_NAME = "AssetCategoryProperty";
062 public static final Object[][] TABLE_COLUMNS = {
063 { "categoryPropertyId", new Integer(Types.BIGINT) },
064 { "companyId", new Integer(Types.BIGINT) },
065 { "userId", new Integer(Types.BIGINT) },
066 { "userName", new Integer(Types.VARCHAR) },
067 { "createDate", new Integer(Types.TIMESTAMP) },
068 { "modifiedDate", new Integer(Types.TIMESTAMP) },
069 { "categoryId", new Integer(Types.BIGINT) },
070 { "key_", new Integer(Types.VARCHAR) },
071 { "value", new Integer(Types.VARCHAR) }
072 };
073 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)";
074 public static final String TABLE_SQL_DROP = "drop table AssetCategoryProperty";
075 public static final String ORDER_BY_JPQL = " ORDER BY assetCategoryProperty.key ASC";
076 public static final String ORDER_BY_SQL = " ORDER BY AssetCategoryProperty.key_ ASC";
077 public static final String DATA_SOURCE = "liferayDataSource";
078 public static final String SESSION_FACTORY = "liferaySessionFactory";
079 public static final String TX_MANAGER = "liferayTransactionManager";
080 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
081 "value.object.entity.cache.enabled.com.liferay.portlet.asset.model.AssetCategoryProperty"),
082 true);
083 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
084 "value.object.finder.cache.enabled.com.liferay.portlet.asset.model.AssetCategoryProperty"),
085 true);
086
087
093 public static AssetCategoryProperty toModel(
094 AssetCategoryPropertySoap soapModel) {
095 AssetCategoryProperty model = new AssetCategoryPropertyImpl();
096
097 model.setCategoryPropertyId(soapModel.getCategoryPropertyId());
098 model.setCompanyId(soapModel.getCompanyId());
099 model.setUserId(soapModel.getUserId());
100 model.setUserName(soapModel.getUserName());
101 model.setCreateDate(soapModel.getCreateDate());
102 model.setModifiedDate(soapModel.getModifiedDate());
103 model.setCategoryId(soapModel.getCategoryId());
104 model.setKey(soapModel.getKey());
105 model.setValue(soapModel.getValue());
106
107 return model;
108 }
109
110
116 public static List<AssetCategoryProperty> toModels(
117 AssetCategoryPropertySoap[] soapModels) {
118 List<AssetCategoryProperty> models = new ArrayList<AssetCategoryProperty>(soapModels.length);
119
120 for (AssetCategoryPropertySoap soapModel : soapModels) {
121 models.add(toModel(soapModel));
122 }
123
124 return models;
125 }
126
127 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
128 "lock.expiration.time.com.liferay.portlet.asset.model.AssetCategoryProperty"));
129
130 public AssetCategoryPropertyModelImpl() {
131 }
132
133 public long getPrimaryKey() {
134 return _categoryPropertyId;
135 }
136
137 public void setPrimaryKey(long pk) {
138 setCategoryPropertyId(pk);
139 }
140
141 public Serializable getPrimaryKeyObj() {
142 return new Long(_categoryPropertyId);
143 }
144
145 public long getCategoryPropertyId() {
146 return _categoryPropertyId;
147 }
148
149 public void setCategoryPropertyId(long categoryPropertyId) {
150 _categoryPropertyId = categoryPropertyId;
151 }
152
153 public long getCompanyId() {
154 return _companyId;
155 }
156
157 public void setCompanyId(long companyId) {
158 _companyId = companyId;
159 }
160
161 public long getUserId() {
162 return _userId;
163 }
164
165 public void setUserId(long userId) {
166 _userId = userId;
167 }
168
169 public String getUserUuid() throws SystemException {
170 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
171 }
172
173 public void setUserUuid(String userUuid) {
174 _userUuid = userUuid;
175 }
176
177 public String getUserName() {
178 if (_userName == null) {
179 return StringPool.BLANK;
180 }
181 else {
182 return _userName;
183 }
184 }
185
186 public void setUserName(String userName) {
187 _userName = userName;
188 }
189
190 public Date getCreateDate() {
191 return _createDate;
192 }
193
194 public void setCreateDate(Date createDate) {
195 _createDate = createDate;
196 }
197
198 public Date getModifiedDate() {
199 return _modifiedDate;
200 }
201
202 public void setModifiedDate(Date modifiedDate) {
203 _modifiedDate = modifiedDate;
204 }
205
206 public long getCategoryId() {
207 return _categoryId;
208 }
209
210 public void setCategoryId(long categoryId) {
211 _categoryId = categoryId;
212
213 if (!_setOriginalCategoryId) {
214 _setOriginalCategoryId = true;
215
216 _originalCategoryId = categoryId;
217 }
218 }
219
220 public long getOriginalCategoryId() {
221 return _originalCategoryId;
222 }
223
224 public String getKey() {
225 if (_key == null) {
226 return StringPool.BLANK;
227 }
228 else {
229 return _key;
230 }
231 }
232
233 public void setKey(String key) {
234 _key = key;
235
236 if (_originalKey == null) {
237 _originalKey = key;
238 }
239 }
240
241 public String getOriginalKey() {
242 return GetterUtil.getString(_originalKey);
243 }
244
245 public String getValue() {
246 if (_value == null) {
247 return StringPool.BLANK;
248 }
249 else {
250 return _value;
251 }
252 }
253
254 public void setValue(String value) {
255 _value = value;
256 }
257
258 public AssetCategoryProperty toEscapedModel() {
259 if (isEscapedModel()) {
260 return (AssetCategoryProperty)this;
261 }
262 else {
263 return (AssetCategoryProperty)Proxy.newProxyInstance(AssetCategoryProperty.class.getClassLoader(),
264 new Class[] { AssetCategoryProperty.class },
265 new AutoEscapeBeanHandler(this));
266 }
267 }
268
269 public ExpandoBridge getExpandoBridge() {
270 if (_expandoBridge == null) {
271 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
272 AssetCategoryProperty.class.getName(), getPrimaryKey());
273 }
274
275 return _expandoBridge;
276 }
277
278 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
279 getExpandoBridge().setAttributes(serviceContext);
280 }
281
282 public Object clone() {
283 AssetCategoryPropertyImpl clone = new AssetCategoryPropertyImpl();
284
285 clone.setCategoryPropertyId(getCategoryPropertyId());
286 clone.setCompanyId(getCompanyId());
287 clone.setUserId(getUserId());
288 clone.setUserName(getUserName());
289 clone.setCreateDate(getCreateDate());
290 clone.setModifiedDate(getModifiedDate());
291 clone.setCategoryId(getCategoryId());
292 clone.setKey(getKey());
293 clone.setValue(getValue());
294
295 return clone;
296 }
297
298 public int compareTo(AssetCategoryProperty assetCategoryProperty) {
299 int value = 0;
300
301 value = getKey().compareTo(assetCategoryProperty.getKey());
302
303 if (value != 0) {
304 return value;
305 }
306
307 return 0;
308 }
309
310 public boolean equals(Object obj) {
311 if (obj == null) {
312 return false;
313 }
314
315 AssetCategoryProperty assetCategoryProperty = null;
316
317 try {
318 assetCategoryProperty = (AssetCategoryProperty)obj;
319 }
320 catch (ClassCastException cce) {
321 return false;
322 }
323
324 long pk = assetCategoryProperty.getPrimaryKey();
325
326 if (getPrimaryKey() == pk) {
327 return true;
328 }
329 else {
330 return false;
331 }
332 }
333
334 public int hashCode() {
335 return (int)getPrimaryKey();
336 }
337
338 public String toString() {
339 StringBundler sb = new StringBundler(19);
340
341 sb.append("{categoryPropertyId=");
342 sb.append(getCategoryPropertyId());
343 sb.append(", companyId=");
344 sb.append(getCompanyId());
345 sb.append(", userId=");
346 sb.append(getUserId());
347 sb.append(", userName=");
348 sb.append(getUserName());
349 sb.append(", createDate=");
350 sb.append(getCreateDate());
351 sb.append(", modifiedDate=");
352 sb.append(getModifiedDate());
353 sb.append(", categoryId=");
354 sb.append(getCategoryId());
355 sb.append(", key=");
356 sb.append(getKey());
357 sb.append(", value=");
358 sb.append(getValue());
359 sb.append("}");
360
361 return sb.toString();
362 }
363
364 public String toXmlString() {
365 StringBundler sb = new StringBundler(31);
366
367 sb.append("<model><model-name>");
368 sb.append("com.liferay.portlet.asset.model.AssetCategoryProperty");
369 sb.append("</model-name>");
370
371 sb.append(
372 "<column><column-name>categoryPropertyId</column-name><column-value><![CDATA[");
373 sb.append(getCategoryPropertyId());
374 sb.append("]]></column-value></column>");
375 sb.append(
376 "<column><column-name>companyId</column-name><column-value><![CDATA[");
377 sb.append(getCompanyId());
378 sb.append("]]></column-value></column>");
379 sb.append(
380 "<column><column-name>userId</column-name><column-value><![CDATA[");
381 sb.append(getUserId());
382 sb.append("]]></column-value></column>");
383 sb.append(
384 "<column><column-name>userName</column-name><column-value><![CDATA[");
385 sb.append(getUserName());
386 sb.append("]]></column-value></column>");
387 sb.append(
388 "<column><column-name>createDate</column-name><column-value><![CDATA[");
389 sb.append(getCreateDate());
390 sb.append("]]></column-value></column>");
391 sb.append(
392 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
393 sb.append(getModifiedDate());
394 sb.append("]]></column-value></column>");
395 sb.append(
396 "<column><column-name>categoryId</column-name><column-value><![CDATA[");
397 sb.append(getCategoryId());
398 sb.append("]]></column-value></column>");
399 sb.append(
400 "<column><column-name>key</column-name><column-value><![CDATA[");
401 sb.append(getKey());
402 sb.append("]]></column-value></column>");
403 sb.append(
404 "<column><column-name>value</column-name><column-value><![CDATA[");
405 sb.append(getValue());
406 sb.append("]]></column-value></column>");
407
408 sb.append("</model>");
409
410 return sb.toString();
411 }
412
413 private long _categoryPropertyId;
414 private long _companyId;
415 private long _userId;
416 private String _userUuid;
417 private String _userName;
418 private Date _createDate;
419 private Date _modifiedDate;
420 private long _categoryId;
421 private long _originalCategoryId;
422 private boolean _setOriginalCategoryId;
423 private String _key;
424 private String _originalKey;
425 private String _value;
426 private transient ExpandoBridge _expandoBridge;
427 }