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