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.expando.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.model.impl.BaseModelImpl;
021    
022    import com.liferay.portlet.expando.model.ExpandoRow;
023    import com.liferay.portlet.expando.model.ExpandoRowModel;
024    
025    import java.io.Serializable;
026    
027    import java.lang.reflect.Proxy;
028    
029    import java.sql.Types;
030    
031    /**
032     * <p>
033     * This interface is a model that represents the ExpandoRow table in the
034     * database.
035     * </p>
036     *
037     * @author    Brian Wing Shun Chan
038     * @see       ExpandoRowImpl
039     * @see       com.liferay.portlet.expando.model.ExpandoRow
040     * @see       com.liferay.portlet.expando.model.ExpandoRowModel
041     * @generated
042     */
043    public class ExpandoRowModelImpl extends BaseModelImpl<ExpandoRow>
044            implements ExpandoRowModel {
045            public static final String TABLE_NAME = "ExpandoRow";
046            public static final Object[][] TABLE_COLUMNS = {
047                            { "rowId_", new Integer(Types.BIGINT) },
048                            { "companyId", new Integer(Types.BIGINT) },
049                            { "tableId", new Integer(Types.BIGINT) },
050                            { "classPK", new Integer(Types.BIGINT) }
051                    };
052            public static final String TABLE_SQL_CREATE = "create table ExpandoRow (rowId_ LONG not null primary key,companyId LONG,tableId LONG,classPK LONG)";
053            public static final String TABLE_SQL_DROP = "drop table ExpandoRow";
054            public static final String DATA_SOURCE = "liferayDataSource";
055            public static final String SESSION_FACTORY = "liferaySessionFactory";
056            public static final String TX_MANAGER = "liferayTransactionManager";
057            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
058                                    "value.object.entity.cache.enabled.com.liferay.portlet.expando.model.ExpandoRow"),
059                            true);
060            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
061                                    "value.object.finder.cache.enabled.com.liferay.portlet.expando.model.ExpandoRow"),
062                            true);
063            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
064                                    "lock.expiration.time.com.liferay.portlet.expando.model.ExpandoRow"));
065    
066            public ExpandoRowModelImpl() {
067            }
068    
069            public long getPrimaryKey() {
070                    return _rowId;
071            }
072    
073            public void setPrimaryKey(long pk) {
074                    setRowId(pk);
075            }
076    
077            public Serializable getPrimaryKeyObj() {
078                    return new Long(_rowId);
079            }
080    
081            public long getRowId() {
082                    return _rowId;
083            }
084    
085            public void setRowId(long rowId) {
086                    _rowId = rowId;
087            }
088    
089            public long getCompanyId() {
090                    return _companyId;
091            }
092    
093            public void setCompanyId(long companyId) {
094                    _companyId = companyId;
095            }
096    
097            public long getTableId() {
098                    return _tableId;
099            }
100    
101            public void setTableId(long tableId) {
102                    _tableId = tableId;
103    
104                    if (!_setOriginalTableId) {
105                            _setOriginalTableId = true;
106    
107                            _originalTableId = tableId;
108                    }
109            }
110    
111            public long getOriginalTableId() {
112                    return _originalTableId;
113            }
114    
115            public long getClassPK() {
116                    return _classPK;
117            }
118    
119            public void setClassPK(long classPK) {
120                    _classPK = classPK;
121    
122                    if (!_setOriginalClassPK) {
123                            _setOriginalClassPK = true;
124    
125                            _originalClassPK = classPK;
126                    }
127            }
128    
129            public long getOriginalClassPK() {
130                    return _originalClassPK;
131            }
132    
133            public ExpandoRow toEscapedModel() {
134                    if (isEscapedModel()) {
135                            return (ExpandoRow)this;
136                    }
137                    else {
138                            return (ExpandoRow)Proxy.newProxyInstance(ExpandoRow.class.getClassLoader(),
139                                    new Class[] { ExpandoRow.class },
140                                    new AutoEscapeBeanHandler(this));
141                    }
142            }
143    
144            public Object clone() {
145                    ExpandoRowImpl clone = new ExpandoRowImpl();
146    
147                    clone.setRowId(getRowId());
148                    clone.setCompanyId(getCompanyId());
149                    clone.setTableId(getTableId());
150                    clone.setClassPK(getClassPK());
151    
152                    return clone;
153            }
154    
155            public int compareTo(ExpandoRow expandoRow) {
156                    long pk = expandoRow.getPrimaryKey();
157    
158                    if (getPrimaryKey() < pk) {
159                            return -1;
160                    }
161                    else if (getPrimaryKey() > pk) {
162                            return 1;
163                    }
164                    else {
165                            return 0;
166                    }
167            }
168    
169            public boolean equals(Object obj) {
170                    if (obj == null) {
171                            return false;
172                    }
173    
174                    ExpandoRow expandoRow = null;
175    
176                    try {
177                            expandoRow = (ExpandoRow)obj;
178                    }
179                    catch (ClassCastException cce) {
180                            return false;
181                    }
182    
183                    long pk = expandoRow.getPrimaryKey();
184    
185                    if (getPrimaryKey() == pk) {
186                            return true;
187                    }
188                    else {
189                            return false;
190                    }
191            }
192    
193            public int hashCode() {
194                    return (int)getPrimaryKey();
195            }
196    
197            public String toString() {
198                    StringBundler sb = new StringBundler(9);
199    
200                    sb.append("{rowId=");
201                    sb.append(getRowId());
202                    sb.append(", companyId=");
203                    sb.append(getCompanyId());
204                    sb.append(", tableId=");
205                    sb.append(getTableId());
206                    sb.append(", classPK=");
207                    sb.append(getClassPK());
208                    sb.append("}");
209    
210                    return sb.toString();
211            }
212    
213            public String toXmlString() {
214                    StringBundler sb = new StringBundler(16);
215    
216                    sb.append("<model><model-name>");
217                    sb.append("com.liferay.portlet.expando.model.ExpandoRow");
218                    sb.append("</model-name>");
219    
220                    sb.append(
221                            "<column><column-name>rowId</column-name><column-value><![CDATA[");
222                    sb.append(getRowId());
223                    sb.append("]]></column-value></column>");
224                    sb.append(
225                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
226                    sb.append(getCompanyId());
227                    sb.append("]]></column-value></column>");
228                    sb.append(
229                            "<column><column-name>tableId</column-name><column-value><![CDATA[");
230                    sb.append(getTableId());
231                    sb.append("]]></column-value></column>");
232                    sb.append(
233                            "<column><column-name>classPK</column-name><column-value><![CDATA[");
234                    sb.append(getClassPK());
235                    sb.append("]]></column-value></column>");
236    
237                    sb.append("</model>");
238    
239                    return sb.toString();
240            }
241    
242            private long _rowId;
243            private long _companyId;
244            private long _tableId;
245            private long _originalTableId;
246            private boolean _setOriginalTableId;
247            private long _classPK;
248            private long _originalClassPK;
249            private boolean _setOriginalClassPK;
250    }