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.wiki.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.wiki.model.WikiPageResource;
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="WikiPageResourceModelImpl.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>WikiPageResource</code> table
048: * in the database.
049: * </p>
050: *
051: * @author Brian Wing Shun Chan
052: *
053: * @see com.liferay.portlet.wiki.service.model.WikiPageResource
054: * @see com.liferay.portlet.wiki.service.model.WikiPageResourceModel
055: * @see com.liferay.portlet.wiki.service.model.impl.WikiPageResourceImpl
056: *
057: */
058: public class WikiPageResourceModelImpl extends BaseModelImpl {
059: public static final String TABLE_NAME = "WikiPageResource";
060: public static final Object[][] TABLE_COLUMNS = {
061: { "resourcePrimKey", new Integer(Types.BIGINT) },
062:
063: { "nodeId", new Integer(Types.BIGINT) },
064:
065: { "title", new Integer(Types.VARCHAR) } };
066: public static final String TABLE_SQL_CREATE = "create table WikiPageResource (resourcePrimKey LONG not null primary key,nodeId LONG,title VARCHAR(75) null)";
067: public static final String TABLE_SQL_DROP = "drop table WikiPageResource";
068: public static final boolean CACHE_ENABLED = GetterUtil
069: .getBoolean(
070: PropsUtil
071: .get("value.object.finder.cache.enabled.com.liferay.portlet.wiki.model.WikiPageResource"),
072: true);
073: public static final long LOCK_EXPIRATION_TIME = GetterUtil
074: .getLong(PropsUtil
075: .get("lock.expiration.time.com.liferay.portlet.wiki.model.WikiPageResource"));
076:
077: public WikiPageResourceModelImpl() {
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 getNodeId() {
103: return _nodeId;
104: }
105:
106: public void setNodeId(long nodeId) {
107: if (nodeId != _nodeId) {
108: _nodeId = nodeId;
109: }
110: }
111:
112: public String getTitle() {
113: return GetterUtil.getString(_title);
114: }
115:
116: public void setTitle(String title) {
117: if (((title == null) && (_title != null))
118: || ((title != null) && (_title == null))
119: || ((title != null) && (_title != null) && !title
120: .equals(_title))) {
121: _title = title;
122: }
123: }
124:
125: public WikiPageResource toEscapedModel() {
126: if (isEscapedModel()) {
127: return (WikiPageResource) this ;
128: } else {
129: WikiPageResource model = new WikiPageResourceImpl();
130:
131: model.setEscapedModel(true);
132:
133: model.setResourcePrimKey(getResourcePrimKey());
134: model.setNodeId(getNodeId());
135: model.setTitle(Html.escape(getTitle()));
136:
137: model = (WikiPageResource) Proxy.newProxyInstance(
138: WikiPageResource.class.getClassLoader(),
139: new Class[] { WikiPageResource.class },
140: new ReadOnlyBeanHandler(model));
141:
142: return model;
143: }
144: }
145:
146: public Object clone() {
147: WikiPageResourceImpl clone = new WikiPageResourceImpl();
148:
149: clone.setResourcePrimKey(getResourcePrimKey());
150: clone.setNodeId(getNodeId());
151: clone.setTitle(getTitle());
152:
153: return clone;
154: }
155:
156: public int compareTo(Object obj) {
157: if (obj == null) {
158: return -1;
159: }
160:
161: WikiPageResourceImpl wikiPageResource = (WikiPageResourceImpl) obj;
162:
163: long pk = wikiPageResource.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: WikiPageResourceImpl wikiPageResource = null;
180:
181: try {
182: wikiPageResource = (WikiPageResourceImpl) obj;
183: } catch (ClassCastException cce) {
184: return false;
185: }
186:
187: long pk = wikiPageResource.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 _nodeId;
202: private String _title;
203: }
|