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