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.portal.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.WebDAVProps;
022    import com.liferay.portal.model.WebDAVPropsModel;
023    import com.liferay.portal.service.ServiceContext;
024    import com.liferay.portal.util.PortalUtil;
025    
026    import com.liferay.portlet.expando.model.ExpandoBridge;
027    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
028    
029    import java.io.Serializable;
030    
031    import java.lang.reflect.Proxy;
032    
033    import java.sql.Types;
034    
035    import java.util.Date;
036    
037    /**
038     * <p>
039     * This interface is a model that represents the WebDAVProps table in the
040     * database.
041     * </p>
042     *
043     * @author    Brian Wing Shun Chan
044     * @see       WebDAVPropsImpl
045     * @see       com.liferay.portal.model.WebDAVProps
046     * @see       com.liferay.portal.model.WebDAVPropsModel
047     * @generated
048     */
049    public class WebDAVPropsModelImpl extends BaseModelImpl<WebDAVProps>
050            implements WebDAVPropsModel {
051            public static final String TABLE_NAME = "WebDAVProps";
052            public static final Object[][] TABLE_COLUMNS = {
053                            { "webDavPropsId", new Integer(Types.BIGINT) },
054                            { "companyId", new Integer(Types.BIGINT) },
055                            { "createDate", new Integer(Types.TIMESTAMP) },
056                            { "modifiedDate", new Integer(Types.TIMESTAMP) },
057                            { "classNameId", new Integer(Types.BIGINT) },
058                            { "classPK", new Integer(Types.BIGINT) },
059                            { "props", new Integer(Types.CLOB) }
060                    };
061            public static final String TABLE_SQL_CREATE = "create table WebDAVProps (webDavPropsId LONG not null primary key,companyId LONG,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,props TEXT null)";
062            public static final String TABLE_SQL_DROP = "drop table WebDAVProps";
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.portal.model.WebDAVProps"),
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.portal.model.WebDAVProps"),
071                            true);
072            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
073                                    "lock.expiration.time.com.liferay.portal.model.WebDAVProps"));
074    
075            public WebDAVPropsModelImpl() {
076            }
077    
078            public long getPrimaryKey() {
079                    return _webDavPropsId;
080            }
081    
082            public void setPrimaryKey(long pk) {
083                    setWebDavPropsId(pk);
084            }
085    
086            public Serializable getPrimaryKeyObj() {
087                    return new Long(_webDavPropsId);
088            }
089    
090            public long getWebDavPropsId() {
091                    return _webDavPropsId;
092            }
093    
094            public void setWebDavPropsId(long webDavPropsId) {
095                    _webDavPropsId = webDavPropsId;
096            }
097    
098            public long getCompanyId() {
099                    return _companyId;
100            }
101    
102            public void setCompanyId(long companyId) {
103                    _companyId = companyId;
104            }
105    
106            public Date getCreateDate() {
107                    return _createDate;
108            }
109    
110            public void setCreateDate(Date createDate) {
111                    _createDate = createDate;
112            }
113    
114            public Date getModifiedDate() {
115                    return _modifiedDate;
116            }
117    
118            public void setModifiedDate(Date modifiedDate) {
119                    _modifiedDate = modifiedDate;
120            }
121    
122            public String getClassName() {
123                    if (getClassNameId() <= 0) {
124                            return StringPool.BLANK;
125                    }
126    
127                    return PortalUtil.getClassName(getClassNameId());
128            }
129    
130            public long getClassNameId() {
131                    return _classNameId;
132            }
133    
134            public void setClassNameId(long classNameId) {
135                    _classNameId = classNameId;
136    
137                    if (!_setOriginalClassNameId) {
138                            _setOriginalClassNameId = true;
139    
140                            _originalClassNameId = classNameId;
141                    }
142            }
143    
144            public long getOriginalClassNameId() {
145                    return _originalClassNameId;
146            }
147    
148            public long getClassPK() {
149                    return _classPK;
150            }
151    
152            public void setClassPK(long classPK) {
153                    _classPK = classPK;
154    
155                    if (!_setOriginalClassPK) {
156                            _setOriginalClassPK = true;
157    
158                            _originalClassPK = classPK;
159                    }
160            }
161    
162            public long getOriginalClassPK() {
163                    return _originalClassPK;
164            }
165    
166            public String getProps() {
167                    if (_props == null) {
168                            return StringPool.BLANK;
169                    }
170                    else {
171                            return _props;
172                    }
173            }
174    
175            public void setProps(String props) {
176                    _props = props;
177            }
178    
179            public WebDAVProps toEscapedModel() {
180                    if (isEscapedModel()) {
181                            return (WebDAVProps)this;
182                    }
183                    else {
184                            return (WebDAVProps)Proxy.newProxyInstance(WebDAVProps.class.getClassLoader(),
185                                    new Class[] { WebDAVProps.class },
186                                    new AutoEscapeBeanHandler(this));
187                    }
188            }
189    
190            public ExpandoBridge getExpandoBridge() {
191                    if (_expandoBridge == null) {
192                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
193                                            WebDAVProps.class.getName(), getPrimaryKey());
194                    }
195    
196                    return _expandoBridge;
197            }
198    
199            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
200                    getExpandoBridge().setAttributes(serviceContext);
201            }
202    
203            public Object clone() {
204                    WebDAVPropsImpl clone = new WebDAVPropsImpl();
205    
206                    clone.setWebDavPropsId(getWebDavPropsId());
207                    clone.setCompanyId(getCompanyId());
208                    clone.setCreateDate(getCreateDate());
209                    clone.setModifiedDate(getModifiedDate());
210                    clone.setClassNameId(getClassNameId());
211                    clone.setClassPK(getClassPK());
212                    clone.setProps(getProps());
213    
214                    return clone;
215            }
216    
217            public int compareTo(WebDAVProps webDAVProps) {
218                    long pk = webDAVProps.getPrimaryKey();
219    
220                    if (getPrimaryKey() < pk) {
221                            return -1;
222                    }
223                    else if (getPrimaryKey() > pk) {
224                            return 1;
225                    }
226                    else {
227                            return 0;
228                    }
229            }
230    
231            public boolean equals(Object obj) {
232                    if (obj == null) {
233                            return false;
234                    }
235    
236                    WebDAVProps webDAVProps = null;
237    
238                    try {
239                            webDAVProps = (WebDAVProps)obj;
240                    }
241                    catch (ClassCastException cce) {
242                            return false;
243                    }
244    
245                    long pk = webDAVProps.getPrimaryKey();
246    
247                    if (getPrimaryKey() == pk) {
248                            return true;
249                    }
250                    else {
251                            return false;
252                    }
253            }
254    
255            public int hashCode() {
256                    return (int)getPrimaryKey();
257            }
258    
259            public String toString() {
260                    StringBundler sb = new StringBundler(15);
261    
262                    sb.append("{webDavPropsId=");
263                    sb.append(getWebDavPropsId());
264                    sb.append(", companyId=");
265                    sb.append(getCompanyId());
266                    sb.append(", createDate=");
267                    sb.append(getCreateDate());
268                    sb.append(", modifiedDate=");
269                    sb.append(getModifiedDate());
270                    sb.append(", classNameId=");
271                    sb.append(getClassNameId());
272                    sb.append(", classPK=");
273                    sb.append(getClassPK());
274                    sb.append(", props=");
275                    sb.append(getProps());
276                    sb.append("}");
277    
278                    return sb.toString();
279            }
280    
281            public String toXmlString() {
282                    StringBundler sb = new StringBundler(25);
283    
284                    sb.append("<model><model-name>");
285                    sb.append("com.liferay.portal.model.WebDAVProps");
286                    sb.append("</model-name>");
287    
288                    sb.append(
289                            "<column><column-name>webDavPropsId</column-name><column-value><![CDATA[");
290                    sb.append(getWebDavPropsId());
291                    sb.append("]]></column-value></column>");
292                    sb.append(
293                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
294                    sb.append(getCompanyId());
295                    sb.append("]]></column-value></column>");
296                    sb.append(
297                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
298                    sb.append(getCreateDate());
299                    sb.append("]]></column-value></column>");
300                    sb.append(
301                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
302                    sb.append(getModifiedDate());
303                    sb.append("]]></column-value></column>");
304                    sb.append(
305                            "<column><column-name>classNameId</column-name><column-value><![CDATA[");
306                    sb.append(getClassNameId());
307                    sb.append("]]></column-value></column>");
308                    sb.append(
309                            "<column><column-name>classPK</column-name><column-value><![CDATA[");
310                    sb.append(getClassPK());
311                    sb.append("]]></column-value></column>");
312                    sb.append(
313                            "<column><column-name>props</column-name><column-value><![CDATA[");
314                    sb.append(getProps());
315                    sb.append("]]></column-value></column>");
316    
317                    sb.append("</model>");
318    
319                    return sb.toString();
320            }
321    
322            private long _webDavPropsId;
323            private long _companyId;
324            private Date _createDate;
325            private Date _modifiedDate;
326            private long _classNameId;
327            private long _originalClassNameId;
328            private boolean _setOriginalClassNameId;
329            private long _classPK;
330            private long _originalClassPK;
331            private boolean _setOriginalClassPK;
332            private String _props;
333            private transient ExpandoBridge _expandoBridge;
334    }