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     * The base model implementation for the WikiPageResource service. Represents a row in the "WikiPageResource" database table, with each column mapped to a property of this class.
037     *
038     * <p>
039     * This implementation and its corresponding interface {@link com.liferay.portlet.wiki.model.WikiPageResourceModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link WikiPageResourceImpl}.
040     * </p>
041     *
042     * <p>
043     * Never modify or reference this class directly. All methods that expect a wiki page resource model instance should use the {@link com.liferay.portlet.wiki.model.WikiPageResource} interface instead.
044     * </p>
045     *
046     * @author Brian Wing Shun Chan
047     * @see WikiPageResourceImpl
048     * @see com.liferay.portlet.wiki.model.WikiPageResource
049     * @see com.liferay.portlet.wiki.model.WikiPageResourceModel
050     * @generated
051     */
052    public class WikiPageResourceModelImpl extends BaseModelImpl<WikiPageResource>
053            implements WikiPageResourceModel {
054            public static final String TABLE_NAME = "WikiPageResource";
055            public static final Object[][] TABLE_COLUMNS = {
056                            { "uuid_", new Integer(Types.VARCHAR) },
057                            { "resourcePrimKey", new Integer(Types.BIGINT) },
058                            { "nodeId", new Integer(Types.BIGINT) },
059                            { "title", new Integer(Types.VARCHAR) }
060                    };
061            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)";
062            public static final String TABLE_SQL_DROP = "drop table WikiPageResource";
063            public static final String DATA_SOURCE = "liferayDataSource";
064            public static final String SESSION_FACTORY = "liferaySessionFactory";
065            public static final String TX_MANAGER = "liferayTransactionManager";
066            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
067                                    "value.object.entity.cache.enabled.com.liferay.portlet.wiki.model.WikiPageResource"),
068                            true);
069            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
070                                    "value.object.finder.cache.enabled.com.liferay.portlet.wiki.model.WikiPageResource"),
071                            true);
072            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
073                                    "lock.expiration.time.com.liferay.portlet.wiki.model.WikiPageResource"));
074    
075            public WikiPageResourceModelImpl() {
076            }
077    
078            public long getPrimaryKey() {
079                    return _resourcePrimKey;
080            }
081    
082            public void setPrimaryKey(long pk) {
083                    setResourcePrimKey(pk);
084            }
085    
086            public Serializable getPrimaryKeyObj() {
087                    return new Long(_resourcePrimKey);
088            }
089    
090            public String getUuid() {
091                    if (_uuid == null) {
092                            return StringPool.BLANK;
093                    }
094                    else {
095                            return _uuid;
096                    }
097            }
098    
099            public void setUuid(String uuid) {
100                    _uuid = uuid;
101            }
102    
103            public long getResourcePrimKey() {
104                    return _resourcePrimKey;
105            }
106    
107            public void setResourcePrimKey(long resourcePrimKey) {
108                    _resourcePrimKey = resourcePrimKey;
109            }
110    
111            public long getNodeId() {
112                    return _nodeId;
113            }
114    
115            public void setNodeId(long nodeId) {
116                    _nodeId = nodeId;
117    
118                    if (!_setOriginalNodeId) {
119                            _setOriginalNodeId = true;
120    
121                            _originalNodeId = nodeId;
122                    }
123            }
124    
125            public long getOriginalNodeId() {
126                    return _originalNodeId;
127            }
128    
129            public String getTitle() {
130                    if (_title == null) {
131                            return StringPool.BLANK;
132                    }
133                    else {
134                            return _title;
135                    }
136            }
137    
138            public void setTitle(String title) {
139                    _title = title;
140    
141                    if (_originalTitle == null) {
142                            _originalTitle = title;
143                    }
144            }
145    
146            public String getOriginalTitle() {
147                    return GetterUtil.getString(_originalTitle);
148            }
149    
150            public WikiPageResource toEscapedModel() {
151                    if (isEscapedModel()) {
152                            return (WikiPageResource)this;
153                    }
154                    else {
155                            return (WikiPageResource)Proxy.newProxyInstance(WikiPageResource.class.getClassLoader(),
156                                    new Class[] { WikiPageResource.class },
157                                    new AutoEscapeBeanHandler(this));
158                    }
159            }
160    
161            public ExpandoBridge getExpandoBridge() {
162                    if (_expandoBridge == null) {
163                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
164                                            WikiPageResource.class.getName(), getPrimaryKey());
165                    }
166    
167                    return _expandoBridge;
168            }
169    
170            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
171                    getExpandoBridge().setAttributes(serviceContext);
172            }
173    
174            public Object clone() {
175                    WikiPageResourceImpl clone = new WikiPageResourceImpl();
176    
177                    clone.setUuid(getUuid());
178                    clone.setResourcePrimKey(getResourcePrimKey());
179                    clone.setNodeId(getNodeId());
180                    clone.setTitle(getTitle());
181    
182                    return clone;
183            }
184    
185            public int compareTo(WikiPageResource wikiPageResource) {
186                    long pk = wikiPageResource.getPrimaryKey();
187    
188                    if (getPrimaryKey() < pk) {
189                            return -1;
190                    }
191                    else if (getPrimaryKey() > pk) {
192                            return 1;
193                    }
194                    else {
195                            return 0;
196                    }
197            }
198    
199            public boolean equals(Object obj) {
200                    if (obj == null) {
201                            return false;
202                    }
203    
204                    WikiPageResource wikiPageResource = null;
205    
206                    try {
207                            wikiPageResource = (WikiPageResource)obj;
208                    }
209                    catch (ClassCastException cce) {
210                            return false;
211                    }
212    
213                    long pk = wikiPageResource.getPrimaryKey();
214    
215                    if (getPrimaryKey() == pk) {
216                            return true;
217                    }
218                    else {
219                            return false;
220                    }
221            }
222    
223            public int hashCode() {
224                    return (int)getPrimaryKey();
225            }
226    
227            public String toString() {
228                    StringBundler sb = new StringBundler(9);
229    
230                    sb.append("{uuid=");
231                    sb.append(getUuid());
232                    sb.append(", resourcePrimKey=");
233                    sb.append(getResourcePrimKey());
234                    sb.append(", nodeId=");
235                    sb.append(getNodeId());
236                    sb.append(", title=");
237                    sb.append(getTitle());
238                    sb.append("}");
239    
240                    return sb.toString();
241            }
242    
243            public String toXmlString() {
244                    StringBundler sb = new StringBundler(16);
245    
246                    sb.append("<model><model-name>");
247                    sb.append("com.liferay.portlet.wiki.model.WikiPageResource");
248                    sb.append("</model-name>");
249    
250                    sb.append(
251                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
252                    sb.append(getUuid());
253                    sb.append("]]></column-value></column>");
254                    sb.append(
255                            "<column><column-name>resourcePrimKey</column-name><column-value><![CDATA[");
256                    sb.append(getResourcePrimKey());
257                    sb.append("]]></column-value></column>");
258                    sb.append(
259                            "<column><column-name>nodeId</column-name><column-value><![CDATA[");
260                    sb.append(getNodeId());
261                    sb.append("]]></column-value></column>");
262                    sb.append(
263                            "<column><column-name>title</column-name><column-value><![CDATA[");
264                    sb.append(getTitle());
265                    sb.append("]]></column-value></column>");
266    
267                    sb.append("</model>");
268    
269                    return sb.toString();
270            }
271    
272            private String _uuid;
273            private long _resourcePrimKey;
274            private long _nodeId;
275            private long _originalNodeId;
276            private boolean _setOriginalNodeId;
277            private String _title;
278            private String _originalTitle;
279            private transient ExpandoBridge _expandoBridge;
280    }