1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.kernel.util.HtmlUtil;
28 import com.liferay.portal.model.ServiceComponent;
29 import com.liferay.portal.model.ServiceComponentSoap;
30
31 import com.liferay.portlet.expando.model.ExpandoBridge;
32 import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.ArrayList;
41 import java.util.List;
42
43
63 public class ServiceComponentModelImpl extends BaseModelImpl {
64 public static final String TABLE_NAME = "ServiceComponent";
65 public static final Object[][] TABLE_COLUMNS = {
66 { "serviceComponentId", new Integer(Types.BIGINT) },
67
68
69 { "buildNamespace", new Integer(Types.VARCHAR) },
70
71
72 { "buildNumber", new Integer(Types.BIGINT) },
73
74
75 { "buildDate", new Integer(Types.BIGINT) },
76
77
78 { "data_", new Integer(Types.CLOB) }
79 };
80 public static final String TABLE_SQL_CREATE = "create table ServiceComponent (serviceComponentId LONG not null primary key,buildNamespace VARCHAR(75) null,buildNumber LONG,buildDate LONG,data_ TEXT null)";
81 public static final String TABLE_SQL_DROP = "drop table ServiceComponent";
82 public static final String DATA_SOURCE = "liferayDataSource";
83 public static final String SESSION_FACTORY = "liferaySessionFactory";
84 public static final String TX_MANAGER = "liferayTransactionManager";
85 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
86 "value.object.finder.cache.enabled.com.liferay.portal.model.ServiceComponent"),
87 true);
88
89 public static ServiceComponent toModel(ServiceComponentSoap soapModel) {
90 ServiceComponent model = new ServiceComponentImpl();
91
92 model.setServiceComponentId(soapModel.getServiceComponentId());
93 model.setBuildNamespace(soapModel.getBuildNamespace());
94 model.setBuildNumber(soapModel.getBuildNumber());
95 model.setBuildDate(soapModel.getBuildDate());
96 model.setData(soapModel.getData());
97
98 return model;
99 }
100
101 public static List<ServiceComponent> toModels(
102 ServiceComponentSoap[] soapModels) {
103 List<ServiceComponent> models = new ArrayList<ServiceComponent>(soapModels.length);
104
105 for (ServiceComponentSoap soapModel : soapModels) {
106 models.add(toModel(soapModel));
107 }
108
109 return models;
110 }
111
112 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
113 "lock.expiration.time.com.liferay.portal.model.ServiceComponent"));
114
115 public ServiceComponentModelImpl() {
116 }
117
118 public long getPrimaryKey() {
119 return _serviceComponentId;
120 }
121
122 public void setPrimaryKey(long pk) {
123 setServiceComponentId(pk);
124 }
125
126 public Serializable getPrimaryKeyObj() {
127 return new Long(_serviceComponentId);
128 }
129
130 public long getServiceComponentId() {
131 return _serviceComponentId;
132 }
133
134 public void setServiceComponentId(long serviceComponentId) {
135 if (serviceComponentId != _serviceComponentId) {
136 _serviceComponentId = serviceComponentId;
137 }
138 }
139
140 public String getBuildNamespace() {
141 return GetterUtil.getString(_buildNamespace);
142 }
143
144 public void setBuildNamespace(String buildNamespace) {
145 if (((buildNamespace == null) && (_buildNamespace != null)) ||
146 ((buildNamespace != null) && (_buildNamespace == null)) ||
147 ((buildNamespace != null) && (_buildNamespace != null) &&
148 !buildNamespace.equals(_buildNamespace))) {
149 _buildNamespace = buildNamespace;
150 }
151 }
152
153 public long getBuildNumber() {
154 return _buildNumber;
155 }
156
157 public void setBuildNumber(long buildNumber) {
158 if (buildNumber != _buildNumber) {
159 _buildNumber = buildNumber;
160 }
161 }
162
163 public long getBuildDate() {
164 return _buildDate;
165 }
166
167 public void setBuildDate(long buildDate) {
168 if (buildDate != _buildDate) {
169 _buildDate = buildDate;
170 }
171 }
172
173 public String getData() {
174 return GetterUtil.getString(_data);
175 }
176
177 public void setData(String data) {
178 if (((data == null) && (_data != null)) ||
179 ((data != null) && (_data == null)) ||
180 ((data != null) && (_data != null) && !data.equals(_data))) {
181 _data = data;
182 }
183 }
184
185 public ServiceComponent toEscapedModel() {
186 if (isEscapedModel()) {
187 return (ServiceComponent)this;
188 }
189 else {
190 ServiceComponent model = new ServiceComponentImpl();
191
192 model.setNew(isNew());
193 model.setEscapedModel(true);
194
195 model.setServiceComponentId(getServiceComponentId());
196 model.setBuildNamespace(HtmlUtil.escape(getBuildNamespace()));
197 model.setBuildNumber(getBuildNumber());
198 model.setBuildDate(getBuildDate());
199 model.setData(HtmlUtil.escape(getData()));
200
201 model = (ServiceComponent)Proxy.newProxyInstance(ServiceComponent.class.getClassLoader(),
202 new Class[] { ServiceComponent.class },
203 new ReadOnlyBeanHandler(model));
204
205 return model;
206 }
207 }
208
209 public ExpandoBridge getExpandoBridge() {
210 if (_expandoBridge == null) {
211 _expandoBridge = new ExpandoBridgeImpl(ServiceComponent.class.getName(),
212 getPrimaryKey());
213 }
214
215 return _expandoBridge;
216 }
217
218 public Object clone() {
219 ServiceComponentImpl clone = new ServiceComponentImpl();
220
221 clone.setServiceComponentId(getServiceComponentId());
222 clone.setBuildNamespace(getBuildNamespace());
223 clone.setBuildNumber(getBuildNumber());
224 clone.setBuildDate(getBuildDate());
225 clone.setData(getData());
226
227 return clone;
228 }
229
230 public int compareTo(Object obj) {
231 if (obj == null) {
232 return -1;
233 }
234
235 ServiceComponentImpl serviceComponent = (ServiceComponentImpl)obj;
236
237 int value = 0;
238
239 value = getBuildNamespace()
240 .compareTo(serviceComponent.getBuildNamespace());
241
242 value = value * -1;
243
244 if (value != 0) {
245 return value;
246 }
247
248 if (getBuildNumber() < serviceComponent.getBuildNumber()) {
249 value = -1;
250 }
251 else if (getBuildNumber() > serviceComponent.getBuildNumber()) {
252 value = 1;
253 }
254 else {
255 value = 0;
256 }
257
258 value = value * -1;
259
260 if (value != 0) {
261 return value;
262 }
263
264 return 0;
265 }
266
267 public boolean equals(Object obj) {
268 if (obj == null) {
269 return false;
270 }
271
272 ServiceComponentImpl serviceComponent = null;
273
274 try {
275 serviceComponent = (ServiceComponentImpl)obj;
276 }
277 catch (ClassCastException cce) {
278 return false;
279 }
280
281 long pk = serviceComponent.getPrimaryKey();
282
283 if (getPrimaryKey() == pk) {
284 return true;
285 }
286 else {
287 return false;
288 }
289 }
290
291 public int hashCode() {
292 return (int)getPrimaryKey();
293 }
294
295 private long _serviceComponentId;
296 private String _buildNamespace;
297 private long _buildNumber;
298 private long _buildDate;
299 private String _data;
300 private transient ExpandoBridge _expandoBridge;
301 }