1   /**
2    * Copyright (c) 2000-2007 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.util.GetterUtil;
26  import com.liferay.portal.model.impl.BaseModelImpl;
27  import com.liferay.portal.util.PropsUtil;
28  
29  import com.liferay.util.XSSUtil;
30  
31  import java.io.Serializable;
32  
33  import java.sql.Types;
34  
35  import java.util.Date;
36  
37  /**
38   * <a href="SubscriptionModelImpl.java.html"><b><i>View Source</i></b></a>
39   *
40   * <p>
41   * ServiceBuilder generated this class. Modifications in this class will be overwritten
42   * the next time is generated.
43   * </p>
44   *
45   * <p>
46   * This class is a model that represents the <code>Subscription</code> table in
47   * the database.
48   * </p>
49   *
50   * @author Brian Wing Shun Chan
51   *
52   * @see com.liferay.portal.service.model.Subscription
53   * @see com.liferay.portal.service.model.SubscriptionModel
54   * @see com.liferay.portal.service.model.impl.SubscriptionImpl
55   *
56   */
57  public class SubscriptionModelImpl extends BaseModelImpl {
58      public static String TABLE_NAME = "Subscription";
59      public static Object[][] TABLE_COLUMNS = {
60              { "subscriptionId", new Integer(Types.BIGINT) },
61              { "companyId", new Integer(Types.BIGINT) },
62              { "userId", new Integer(Types.BIGINT) },
63              { "userName", new Integer(Types.VARCHAR) },
64              { "createDate", new Integer(Types.TIMESTAMP) },
65              { "modifiedDate", new Integer(Types.TIMESTAMP) },
66              { "classNameId", new Integer(Types.BIGINT) },
67              { "classPK", new Integer(Types.BIGINT) },
68              { "frequency", new Integer(Types.VARCHAR) }
69          };
70      public static 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)";
71      public static String TABLE_SQL_DROP = "drop table Subscription";
72      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
73                  "xss.allow.com.liferay.portal.model.Subscription"), XSS_ALLOW);
74      public static boolean XSS_ALLOW_USERNAME = GetterUtil.getBoolean(PropsUtil.get(
75                  "xss.allow.com.liferay.portal.model.Subscription.userName"),
76              XSS_ALLOW_BY_MODEL);
77      public static boolean XSS_ALLOW_FREQUENCY = GetterUtil.getBoolean(PropsUtil.get(
78                  "xss.allow.com.liferay.portal.model.Subscription.frequency"),
79              XSS_ALLOW_BY_MODEL);
80      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
81                  "lock.expiration.time.com.liferay.portal.model.SubscriptionModel"));
82  
83      public SubscriptionModelImpl() {
84      }
85  
86      public long getPrimaryKey() {
87          return _subscriptionId;
88      }
89  
90      public void setPrimaryKey(long pk) {
91          setSubscriptionId(pk);
92      }
93  
94      public Serializable getPrimaryKeyObj() {
95          return new Long(_subscriptionId);
96      }
97  
98      public long getSubscriptionId() {
99          return _subscriptionId;
100     }
101 
102     public void setSubscriptionId(long subscriptionId) {
103         if (subscriptionId != _subscriptionId) {
104             _subscriptionId = subscriptionId;
105         }
106     }
107 
108     public long getCompanyId() {
109         return _companyId;
110     }
111 
112     public void setCompanyId(long companyId) {
113         if (companyId != _companyId) {
114             _companyId = companyId;
115         }
116     }
117 
118     public long getUserId() {
119         return _userId;
120     }
121 
122     public void setUserId(long userId) {
123         if (userId != _userId) {
124             _userId = userId;
125         }
126     }
127 
128     public String getUserName() {
129         return GetterUtil.getString(_userName);
130     }
131 
132     public void setUserName(String userName) {
133         if (((userName == null) && (_userName != null)) ||
134                 ((userName != null) && (_userName == null)) ||
135                 ((userName != null) && (_userName != null) &&
136                 !userName.equals(_userName))) {
137             if (!XSS_ALLOW_USERNAME) {
138                 userName = XSSUtil.strip(userName);
139             }
140 
141             _userName = userName;
142         }
143     }
144 
145     public Date getCreateDate() {
146         return _createDate;
147     }
148 
149     public void setCreateDate(Date createDate) {
150         if (((createDate == null) && (_createDate != null)) ||
151                 ((createDate != null) && (_createDate == null)) ||
152                 ((createDate != null) && (_createDate != null) &&
153                 !createDate.equals(_createDate))) {
154             _createDate = createDate;
155         }
156     }
157 
158     public Date getModifiedDate() {
159         return _modifiedDate;
160     }
161 
162     public void setModifiedDate(Date modifiedDate) {
163         if (((modifiedDate == null) && (_modifiedDate != null)) ||
164                 ((modifiedDate != null) && (_modifiedDate == null)) ||
165                 ((modifiedDate != null) && (_modifiedDate != null) &&
166                 !modifiedDate.equals(_modifiedDate))) {
167             _modifiedDate = modifiedDate;
168         }
169     }
170 
171     public long getClassNameId() {
172         return _classNameId;
173     }
174 
175     public void setClassNameId(long classNameId) {
176         if (classNameId != _classNameId) {
177             _classNameId = classNameId;
178         }
179     }
180 
181     public long getClassPK() {
182         return _classPK;
183     }
184 
185     public void setClassPK(long classPK) {
186         if (classPK != _classPK) {
187             _classPK = classPK;
188         }
189     }
190 
191     public String getFrequency() {
192         return GetterUtil.getString(_frequency);
193     }
194 
195     public void setFrequency(String frequency) {
196         if (((frequency == null) && (_frequency != null)) ||
197                 ((frequency != null) && (_frequency == null)) ||
198                 ((frequency != null) && (_frequency != null) &&
199                 !frequency.equals(_frequency))) {
200             if (!XSS_ALLOW_FREQUENCY) {
201                 frequency = XSSUtil.strip(frequency);
202             }
203 
204             _frequency = frequency;
205         }
206     }
207 
208     public Object clone() {
209         SubscriptionImpl clone = new SubscriptionImpl();
210         clone.setSubscriptionId(getSubscriptionId());
211         clone.setCompanyId(getCompanyId());
212         clone.setUserId(getUserId());
213         clone.setUserName(getUserName());
214         clone.setCreateDate(getCreateDate());
215         clone.setModifiedDate(getModifiedDate());
216         clone.setClassNameId(getClassNameId());
217         clone.setClassPK(getClassPK());
218         clone.setFrequency(getFrequency());
219 
220         return clone;
221     }
222 
223     public int compareTo(Object obj) {
224         if (obj == null) {
225             return -1;
226         }
227 
228         SubscriptionImpl subscription = (SubscriptionImpl)obj;
229         long pk = subscription.getPrimaryKey();
230 
231         if (getPrimaryKey() < pk) {
232             return -1;
233         }
234         else if (getPrimaryKey() > pk) {
235             return 1;
236         }
237         else {
238             return 0;
239         }
240     }
241 
242     public boolean equals(Object obj) {
243         if (obj == null) {
244             return false;
245         }
246 
247         SubscriptionImpl subscription = null;
248 
249         try {
250             subscription = (SubscriptionImpl)obj;
251         }
252         catch (ClassCastException cce) {
253             return false;
254         }
255 
256         long pk = subscription.getPrimaryKey();
257 
258         if (getPrimaryKey() == pk) {
259             return true;
260         }
261         else {
262             return false;
263         }
264     }
265 
266     public int hashCode() {
267         return (int)getPrimaryKey();
268     }
269 
270     private long _subscriptionId;
271     private long _companyId;
272     private long _userId;
273     private String _userName;
274     private Date _createDate;
275     private Date _modifiedDate;
276     private long _classNameId;
277     private long _classPK;
278     private String _frequency;
279 }