001    /**
002     * Copyright (c) 2000-2011 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                    if (!_setOriginalNodeId) {
117                            _setOriginalNodeId = true;
118    
119                            _originalNodeId = _nodeId;
120                    }
121    
122                    _nodeId = nodeId;
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                    if (_originalTitle == null) {
140                            _originalTitle = _title;
141                    }
142    
143                    _title = title;
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 wikiPageResourceImpl = new WikiPageResourceImpl();
176    
177                    wikiPageResourceImpl.setUuid(getUuid());
178    
179                    wikiPageResourceImpl.setResourcePrimKey(getResourcePrimKey());
180    
181                    wikiPageResourceImpl.setNodeId(getNodeId());
182    
183                    WikiPageResourceModelImpl wikiPageResourceModelImpl = wikiPageResourceImpl;
184    
185                    wikiPageResourceModelImpl._originalNodeId = wikiPageResourceModelImpl._nodeId;
186    
187                    wikiPageResourceModelImpl._setOriginalNodeId = false;
188                    wikiPageResourceImpl.setTitle(getTitle());
189    
190                    wikiPageResourceModelImpl._originalTitle = wikiPageResourceModelImpl._title;
191    
192                    return wikiPageResourceImpl;
193            }
194    
195            public int compareTo(WikiPageResource wikiPageResource) {
196                    long pk = wikiPageResource.getPrimaryKey();
197    
198                    if (getPrimaryKey() < pk) {
199                            return -1;
200                    }
201                    else if (getPrimaryKey() > pk) {
202                            return 1;
203                    }
204                    else {
205                            return 0;
206                    }
207            }
208    
209            public boolean equals(Object obj) {
210                    if (obj == null) {
211                            return false;
212                    }
213    
214                    WikiPageResource wikiPageResource = null;
215    
216                    try {
217                            wikiPageResource = (WikiPageResource)obj;
218                    }
219                    catch (ClassCastException cce) {
220                            return false;
221                    }
222    
223                    long pk = wikiPageResource.getPrimaryKey();
224    
225                    if (getPrimaryKey() == pk) {
226                            return true;
227                    }
228                    else {
229                            return false;
230                    }
231            }
232    
233            public int hashCode() {
234                    return (int)getPrimaryKey();
235            }
236    
237            public String toString() {
238                    StringBundler sb = new StringBundler(9);
239    
240                    sb.append("{uuid=");
241                    sb.append(getUuid());
242                    sb.append(", resourcePrimKey=");
243                    sb.append(getResourcePrimKey());
244                    sb.append(", nodeId=");
245                    sb.append(getNodeId());
246                    sb.append(", title=");
247                    sb.append(getTitle());
248                    sb.append("}");
249    
250                    return sb.toString();
251            }
252    
253            public String toXmlString() {
254                    StringBundler sb = new StringBundler(16);
255    
256                    sb.append("<model><model-name>");
257                    sb.append("com.liferay.portlet.wiki.model.WikiPageResource");
258                    sb.append("</model-name>");
259    
260                    sb.append(
261                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
262                    sb.append(getUuid());
263                    sb.append("]]></column-value></column>");
264                    sb.append(
265                            "<column><column-name>resourcePrimKey</column-name><column-value><![CDATA[");
266                    sb.append(getResourcePrimKey());
267                    sb.append("]]></column-value></column>");
268                    sb.append(
269                            "<column><column-name>nodeId</column-name><column-value><![CDATA[");
270                    sb.append(getNodeId());
271                    sb.append("]]></column-value></column>");
272                    sb.append(
273                            "<column><column-name>title</column-name><column-value><![CDATA[");
274                    sb.append(getTitle());
275                    sb.append("]]></column-value></column>");
276    
277                    sb.append("</model>");
278    
279                    return sb.toString();
280            }
281    
282            private String _uuid;
283            private long _resourcePrimKey;
284            private long _nodeId;
285            private long _originalNodeId;
286            private boolean _setOriginalNodeId;
287            private String _title;
288            private String _originalTitle;
289            private transient ExpandoBridge _expandoBridge;
290    }