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