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.Subscription;
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: import java.util.Date;
037:
038: /**
039: * <a href="SubscriptionModelImpl.java.html"><b><i>View Source</i></b></a>
040: *
041: * <p>
042: * ServiceBuilder generated this class. Modifications in this class will be
043: * overwritten the next time is generated.
044: * </p>
045: *
046: * <p>
047: * This class is a model that represents the <code>Subscription</code> table
048: * in the database.
049: * </p>
050: *
051: * @author Brian Wing Shun Chan
052: *
053: * @see com.liferay.portal.service.model.Subscription
054: * @see com.liferay.portal.service.model.SubscriptionModel
055: * @see com.liferay.portal.service.model.impl.SubscriptionImpl
056: *
057: */
058: public class SubscriptionModelImpl extends BaseModelImpl {
059: public static final String TABLE_NAME = "Subscription";
060: public static final Object[][] TABLE_COLUMNS = {
061: { "subscriptionId", new Integer(Types.BIGINT) },
062:
063: { "companyId", new Integer(Types.BIGINT) },
064:
065: { "userId", new Integer(Types.BIGINT) },
066:
067: { "userName", new Integer(Types.VARCHAR) },
068:
069: { "createDate", new Integer(Types.TIMESTAMP) },
070:
071: { "modifiedDate", new Integer(Types.TIMESTAMP) },
072:
073: { "classNameId", new Integer(Types.BIGINT) },
074:
075: { "classPK", new Integer(Types.BIGINT) },
076:
077: { "frequency", new Integer(Types.VARCHAR) } };
078: public static final String TABLE_SQL_CREATE = "create table Subscription (subscriptionId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,frequency VARCHAR(75) null)";
079: public static final String TABLE_SQL_DROP = "drop table Subscription";
080: public static final boolean CACHE_ENABLED = GetterUtil
081: .getBoolean(
082: PropsUtil
083: .get("value.object.finder.cache.enabled.com.liferay.portal.model.Subscription"),
084: true);
085: public static final long LOCK_EXPIRATION_TIME = GetterUtil
086: .getLong(PropsUtil
087: .get("lock.expiration.time.com.liferay.portal.model.Subscription"));
088:
089: public SubscriptionModelImpl() {
090: }
091:
092: public long getPrimaryKey() {
093: return _subscriptionId;
094: }
095:
096: public void setPrimaryKey(long pk) {
097: setSubscriptionId(pk);
098: }
099:
100: public Serializable getPrimaryKeyObj() {
101: return new Long(_subscriptionId);
102: }
103:
104: public long getSubscriptionId() {
105: return _subscriptionId;
106: }
107:
108: public void setSubscriptionId(long subscriptionId) {
109: if (subscriptionId != _subscriptionId) {
110: _subscriptionId = subscriptionId;
111: }
112: }
113:
114: public long getCompanyId() {
115: return _companyId;
116: }
117:
118: public void setCompanyId(long companyId) {
119: if (companyId != _companyId) {
120: _companyId = companyId;
121: }
122: }
123:
124: public long getUserId() {
125: return _userId;
126: }
127:
128: public void setUserId(long userId) {
129: if (userId != _userId) {
130: _userId = userId;
131: }
132: }
133:
134: public String getUserName() {
135: return GetterUtil.getString(_userName);
136: }
137:
138: public void setUserName(String userName) {
139: if (((userName == null) && (_userName != null))
140: || ((userName != null) && (_userName == null))
141: || ((userName != null) && (_userName != null) && !userName
142: .equals(_userName))) {
143: _userName = userName;
144: }
145: }
146:
147: public Date getCreateDate() {
148: return _createDate;
149: }
150:
151: public void setCreateDate(Date createDate) {
152: if (((createDate == null) && (_createDate != null))
153: || ((createDate != null) && (_createDate == null))
154: || ((createDate != null) && (_createDate != null) && !createDate
155: .equals(_createDate))) {
156: _createDate = createDate;
157: }
158: }
159:
160: public Date getModifiedDate() {
161: return _modifiedDate;
162: }
163:
164: public void setModifiedDate(Date modifiedDate) {
165: if (((modifiedDate == null) && (_modifiedDate != null))
166: || ((modifiedDate != null) && (_modifiedDate == null))
167: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
168: .equals(_modifiedDate))) {
169: _modifiedDate = modifiedDate;
170: }
171: }
172:
173: public long getClassNameId() {
174: return _classNameId;
175: }
176:
177: public void setClassNameId(long classNameId) {
178: if (classNameId != _classNameId) {
179: _classNameId = classNameId;
180: }
181: }
182:
183: public long getClassPK() {
184: return _classPK;
185: }
186:
187: public void setClassPK(long classPK) {
188: if (classPK != _classPK) {
189: _classPK = classPK;
190: }
191: }
192:
193: public String getFrequency() {
194: return GetterUtil.getString(_frequency);
195: }
196:
197: public void setFrequency(String frequency) {
198: if (((frequency == null) && (_frequency != null))
199: || ((frequency != null) && (_frequency == null))
200: || ((frequency != null) && (_frequency != null) && !frequency
201: .equals(_frequency))) {
202: _frequency = frequency;
203: }
204: }
205:
206: public Subscription toEscapedModel() {
207: if (isEscapedModel()) {
208: return (Subscription) this ;
209: } else {
210: Subscription model = new SubscriptionImpl();
211:
212: model.setEscapedModel(true);
213:
214: model.setSubscriptionId(getSubscriptionId());
215: model.setCompanyId(getCompanyId());
216: model.setUserId(getUserId());
217: model.setUserName(Html.escape(getUserName()));
218: model.setCreateDate(getCreateDate());
219: model.setModifiedDate(getModifiedDate());
220: model.setClassNameId(getClassNameId());
221: model.setClassPK(getClassPK());
222: model.setFrequency(Html.escape(getFrequency()));
223:
224: model = (Subscription) Proxy.newProxyInstance(
225: Subscription.class.getClassLoader(),
226: new Class[] { Subscription.class },
227: new ReadOnlyBeanHandler(model));
228:
229: return model;
230: }
231: }
232:
233: public Object clone() {
234: SubscriptionImpl clone = new SubscriptionImpl();
235:
236: clone.setSubscriptionId(getSubscriptionId());
237: clone.setCompanyId(getCompanyId());
238: clone.setUserId(getUserId());
239: clone.setUserName(getUserName());
240: clone.setCreateDate(getCreateDate());
241: clone.setModifiedDate(getModifiedDate());
242: clone.setClassNameId(getClassNameId());
243: clone.setClassPK(getClassPK());
244: clone.setFrequency(getFrequency());
245:
246: return clone;
247: }
248:
249: public int compareTo(Object obj) {
250: if (obj == null) {
251: return -1;
252: }
253:
254: SubscriptionImpl subscription = (SubscriptionImpl) obj;
255:
256: long pk = subscription.getPrimaryKey();
257:
258: if (getPrimaryKey() < pk) {
259: return -1;
260: } else if (getPrimaryKey() > pk) {
261: return 1;
262: } else {
263: return 0;
264: }
265: }
266:
267: public boolean equals(Object obj) {
268: if (obj == null) {
269: return false;
270: }
271:
272: SubscriptionImpl subscription = null;
273:
274: try {
275: subscription = (SubscriptionImpl) obj;
276: } catch (ClassCastException cce) {
277: return false;
278: }
279:
280: long pk = subscription.getPrimaryKey();
281:
282: if (getPrimaryKey() == pk) {
283: return true;
284: } else {
285: return false;
286: }
287: }
288:
289: public int hashCode() {
290: return (int) getPrimaryKey();
291: }
292:
293: private long _subscriptionId;
294: private long _companyId;
295: private long _userId;
296: private String _userName;
297: private Date _createDate;
298: private Date _modifiedDate;
299: private long _classNameId;
300: private long _classPK;
301: private String _frequency;
302: }
|