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 import com.liferay.portal.util.PropsUtil;
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 ServiceComponentModelImpl extends BaseModelImpl {
62 public static final String TABLE_NAME = "ServiceComponent";
63 public static final Object[][] TABLE_COLUMNS = {
64 { "serviceComponentId", new Integer(Types.BIGINT) },
65
66
67 { "buildNamespace", new Integer(Types.VARCHAR) },
68
69
70 { "buildNumber", new Integer(Types.BIGINT) },
71
72
73 { "buildDate", new Integer(Types.BIGINT) },
74
75
76 { "data_", new Integer(Types.CLOB) }
77 };
78 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)";
79 public static final String TABLE_SQL_DROP = "drop table ServiceComponent";
80 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
81 "value.object.finder.cache.enabled.com.liferay.portal.model.ServiceComponent"),
82 true);
83
84 public static ServiceComponent toModel(ServiceComponentSoap soapModel) {
85 ServiceComponent model = new ServiceComponentImpl();
86
87 model.setServiceComponentId(soapModel.getServiceComponentId());
88 model.setBuildNamespace(soapModel.getBuildNamespace());
89 model.setBuildNumber(soapModel.getBuildNumber());
90 model.setBuildDate(soapModel.getBuildDate());
91 model.setData(soapModel.getData());
92
93 return model;
94 }
95
96 public static List<ServiceComponent> toModels(
97 ServiceComponentSoap[] soapModels) {
98 List<ServiceComponent> models = new ArrayList<ServiceComponent>(soapModels.length);
99
100 for (ServiceComponentSoap soapModel : soapModels) {
101 models.add(toModel(soapModel));
102 }
103
104 return models;
105 }
106
107 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
108 "lock.expiration.time.com.liferay.portal.model.ServiceComponent"));
109
110 public ServiceComponentModelImpl() {
111 }
112
113 public long getPrimaryKey() {
114 return _serviceComponentId;
115 }
116
117 public void setPrimaryKey(long pk) {
118 setServiceComponentId(pk);
119 }
120
121 public Serializable getPrimaryKeyObj() {
122 return new Long(_serviceComponentId);
123 }
124
125 public long getServiceComponentId() {
126 return _serviceComponentId;
127 }
128
129 public void setServiceComponentId(long serviceComponentId) {
130 if (serviceComponentId != _serviceComponentId) {
131 _serviceComponentId = serviceComponentId;
132 }
133 }
134
135 public String getBuildNamespace() {
136 return GetterUtil.getString(_buildNamespace);
137 }
138
139 public void setBuildNamespace(String buildNamespace) {
140 if (((buildNamespace == null) && (_buildNamespace != null)) ||
141 ((buildNamespace != null) && (_buildNamespace == null)) ||
142 ((buildNamespace != null) && (_buildNamespace != null) &&
143 !buildNamespace.equals(_buildNamespace))) {
144 _buildNamespace = buildNamespace;
145 }
146 }
147
148 public long getBuildNumber() {
149 return _buildNumber;
150 }
151
152 public void setBuildNumber(long buildNumber) {
153 if (buildNumber != _buildNumber) {
154 _buildNumber = buildNumber;
155 }
156 }
157
158 public long getBuildDate() {
159 return _buildDate;
160 }
161
162 public void setBuildDate(long buildDate) {
163 if (buildDate != _buildDate) {
164 _buildDate = buildDate;
165 }
166 }
167
168 public String getData() {
169 return GetterUtil.getString(_data);
170 }
171
172 public void setData(String data) {
173 if (((data == null) && (_data != null)) ||
174 ((data != null) && (_data == null)) ||
175 ((data != null) && (_data != null) && !data.equals(_data))) {
176 _data = data;
177 }
178 }
179
180 public ServiceComponent toEscapedModel() {
181 if (isEscapedModel()) {
182 return (ServiceComponent)this;
183 }
184 else {
185 ServiceComponent model = new ServiceComponentImpl();
186
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 }