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