001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.wiki.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.util.GetterUtil;
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.impl.BaseModelImpl;
022    import com.liferay.portal.service.ServiceContext;
023    
024    import com.liferay.portlet.expando.model.ExpandoBridge;
025    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
026    import com.liferay.portlet.wiki.model.WikiPageResource;
027    import com.liferay.portlet.wiki.model.WikiPageResourceModel;
028    
029    import java.io.Serializable;
030    
031    import java.lang.reflect.Proxy;
032    
033    import java.sql.Types;
034    
035    /**
036     * <p>
037     * This interface is a model that represents the WikiPageResource table in the
038     * database.
039     * </p>
040     *
041     * @author    Brian Wing Shun Chan
042     * @see       WikiPageResourceImpl
043     * @see       com.liferay.portlet.wiki.model.WikiPageResource
044     * @see       com.liferay.portlet.wiki.model.WikiPageResourceModel
045     * @generated
046     */
047    public class WikiPageResourceModelImpl extends BaseModelImpl<WikiPageResource>
048            implements WikiPageResourceModel {
049            public static final String TABLE_NAME = "WikiPageResource";
050            public static final Object[][] TABLE_COLUMNS = {
051                            { "uuid_", new Integer(Types.VARCHAR) },
052                            { "resourcePrimKey", new Integer(Types.BIGINT) },
053                            { "nodeId", new Integer(Types.BIGINT) },
054                            { "title", new Integer(Types.VARCHAR) }
055                    };
056            public static final String TABLE_SQL_CREATE = "create table WikiPageResource (uuid_ VARCHAR(75) null,resourcePrimKey LONG not null primary key,nodeId LONG,title VARCHAR(255) null)";
057            public static final String TABLE_SQL_DROP = "drop table WikiPageResource";
058            public static final String DATA_SOURCE = "liferayDataSource";
059            public static final String SESSION_FACTORY = "liferaySessionFactory";
060            public static final String TX_MANAGER = "liferayTransactionManager";
061            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
062                                    "value.object.entity.cache.enabled.com.liferay.portlet.wiki.model.WikiPageResource"),
063                            true);
064            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
065                                    "value.object.finder.cache.enabled.com.liferay.portlet.wiki.model.WikiPageResource"),
066                            true);
067            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
068                                    "lock.expiration.time.com.liferay.portlet.wiki.model.WikiPageResource"));
069    
070            public WikiPageResourceModelImpl() {
071            }
072    
073            public long getPrimaryKey() {
074                    return _resourcePrimKey;
075            }
076    
077            public void setPrimaryKey(long pk) {
078                    setResourcePrimKey(pk);
079            }
080    
081            public Serializable getPrimaryKeyObj() {
082                    return new Long(_resourcePrimKey);
083            }
084    
085            public String getUuid() {
086                    if (_uuid == null) {
087                            return StringPool.BLANK;
088                    }
089                    else {
090                            return _uuid;
091                    }
092            }
093    
094            public void setUuid(String uuid) {
095                    _uuid = uuid;
096            }
097    
098            public long getResourcePrimKey() {
099                    return _resourcePrimKey;
100            }
101    
102            public void setResourcePrimKey(long resourcePrimKey) {
103                    _resourcePrimKey = resourcePrimKey;
104            }
105    
106            public long getNodeId() {
107                    return _nodeId;
108            }
109    
110            public void setNodeId(long nodeId) {
111                    _nodeId = nodeId;
112    
113                    if (!_setOriginalNodeId) {
114                            _setOriginalNodeId = true;
115    
116                            _originalNodeId = nodeId;
117                    }
118            }
119    
120            public long getOriginalNodeId() {
121                    return _originalNodeId;
122            }
123    
124            public String getTitle() {
125                    if (_title == null) {
126                            return StringPool.BLANK;
127                    }
128                    else {
129                            return _title;
130                    }
131            }
132    
133            public void setTitle(String title) {
134                    _title = title;
135    
136                    if (_originalTitle == null) {
137                            _originalTitle = title;
138                    }
139            }
140    
141            public String getOriginalTitle() {
142                    return GetterUtil.getString(_originalTitle);
143            }
144    
145            public WikiPageResource toEscapedModel() {
146                    if (isEscapedModel()) {
147                            return (WikiPageResource)this;
148                    }
149                    else {
150                            return (WikiPageResource)Proxy.newProxyInstance(WikiPageResource.class.getClassLoader(),
151                                    new Class[] { WikiPageResource.class },
152                                    new AutoEscapeBeanHandler(this));
153                    }
154            }
155    
156            public ExpandoBridge getExpandoBridge() {
157                    if (_expandoBridge == null) {
158                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
159                                            WikiPageResource.class.getName(), getPrimaryKey());
160                    }
161    
162                    return _expandoBridge;
163            }
164    
165            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
166                    getExpandoBridge().setAttributes(serviceContext);
167            }
168    
169            public Object clone() {
170                    WikiPageResourceImpl clone = new WikiPageResourceImpl();
171    
172                    clone.setUuid(getUuid());
173                    clone.setResourcePrimKey(getResourcePrimKey());
174                    clone.setNodeId(getNodeId());
175                    clone.setTitle(getTitle());
176    
177                    return clone;
178            }
179    
180            public int compareTo(WikiPageResource wikiPageResource) {
181                    long pk = wikiPageResource.getPrimaryKey();
182    
183                    if (getPrimaryKey() < pk) {
184                            return -1;
185                    }
186                    else if (getPrimaryKey() > pk) {
187                            return 1;
188                    }
189                    else {
190                            return 0;
191                    }
192            }
193    
194            public boolean equals(Object obj) {
195                    if (obj == null) {
196                            return false;
197                    }
198    
199                    WikiPageResource wikiPageResource = null;
200    
201                    try {
202                            wikiPageResource = (WikiPageResource)obj;
203                    }
204                    catch (ClassCastException cce) {
205                            return false;
206                    }
207    
208                    long pk = wikiPageResource.getPrimaryKey();
209    
210                    if (getPrimaryKey() == pk) {
211                            return true;
212                    }
213                    else {
214                            return false;
215                    }
216            }
217    
218            public int hashCode() {
219                    return (int)getPrimaryKey();
220            }
221    
222            public String toString() {
223                    StringBundler sb = new StringBundler(9);
224    
225                    sb.append("{uuid=");
226                    sb.append(getUuid());
227                    sb.append(", resourcePrimKey=");
228                    sb.append(getResourcePrimKey());
229                    sb.append(", nodeId=");
230                    sb.append(getNodeId());
231                    sb.append(", title=");
232                    sb.append(getTitle());
233                    sb.append("}");
234    
235                    return sb.toString();
236            }
237    
238            public String toXmlString() {
239                    StringBundler sb = new StringBundler(16);
240    
241                    sb.append("<model><model-name>");
242                    sb.append("com.liferay.portlet.wiki.model.WikiPageResource");
243                    sb.append("</model-name>");
244    
245                    sb.append(
246                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
247                    sb.append(getUuid());
248                    sb.append("]]></column-value></column>");
249                    sb.append(
250                            "<column><column-name>resourcePrimKey</column-name><column-value><![CDATA[");
251                    sb.append(getResourcePrimKey());
252                    sb.append("]]></column-value></column>");
253                    sb.append(
254                            "<column><column-name>nodeId</column-name><column-value><![CDATA[");
255                    sb.append(getNodeId());
256                    sb.append("]]></column-value></column>");
257                    sb.append(
258                            "<column><column-name>title</column-name><column-value><![CDATA[");
259                    sb.append(getTitle());
260                    sb.append("]]></column-value></column>");
261    
262                    sb.append("</model>");
263    
264                    return sb.toString();
265            }
266    
267            private String _uuid;
268            private long _resourcePrimKey;
269            private long _nodeId;
270            private long _originalNodeId;
271            private boolean _setOriginalNodeId;
272            private String _title;
273            private String _originalTitle;
274            private transient ExpandoBridge _expandoBridge;
275    }