1
19
20 package com.liferay.portlet.tags.model.impl;
21
22 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23 import com.liferay.portal.kernel.util.GetterUtil;
24 import com.liferay.portal.kernel.util.HtmlUtil;
25 import com.liferay.portal.model.impl.BaseModelImpl;
26
27 import com.liferay.portlet.tags.model.TagsEntry;
28 import com.liferay.portlet.tags.model.TagsEntrySoap;
29
30 import java.io.Serializable;
31
32 import java.lang.reflect.Proxy;
33
34 import java.sql.Types;
35
36 import java.util.ArrayList;
37 import java.util.Date;
38 import java.util.List;
39
40
60 public class TagsEntryModelImpl extends BaseModelImpl {
61 public static final String TABLE_NAME = "TagsEntry";
62 public static final Object[][] TABLE_COLUMNS = {
63 { "entryId", new Integer(Types.BIGINT) },
64
65
66 { "companyId", new Integer(Types.BIGINT) },
67
68
69 { "userId", new Integer(Types.BIGINT) },
70
71
72 { "userName", new Integer(Types.VARCHAR) },
73
74
75 { "createDate", new Integer(Types.TIMESTAMP) },
76
77
78 { "modifiedDate", new Integer(Types.TIMESTAMP) },
79
80
81 { "name", new Integer(Types.VARCHAR) }
82 };
83 public static final String TABLE_SQL_CREATE = "create table TagsEntry (entryId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,name VARCHAR(75) null)";
84 public static final String TABLE_SQL_DROP = "drop table TagsEntry";
85 public static final String DATA_SOURCE = "liferayDataSource";
86 public static final String SESSION_FACTORY = "liferaySessionFactory";
87 public static final String TX_MANAGER = "liferayTransactionManager";
88 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
89 "value.object.finder.cache.enabled.com.liferay.portlet.tags.model.TagsEntry"),
90 true);
91
92 public static TagsEntry toModel(TagsEntrySoap soapModel) {
93 TagsEntry model = new TagsEntryImpl();
94
95 model.setEntryId(soapModel.getEntryId());
96 model.setCompanyId(soapModel.getCompanyId());
97 model.setUserId(soapModel.getUserId());
98 model.setUserName(soapModel.getUserName());
99 model.setCreateDate(soapModel.getCreateDate());
100 model.setModifiedDate(soapModel.getModifiedDate());
101 model.setName(soapModel.getName());
102
103 return model;
104 }
105
106 public static List<TagsEntry> toModels(TagsEntrySoap[] soapModels) {
107 List<TagsEntry> models = new ArrayList<TagsEntry>(soapModels.length);
108
109 for (TagsEntrySoap soapModel : soapModels) {
110 models.add(toModel(soapModel));
111 }
112
113 return models;
114 }
115
116 public static final boolean CACHE_ENABLED_TAGSASSETS_TAGSENTRIES = com.liferay.portlet.tags.model.impl.TagsAssetModelImpl.CACHE_ENABLED_TAGSASSETS_TAGSENTRIES;
117 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
118 "lock.expiration.time.com.liferay.portlet.tags.model.TagsEntry"));
119
120 public TagsEntryModelImpl() {
121 }
122
123 public long getPrimaryKey() {
124 return _entryId;
125 }
126
127 public void setPrimaryKey(long pk) {
128 setEntryId(pk);
129 }
130
131 public Serializable getPrimaryKeyObj() {
132 return new Long(_entryId);
133 }
134
135 public long getEntryId() {
136 return _entryId;
137 }
138
139 public void setEntryId(long entryId) {
140 if (entryId != _entryId) {
141 _entryId = entryId;
142 }
143 }
144
145 public long getCompanyId() {
146 return _companyId;
147 }
148
149 public void setCompanyId(long companyId) {
150 if (companyId != _companyId) {
151 _companyId = companyId;
152 }
153 }
154
155 public long getUserId() {
156 return _userId;
157 }
158
159 public void setUserId(long userId) {
160 if (userId != _userId) {
161 _userId = userId;
162 }
163 }
164
165 public String getUserName() {
166 return GetterUtil.getString(_userName);
167 }
168
169 public void setUserName(String userName) {
170 if (((userName == null) && (_userName != null)) ||
171 ((userName != null) && (_userName == null)) ||
172 ((userName != null) && (_userName != null) &&
173 !userName.equals(_userName))) {
174 _userName = userName;
175 }
176 }
177
178 public Date getCreateDate() {
179 return _createDate;
180 }
181
182 public void setCreateDate(Date createDate) {
183 if (((createDate == null) && (_createDate != null)) ||
184 ((createDate != null) && (_createDate == null)) ||
185 ((createDate != null) && (_createDate != null) &&
186 !createDate.equals(_createDate))) {
187 _createDate = createDate;
188 }
189 }
190
191 public Date getModifiedDate() {
192 return _modifiedDate;
193 }
194
195 public void setModifiedDate(Date modifiedDate) {
196 if (((modifiedDate == null) && (_modifiedDate != null)) ||
197 ((modifiedDate != null) && (_modifiedDate == null)) ||
198 ((modifiedDate != null) && (_modifiedDate != null) &&
199 !modifiedDate.equals(_modifiedDate))) {
200 _modifiedDate = modifiedDate;
201 }
202 }
203
204 public String getName() {
205 return GetterUtil.getString(_name);
206 }
207
208 public void setName(String name) {
209 if (((name == null) && (_name != null)) ||
210 ((name != null) && (_name == null)) ||
211 ((name != null) && (_name != null) && !name.equals(_name))) {
212 _name = name;
213 }
214 }
215
216 public TagsEntry toEscapedModel() {
217 if (isEscapedModel()) {
218 return (TagsEntry)this;
219 }
220 else {
221 TagsEntry model = new TagsEntryImpl();
222
223 model.setNew(isNew());
224 model.setEscapedModel(true);
225
226 model.setEntryId(getEntryId());
227 model.setCompanyId(getCompanyId());
228 model.setUserId(getUserId());
229 model.setUserName(HtmlUtil.escape(getUserName()));
230 model.setCreateDate(getCreateDate());
231 model.setModifiedDate(getModifiedDate());
232 model.setName(HtmlUtil.escape(getName()));
233
234 model = (TagsEntry)Proxy.newProxyInstance(TagsEntry.class.getClassLoader(),
235 new Class[] { TagsEntry.class },
236 new ReadOnlyBeanHandler(model));
237
238 return model;
239 }
240 }
241
242 public Object clone() {
243 TagsEntryImpl clone = new TagsEntryImpl();
244
245 clone.setEntryId(getEntryId());
246 clone.setCompanyId(getCompanyId());
247 clone.setUserId(getUserId());
248 clone.setUserName(getUserName());
249 clone.setCreateDate(getCreateDate());
250 clone.setModifiedDate(getModifiedDate());
251 clone.setName(getName());
252
253 return clone;
254 }
255
256 public int compareTo(Object obj) {
257 if (obj == null) {
258 return -1;
259 }
260
261 TagsEntryImpl tagsEntry = (TagsEntryImpl)obj;
262
263 int value = 0;
264
265 value = getName().compareTo(tagsEntry.getName());
266
267 if (value != 0) {
268 return value;
269 }
270
271 return 0;
272 }
273
274 public boolean equals(Object obj) {
275 if (obj == null) {
276 return false;
277 }
278
279 TagsEntryImpl tagsEntry = null;
280
281 try {
282 tagsEntry = (TagsEntryImpl)obj;
283 }
284 catch (ClassCastException cce) {
285 return false;
286 }
287
288 long pk = tagsEntry.getPrimaryKey();
289
290 if (getPrimaryKey() == pk) {
291 return true;
292 }
293 else {
294 return false;
295 }
296 }
297
298 public int hashCode() {
299 return (int)getPrimaryKey();
300 }
301
302 private long _entryId;
303 private long _companyId;
304 private long _userId;
305 private String _userName;
306 private Date _createDate;
307 private Date _modifiedDate;
308 private String _name;
309 }