1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
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.model.Subscription;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.util.Html;
31  
32  import java.io.Serializable;
33  
34  import java.lang.reflect.Proxy;
35  
36  import java.sql.Types;
37  
38  import java.util.Date;
39  
40  /**
41   * <a href="SubscriptionModelImpl.java.html"><b><i>View Source</i></b></a>
42   *
43   * <p>
44   * ServiceBuilder generated this class. Modifications in this class will be
45   * overwritten the next time is generated.
46   * </p>
47   *
48   * <p>
49   * This class is a model that represents the <code>Subscription</code> table
50   * in the database.
51   * </p>
52   *
53   * @author Brian Wing Shun Chan
54   *
55   * @see com.liferay.portal.service.model.Subscription
56   * @see com.liferay.portal.service.model.SubscriptionModel
57   * @see com.liferay.portal.service.model.impl.SubscriptionImpl
58   *
59   */
60  public class SubscriptionModelImpl extends BaseModelImpl {
61      public static final String TABLE_NAME = "Subscription";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "subscriptionId", new Integer(Types.BIGINT) },
64              
65  
66              { "companyId", new Integer(Types.BIGINT) },
67              
68  
69              { "userId", new Integer(Types.BIGINT) },
70              
71  
72              { "userName", new Integer(Types.VARCHAR) },
73              
74  
75              { "createDate", new Integer(Types.TIMESTAMP) },
76              
77  
78              { "modifiedDate", new Integer(Types.TIMESTAMP) },
79              
80  
81              { "classNameId", new Integer(Types.BIGINT) },
82              
83  
84              { "classPK", new Integer(Types.BIGINT) },
85              
86  
87              { "frequency", new Integer(Types.VARCHAR) }
88          };
89      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)";
90      public static final String TABLE_SQL_DROP = "drop table Subscription";
91      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
92                  "value.object.finder.cache.enabled.com.liferay.portal.model.Subscription"),
93              true);
94      public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
95                  "lock.expiration.time.com.liferay.portal.model.Subscription"));
96  
97      public SubscriptionModelImpl() {
98      }
99  
100     public long getPrimaryKey() {
101         return _subscriptionId;
102     }
103 
104     public void setPrimaryKey(long pk) {
105         setSubscriptionId(pk);
106     }
107 
108     public Serializable getPrimaryKeyObj() {
109         return new Long(_subscriptionId);
110     }
111 
112     public long getSubscriptionId() {
113         return _subscriptionId;
114     }
115 
116     public void setSubscriptionId(long subscriptionId) {
117         if (subscriptionId != _subscriptionId) {
118             _subscriptionId = subscriptionId;
119         }
120     }
121 
122     public long getCompanyId() {
123         return _companyId;
124     }
125 
126     public void setCompanyId(long companyId) {
127         if (companyId != _companyId) {
128             _companyId = companyId;
129         }
130     }
131 
132     public long getUserId() {
133         return _userId;
134     }
135 
136     public void setUserId(long userId) {
137         if (userId != _userId) {
138             _userId = userId;
139         }
140     }
141 
142     public String getUserName() {
143         return GetterUtil.getString(_userName);
144     }
145 
146     public void setUserName(String userName) {
147         if (((userName == null) && (_userName != null)) ||
148                 ((userName != null) && (_userName == null)) ||
149                 ((userName != null) && (_userName != null) &&
150                 !userName.equals(_userName))) {
151             _userName = userName;
152         }
153     }
154 
155     public Date getCreateDate() {
156         return _createDate;
157     }
158 
159     public void setCreateDate(Date createDate) {
160         if (((createDate == null) && (_createDate != null)) ||
161                 ((createDate != null) && (_createDate == null)) ||
162                 ((createDate != null) && (_createDate != null) &&
163                 !createDate.equals(_createDate))) {
164             _createDate = createDate;
165         }
166     }
167 
168     public Date getModifiedDate() {
169         return _modifiedDate;
170     }
171 
172     public void setModifiedDate(Date modifiedDate) {
173         if (((modifiedDate == null) && (_modifiedDate != null)) ||
174                 ((modifiedDate != null) && (_modifiedDate == null)) ||
175                 ((modifiedDate != null) && (_modifiedDate != null) &&
176                 !modifiedDate.equals(_modifiedDate))) {
177             _modifiedDate = modifiedDate;
178         }
179     }
180 
181     public long getClassNameId() {
182         return _classNameId;
183     }
184 
185     public void setClassNameId(long classNameId) {
186         if (classNameId != _classNameId) {
187             _classNameId = classNameId;
188         }
189     }
190 
191     public long getClassPK() {
192         return _classPK;
193     }
194 
195     public void setClassPK(long classPK) {
196         if (classPK != _classPK) {
197             _classPK = classPK;
198         }
199     }
200 
201     public String getFrequency() {
202         return GetterUtil.getString(_frequency);
203     }
204 
205     public void setFrequency(String frequency) {
206         if (((frequency == null) && (_frequency != null)) ||
207                 ((frequency != null) && (_frequency == null)) ||
208                 ((frequency != null) && (_frequency != null) &&
209                 !frequency.equals(_frequency))) {
210             _frequency = frequency;
211         }
212     }
213 
214     public Subscription toEscapedModel() {
215         if (isEscapedModel()) {
216             return (Subscription)this;
217         }
218         else {
219             Subscription model = new SubscriptionImpl();
220 
221             model.setEscapedModel(true);
222 
223             model.setSubscriptionId(getSubscriptionId());
224             model.setCompanyId(getCompanyId());
225             model.setUserId(getUserId());
226             model.setUserName(Html.escape(getUserName()));
227             model.setCreateDate(getCreateDate());
228             model.setModifiedDate(getModifiedDate());
229             model.setClassNameId(getClassNameId());
230             model.setClassPK(getClassPK());
231             model.setFrequency(Html.escape(getFrequency()));
232 
233             model = (Subscription)Proxy.newProxyInstance(Subscription.class.getClassLoader(),
234                     new Class[] { Subscription.class },
235                     new ReadOnlyBeanHandler(model));
236 
237             return model;
238         }
239     }
240 
241     public Object clone() {
242         SubscriptionImpl clone = new SubscriptionImpl();
243 
244         clone.setSubscriptionId(getSubscriptionId());
245         clone.setCompanyId(getCompanyId());
246         clone.setUserId(getUserId());
247         clone.setUserName(getUserName());
248         clone.setCreateDate(getCreateDate());
249         clone.setModifiedDate(getModifiedDate());
250         clone.setClassNameId(getClassNameId());
251         clone.setClassPK(getClassPK());
252         clone.setFrequency(getFrequency());
253 
254         return clone;
255     }
256 
257     public int compareTo(Object obj) {
258         if (obj == null) {
259             return -1;
260         }
261 
262         SubscriptionImpl subscription = (SubscriptionImpl)obj;
263 
264         long pk = subscription.getPrimaryKey();
265 
266         if (getPrimaryKey() < pk) {
267             return -1;
268         }
269         else if (getPrimaryKey() > pk) {
270             return 1;
271         }
272         else {
273             return 0;
274         }
275     }
276 
277     public boolean equals(Object obj) {
278         if (obj == null) {
279             return false;
280         }
281 
282         SubscriptionImpl subscription = null;
283 
284         try {
285             subscription = (SubscriptionImpl)obj;
286         }
287         catch (ClassCastException cce) {
288             return false;
289         }
290 
291         long pk = subscription.getPrimaryKey();
292 
293         if (getPrimaryKey() == pk) {
294             return true;
295         }
296         else {
297             return false;
298         }
299     }
300 
301     public int hashCode() {
302         return (int)getPrimaryKey();
303     }
304 
305     private long _subscriptionId;
306     private long _companyId;
307     private long _userId;
308     private String _userName;
309     private Date _createDate;
310     private Date _modifiedDate;
311     private long _classNameId;
312     private long _classPK;
313     private String _frequency;
314 }