1
22
23 package com.liferay.portlet.expando.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.model.impl.BaseModelImpl;
28
29 import com.liferay.portlet.expando.model.ExpandoRow;
30 import com.liferay.portlet.expando.model.ExpandoRowSoap;
31
32 import java.io.Serializable;
33
34 import java.lang.reflect.Proxy;
35
36 import java.sql.Types;
37
38 import java.util.ArrayList;
39 import java.util.List;
40
41
61 public class ExpandoRowModelImpl extends BaseModelImpl {
62 public static final String TABLE_NAME = "ExpandoRow";
63 public static final Object[][] TABLE_COLUMNS = {
64 { "rowId_", new Integer(Types.BIGINT) },
65
66
67 { "companyId", new Integer(Types.BIGINT) },
68
69
70 { "tableId", new Integer(Types.BIGINT) },
71
72
73 { "classPK", new Integer(Types.BIGINT) }
74 };
75 public static final String TABLE_SQL_CREATE = "create table ExpandoRow (rowId_ LONG not null primary key,companyId LONG,tableId LONG,classPK LONG)";
76 public static final String TABLE_SQL_DROP = "drop table ExpandoRow";
77 public static final String DATA_SOURCE = "liferayDataSource";
78 public static final String SESSION_FACTORY = "liferaySessionFactory";
79 public static final String TX_MANAGER = "liferayTransactionManager";
80 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
81 "value.object.finder.cache.enabled.com.liferay.portlet.expando.model.ExpandoRow"),
82 true);
83
84 public static ExpandoRow toModel(ExpandoRowSoap soapModel) {
85 ExpandoRow model = new ExpandoRowImpl();
86
87 model.setRowId(soapModel.getRowId());
88 model.setCompanyId(soapModel.getCompanyId());
89 model.setTableId(soapModel.getTableId());
90 model.setClassPK(soapModel.getClassPK());
91
92 return model;
93 }
94
95 public static List<ExpandoRow> toModels(ExpandoRowSoap[] soapModels) {
96 List<ExpandoRow> models = new ArrayList<ExpandoRow>(soapModels.length);
97
98 for (ExpandoRowSoap soapModel : soapModels) {
99 models.add(toModel(soapModel));
100 }
101
102 return models;
103 }
104
105 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
106 "lock.expiration.time.com.liferay.portlet.expando.model.ExpandoRow"));
107
108 public ExpandoRowModelImpl() {
109 }
110
111 public long getPrimaryKey() {
112 return _rowId;
113 }
114
115 public void setPrimaryKey(long pk) {
116 setRowId(pk);
117 }
118
119 public Serializable getPrimaryKeyObj() {
120 return new Long(_rowId);
121 }
122
123 public long getRowId() {
124 return _rowId;
125 }
126
127 public void setRowId(long rowId) {
128 if (rowId != _rowId) {
129 _rowId = rowId;
130 }
131 }
132
133 public long getCompanyId() {
134 return _companyId;
135 }
136
137 public void setCompanyId(long companyId) {
138 if (companyId != _companyId) {
139 _companyId = companyId;
140 }
141 }
142
143 public long getTableId() {
144 return _tableId;
145 }
146
147 public void setTableId(long tableId) {
148 if (tableId != _tableId) {
149 _tableId = tableId;
150 }
151 }
152
153 public long getClassPK() {
154 return _classPK;
155 }
156
157 public void setClassPK(long classPK) {
158 if (classPK != _classPK) {
159 _classPK = classPK;
160 }
161 }
162
163 public ExpandoRow toEscapedModel() {
164 if (isEscapedModel()) {
165 return (ExpandoRow)this;
166 }
167 else {
168 ExpandoRow model = new ExpandoRowImpl();
169
170 model.setNew(isNew());
171 model.setEscapedModel(true);
172
173 model.setRowId(getRowId());
174 model.setCompanyId(getCompanyId());
175 model.setTableId(getTableId());
176 model.setClassPK(getClassPK());
177
178 model = (ExpandoRow)Proxy.newProxyInstance(ExpandoRow.class.getClassLoader(),
179 new Class[] { ExpandoRow.class },
180 new ReadOnlyBeanHandler(model));
181
182 return model;
183 }
184 }
185
186 public Object clone() {
187 ExpandoRowImpl clone = new ExpandoRowImpl();
188
189 clone.setRowId(getRowId());
190 clone.setCompanyId(getCompanyId());
191 clone.setTableId(getTableId());
192 clone.setClassPK(getClassPK());
193
194 return clone;
195 }
196
197 public int compareTo(Object obj) {
198 if (obj == null) {
199 return -1;
200 }
201
202 ExpandoRowImpl expandoRow = (ExpandoRowImpl)obj;
203
204 long pk = expandoRow.getPrimaryKey();
205
206 if (getPrimaryKey() < pk) {
207 return -1;
208 }
209 else if (getPrimaryKey() > pk) {
210 return 1;
211 }
212 else {
213 return 0;
214 }
215 }
216
217 public boolean equals(Object obj) {
218 if (obj == null) {
219 return false;
220 }
221
222 ExpandoRowImpl expandoRow = null;
223
224 try {
225 expandoRow = (ExpandoRowImpl)obj;
226 }
227 catch (ClassCastException cce) {
228 return false;
229 }
230
231 long pk = expandoRow.getPrimaryKey();
232
233 if (getPrimaryKey() == pk) {
234 return true;
235 }
236 else {
237 return false;
238 }
239 }
240
241 public int hashCode() {
242 return (int)getPrimaryKey();
243 }
244
245 private long _rowId;
246 private long _companyId;
247 private long _tableId;
248 private long _classPK;
249 }