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