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