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.journal.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.journal.model.JournalArticleResource;
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: /**
039: * <a href="JournalArticleResourceModelImpl.java.html"><b><i>View Source</i></b></a>
040: *
041: * <p>
042: * ServiceBuilder generated this class. Modifications in this class will be
043: * overwritten the next time is generated.
044: * </p>
045: *
046: * <p>
047: * This class is a model that represents the <code>JournalArticleResource</code> table
048: * in the database.
049: * </p>
050: *
051: * @author Brian Wing Shun Chan
052: *
053: * @see com.liferay.portlet.journal.service.model.JournalArticleResource
054: * @see com.liferay.portlet.journal.service.model.JournalArticleResourceModel
055: * @see com.liferay.portlet.journal.service.model.impl.JournalArticleResourceImpl
056: *
057: */
058: public class JournalArticleResourceModelImpl extends BaseModelImpl {
059: public static final String TABLE_NAME = "JournalArticleResource";
060: public static final Object[][] TABLE_COLUMNS = {
061: { "resourcePrimKey", new Integer(Types.BIGINT) },
062:
063: { "groupId", new Integer(Types.BIGINT) },
064:
065: { "articleId", new Integer(Types.VARCHAR) } };
066: public static final String TABLE_SQL_CREATE = "create table JournalArticleResource (resourcePrimKey LONG not null primary key,groupId LONG,articleId VARCHAR(75) null)";
067: public static final String TABLE_SQL_DROP = "drop table JournalArticleResource";
068: public static final boolean CACHE_ENABLED = GetterUtil
069: .getBoolean(
070: PropsUtil
071: .get("value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalArticleResource"),
072: true);
073: public static final long LOCK_EXPIRATION_TIME = GetterUtil
074: .getLong(PropsUtil
075: .get("lock.expiration.time.com.liferay.portlet.journal.model.JournalArticleResource"));
076:
077: public JournalArticleResourceModelImpl() {
078: }
079:
080: public long getPrimaryKey() {
081: return _resourcePrimKey;
082: }
083:
084: public void setPrimaryKey(long pk) {
085: setResourcePrimKey(pk);
086: }
087:
088: public Serializable getPrimaryKeyObj() {
089: return new Long(_resourcePrimKey);
090: }
091:
092: public long getResourcePrimKey() {
093: return _resourcePrimKey;
094: }
095:
096: public void setResourcePrimKey(long resourcePrimKey) {
097: if (resourcePrimKey != _resourcePrimKey) {
098: _resourcePrimKey = resourcePrimKey;
099: }
100: }
101:
102: public long getGroupId() {
103: return _groupId;
104: }
105:
106: public void setGroupId(long groupId) {
107: if (groupId != _groupId) {
108: _groupId = groupId;
109: }
110: }
111:
112: public String getArticleId() {
113: return GetterUtil.getString(_articleId);
114: }
115:
116: public void setArticleId(String articleId) {
117: if (((articleId == null) && (_articleId != null))
118: || ((articleId != null) && (_articleId == null))
119: || ((articleId != null) && (_articleId != null) && !articleId
120: .equals(_articleId))) {
121: _articleId = articleId;
122: }
123: }
124:
125: public JournalArticleResource toEscapedModel() {
126: if (isEscapedModel()) {
127: return (JournalArticleResource) this ;
128: } else {
129: JournalArticleResource model = new JournalArticleResourceImpl();
130:
131: model.setEscapedModel(true);
132:
133: model.setResourcePrimKey(getResourcePrimKey());
134: model.setGroupId(getGroupId());
135: model.setArticleId(Html.escape(getArticleId()));
136:
137: model = (JournalArticleResource) Proxy.newProxyInstance(
138: JournalArticleResource.class.getClassLoader(),
139: new Class[] { JournalArticleResource.class },
140: new ReadOnlyBeanHandler(model));
141:
142: return model;
143: }
144: }
145:
146: public Object clone() {
147: JournalArticleResourceImpl clone = new JournalArticleResourceImpl();
148:
149: clone.setResourcePrimKey(getResourcePrimKey());
150: clone.setGroupId(getGroupId());
151: clone.setArticleId(getArticleId());
152:
153: return clone;
154: }
155:
156: public int compareTo(Object obj) {
157: if (obj == null) {
158: return -1;
159: }
160:
161: JournalArticleResourceImpl journalArticleResource = (JournalArticleResourceImpl) obj;
162:
163: long pk = journalArticleResource.getPrimaryKey();
164:
165: if (getPrimaryKey() < pk) {
166: return -1;
167: } else if (getPrimaryKey() > pk) {
168: return 1;
169: } else {
170: return 0;
171: }
172: }
173:
174: public boolean equals(Object obj) {
175: if (obj == null) {
176: return false;
177: }
178:
179: JournalArticleResourceImpl journalArticleResource = null;
180:
181: try {
182: journalArticleResource = (JournalArticleResourceImpl) obj;
183: } catch (ClassCastException cce) {
184: return false;
185: }
186:
187: long pk = journalArticleResource.getPrimaryKey();
188:
189: if (getPrimaryKey() == pk) {
190: return true;
191: } else {
192: return false;
193: }
194: }
195:
196: public int hashCode() {
197: return (int) getPrimaryKey();
198: }
199:
200: private long _resourcePrimKey;
201: private long _groupId;
202: private String _articleId;
203: }
|