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