001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.tags.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.model.impl.BaseModelImpl;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.portlet.tags.model.TagsEntry;
029:
030: import com.liferay.util.Html;
031:
032: import java.io.Serializable;
033:
034: import java.lang.reflect.Proxy;
035:
036: import java.sql.Types;
037:
038: import java.util.Date;
039:
040: /**
041: * <a href="TagsEntryModelImpl.java.html"><b><i>View Source</i></b></a>
042: *
043: * <p>
044: * ServiceBuilder generated this class. Modifications in this class will be
045: * overwritten the next time is generated.
046: * </p>
047: *
048: * <p>
049: * This class is a model that represents the <code>TagsEntry</code> table
050: * in the database.
051: * </p>
052: *
053: * @author Brian Wing Shun Chan
054: *
055: * @see com.liferay.portlet.tags.service.model.TagsEntry
056: * @see com.liferay.portlet.tags.service.model.TagsEntryModel
057: * @see com.liferay.portlet.tags.service.model.impl.TagsEntryImpl
058: *
059: */
060: public class TagsEntryModelImpl extends BaseModelImpl {
061: public static final String TABLE_NAME = "TagsEntry";
062: public static final Object[][] TABLE_COLUMNS = {
063: { "entryId", new Integer(Types.BIGINT) },
064:
065: { "companyId", new Integer(Types.BIGINT) },
066:
067: { "userId", new Integer(Types.BIGINT) },
068:
069: { "userName", new Integer(Types.VARCHAR) },
070:
071: { "createDate", new Integer(Types.TIMESTAMP) },
072:
073: { "modifiedDate", new Integer(Types.TIMESTAMP) },
074:
075: { "name", new Integer(Types.VARCHAR) } };
076: 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)";
077: public static final String TABLE_SQL_DROP = "drop table TagsEntry";
078: public static final boolean CACHE_ENABLED = GetterUtil
079: .getBoolean(
080: PropsUtil
081: .get("value.object.finder.cache.enabled.com.liferay.portlet.tags.model.TagsEntry"),
082: true);
083: public static final boolean CACHE_ENABLED_TAGSASSETS_TAGSENTRIES = com.liferay.portlet.tags.model.impl.TagsAssetModelImpl.CACHE_ENABLED_TAGSASSETS_TAGSENTRIES;
084: public static final long LOCK_EXPIRATION_TIME = GetterUtil
085: .getLong(PropsUtil
086: .get("lock.expiration.time.com.liferay.portlet.tags.model.TagsEntry"));
087:
088: public TagsEntryModelImpl() {
089: }
090:
091: public long getPrimaryKey() {
092: return _entryId;
093: }
094:
095: public void setPrimaryKey(long pk) {
096: setEntryId(pk);
097: }
098:
099: public Serializable getPrimaryKeyObj() {
100: return new Long(_entryId);
101: }
102:
103: public long getEntryId() {
104: return _entryId;
105: }
106:
107: public void setEntryId(long entryId) {
108: if (entryId != _entryId) {
109: _entryId = entryId;
110: }
111: }
112:
113: public long getCompanyId() {
114: return _companyId;
115: }
116:
117: public void setCompanyId(long companyId) {
118: if (companyId != _companyId) {
119: _companyId = companyId;
120: }
121: }
122:
123: public long getUserId() {
124: return _userId;
125: }
126:
127: public void setUserId(long userId) {
128: if (userId != _userId) {
129: _userId = userId;
130: }
131: }
132:
133: public String getUserName() {
134: return GetterUtil.getString(_userName);
135: }
136:
137: public void setUserName(String userName) {
138: if (((userName == null) && (_userName != null))
139: || ((userName != null) && (_userName == null))
140: || ((userName != null) && (_userName != null) && !userName
141: .equals(_userName))) {
142: _userName = userName;
143: }
144: }
145:
146: public Date getCreateDate() {
147: return _createDate;
148: }
149:
150: public void setCreateDate(Date createDate) {
151: if (((createDate == null) && (_createDate != null))
152: || ((createDate != null) && (_createDate == null))
153: || ((createDate != null) && (_createDate != null) && !createDate
154: .equals(_createDate))) {
155: _createDate = createDate;
156: }
157: }
158:
159: public Date getModifiedDate() {
160: return _modifiedDate;
161: }
162:
163: public void setModifiedDate(Date modifiedDate) {
164: if (((modifiedDate == null) && (_modifiedDate != null))
165: || ((modifiedDate != null) && (_modifiedDate == null))
166: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
167: .equals(_modifiedDate))) {
168: _modifiedDate = modifiedDate;
169: }
170: }
171:
172: public String getName() {
173: return GetterUtil.getString(_name);
174: }
175:
176: public void setName(String name) {
177: if (((name == null) && (_name != null))
178: || ((name != null) && (_name == null))
179: || ((name != null) && (_name != null) && !name
180: .equals(_name))) {
181: _name = name;
182: }
183: }
184:
185: public TagsEntry toEscapedModel() {
186: if (isEscapedModel()) {
187: return (TagsEntry) this ;
188: } else {
189: TagsEntry model = new TagsEntryImpl();
190:
191: model.setEscapedModel(true);
192:
193: model.setEntryId(getEntryId());
194: model.setCompanyId(getCompanyId());
195: model.setUserId(getUserId());
196: model.setUserName(Html.escape(getUserName()));
197: model.setCreateDate(getCreateDate());
198: model.setModifiedDate(getModifiedDate());
199: model.setName(Html.escape(getName()));
200:
201: model = (TagsEntry) Proxy.newProxyInstance(TagsEntry.class
202: .getClassLoader(), new Class[] { TagsEntry.class },
203: new ReadOnlyBeanHandler(model));
204:
205: return model;
206: }
207: }
208:
209: public Object clone() {
210: TagsEntryImpl clone = new TagsEntryImpl();
211:
212: clone.setEntryId(getEntryId());
213: clone.setCompanyId(getCompanyId());
214: clone.setUserId(getUserId());
215: clone.setUserName(getUserName());
216: clone.setCreateDate(getCreateDate());
217: clone.setModifiedDate(getModifiedDate());
218: clone.setName(getName());
219:
220: return clone;
221: }
222:
223: public int compareTo(Object obj) {
224: if (obj == null) {
225: return -1;
226: }
227:
228: TagsEntryImpl tagsEntry = (TagsEntryImpl) obj;
229:
230: int value = 0;
231:
232: value = getName().compareTo(tagsEntry.getName());
233:
234: if (value != 0) {
235: return value;
236: }
237:
238: return 0;
239: }
240:
241: public boolean equals(Object obj) {
242: if (obj == null) {
243: return false;
244: }
245:
246: TagsEntryImpl tagsEntry = null;
247:
248: try {
249: tagsEntry = (TagsEntryImpl) obj;
250: } catch (ClassCastException cce) {
251: return false;
252: }
253:
254: long pk = tagsEntry.getPrimaryKey();
255:
256: if (getPrimaryKey() == pk) {
257: return true;
258: } else {
259: return false;
260: }
261: }
262:
263: public int hashCode() {
264: return (int) getPrimaryKey();
265: }
266:
267: private long _entryId;
268: private long _companyId;
269: private long _userId;
270: private String _userName;
271: private Date _createDate;
272: private Date _modifiedDate;
273: private String _name;
274: }
|