001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.model.ServiceComponent;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.util.Html;
029:
030: import java.io.Serializable;
031:
032: import java.lang.reflect.Proxy;
033:
034: import java.sql.Types;
035:
036: /**
037: * <a href="ServiceComponentModelImpl.java.html"><b><i>View Source</i></b></a>
038: *
039: * <p>
040: * ServiceBuilder generated this class. Modifications in this class will be
041: * overwritten the next time is generated.
042: * </p>
043: *
044: * <p>
045: * This class is a model that represents the <code>ServiceComponent</code> table
046: * in the database.
047: * </p>
048: *
049: * @author Brian Wing Shun Chan
050: *
051: * @see com.liferay.portal.service.model.ServiceComponent
052: * @see com.liferay.portal.service.model.ServiceComponentModel
053: * @see com.liferay.portal.service.model.impl.ServiceComponentImpl
054: *
055: */
056: public class ServiceComponentModelImpl extends BaseModelImpl {
057: public static final String TABLE_NAME = "ServiceComponent";
058: public static final Object[][] TABLE_COLUMNS = {
059: { "serviceComponentId", new Integer(Types.BIGINT) },
060:
061: { "buildNamespace", new Integer(Types.VARCHAR) },
062:
063: { "buildNumber", new Integer(Types.BIGINT) },
064:
065: { "buildDate", new Integer(Types.BIGINT) },
066:
067: { "data_", new Integer(Types.CLOB) } };
068: 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)";
069: public static final String TABLE_SQL_DROP = "drop table ServiceComponent";
070: public static final boolean CACHE_ENABLED = GetterUtil
071: .getBoolean(
072: PropsUtil
073: .get("value.object.finder.cache.enabled.com.liferay.portal.model.ServiceComponent"),
074: true);
075: public static final long LOCK_EXPIRATION_TIME = GetterUtil
076: .getLong(PropsUtil
077: .get("lock.expiration.time.com.liferay.portal.model.ServiceComponent"));
078:
079: public ServiceComponentModelImpl() {
080: }
081:
082: public long getPrimaryKey() {
083: return _serviceComponentId;
084: }
085:
086: public void setPrimaryKey(long pk) {
087: setServiceComponentId(pk);
088: }
089:
090: public Serializable getPrimaryKeyObj() {
091: return new Long(_serviceComponentId);
092: }
093:
094: public long getServiceComponentId() {
095: return _serviceComponentId;
096: }
097:
098: public void setServiceComponentId(long serviceComponentId) {
099: if (serviceComponentId != _serviceComponentId) {
100: _serviceComponentId = serviceComponentId;
101: }
102: }
103:
104: public String getBuildNamespace() {
105: return GetterUtil.getString(_buildNamespace);
106: }
107:
108: public void setBuildNamespace(String buildNamespace) {
109: if (((buildNamespace == null) && (_buildNamespace != null))
110: || ((buildNamespace != null) && (_buildNamespace == null))
111: || ((buildNamespace != null)
112: && (_buildNamespace != null) && !buildNamespace
113: .equals(_buildNamespace))) {
114: _buildNamespace = buildNamespace;
115: }
116: }
117:
118: public long getBuildNumber() {
119: return _buildNumber;
120: }
121:
122: public void setBuildNumber(long buildNumber) {
123: if (buildNumber != _buildNumber) {
124: _buildNumber = buildNumber;
125: }
126: }
127:
128: public long getBuildDate() {
129: return _buildDate;
130: }
131:
132: public void setBuildDate(long buildDate) {
133: if (buildDate != _buildDate) {
134: _buildDate = buildDate;
135: }
136: }
137:
138: public String getData() {
139: return GetterUtil.getString(_data);
140: }
141:
142: public void setData(String data) {
143: if (((data == null) && (_data != null))
144: || ((data != null) && (_data == null))
145: || ((data != null) && (_data != null) && !data
146: .equals(_data))) {
147: _data = data;
148: }
149: }
150:
151: public ServiceComponent toEscapedModel() {
152: if (isEscapedModel()) {
153: return (ServiceComponent) this ;
154: } else {
155: ServiceComponent model = new ServiceComponentImpl();
156:
157: model.setEscapedModel(true);
158:
159: model.setServiceComponentId(getServiceComponentId());
160: model.setBuildNamespace(Html.escape(getBuildNamespace()));
161: model.setBuildNumber(getBuildNumber());
162: model.setBuildDate(getBuildDate());
163: model.setData(Html.escape(getData()));
164:
165: model = (ServiceComponent) Proxy.newProxyInstance(
166: ServiceComponent.class.getClassLoader(),
167: new Class[] { ServiceComponent.class },
168: new ReadOnlyBeanHandler(model));
169:
170: return model;
171: }
172: }
173:
174: public Object clone() {
175: ServiceComponentImpl clone = new ServiceComponentImpl();
176:
177: clone.setServiceComponentId(getServiceComponentId());
178: clone.setBuildNamespace(getBuildNamespace());
179: clone.setBuildNumber(getBuildNumber());
180: clone.setBuildDate(getBuildDate());
181: clone.setData(getData());
182:
183: return clone;
184: }
185:
186: public int compareTo(Object obj) {
187: if (obj == null) {
188: return -1;
189: }
190:
191: ServiceComponentImpl serviceComponent = (ServiceComponentImpl) obj;
192:
193: int value = 0;
194:
195: value = getBuildNamespace().compareTo(
196: serviceComponent.getBuildNamespace());
197:
198: value = value * -1;
199:
200: if (value != 0) {
201: return value;
202: }
203:
204: if (getBuildNumber() < serviceComponent.getBuildNumber()) {
205: value = -1;
206: } else if (getBuildNumber() > serviceComponent.getBuildNumber()) {
207: value = 1;
208: } else {
209: value = 0;
210: }
211:
212: value = value * -1;
213:
214: if (value != 0) {
215: return value;
216: }
217:
218: return 0;
219: }
220:
221: public boolean equals(Object obj) {
222: if (obj == null) {
223: return false;
224: }
225:
226: ServiceComponentImpl serviceComponent = null;
227:
228: try {
229: serviceComponent = (ServiceComponentImpl) obj;
230: } catch (ClassCastException cce) {
231: return false;
232: }
233:
234: long pk = serviceComponent.getPrimaryKey();
235:
236: if (getPrimaryKey() == pk) {
237: return true;
238: } else {
239: return false;
240: }
241: }
242:
243: public int hashCode() {
244: return (int) getPrimaryKey();
245: }
246:
247: private long _serviceComponentId;
248: private String _buildNamespace;
249: private long _buildNumber;
250: private long _buildDate;
251: private String _data;
252: }
|