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.DateUtil;
27  import com.liferay.portal.kernel.util.GetterUtil;
28  import com.liferay.portal.model.ActivityTracker;
29  import com.liferay.portal.util.PropsUtil;
30  
31  import com.liferay.util.Html;
32  
33  import java.io.Serializable;
34  
35  import java.lang.reflect.Proxy;
36  
37  import java.sql.Types;
38  
39  import java.util.Date;
40  
41  /**
42   * <a href="ActivityTrackerModelImpl.java.html"><b><i>View Source</i></b></a>
43   *
44   * <p>
45   * ServiceBuilder generated this class. Modifications in this class will be
46   * overwritten the next time is generated.
47   * </p>
48   *
49   * <p>
50   * This class is a model that represents the <code>ActivityTracker</code> table
51   * in the database.
52   * </p>
53   *
54   * @author Brian Wing Shun Chan
55   *
56   * @see com.liferay.portal.service.model.ActivityTracker
57   * @see com.liferay.portal.service.model.ActivityTrackerModel
58   * @see com.liferay.portal.service.model.impl.ActivityTrackerImpl
59   *
60   */
61  public class ActivityTrackerModelImpl extends BaseModelImpl {
62      public static final String TABLE_NAME = "ActivityTracker";
63      public static final Object[][] TABLE_COLUMNS = {
64              { "activityTrackerId", new Integer(Types.BIGINT) },
65              
66  
67              { "groupId", new Integer(Types.BIGINT) },
68              
69  
70              { "companyId", new Integer(Types.BIGINT) },
71              
72  
73              { "userId", new Integer(Types.BIGINT) },
74              
75  
76              { "userName", new Integer(Types.VARCHAR) },
77              
78  
79              { "createDate", new Integer(Types.TIMESTAMP) },
80              
81  
82              { "classNameId", new Integer(Types.BIGINT) },
83              
84  
85              { "classPK", new Integer(Types.BIGINT) },
86              
87  
88              { "activity", new Integer(Types.VARCHAR) },
89              
90  
91              { "extraData", new Integer(Types.CLOB) },
92              
93  
94              { "receiverUserId", new Integer(Types.BIGINT) },
95              
96  
97              { "receiverUserName", new Integer(Types.VARCHAR) }
98          };
99      public static final String TABLE_SQL_CREATE = "create table ActivityTracker (activityTrackerId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,classNameId LONG,classPK LONG,activity VARCHAR(75) null,extraData TEXT null,receiverUserId LONG,receiverUserName VARCHAR(75) null)";
100     public static final String TABLE_SQL_DROP = "drop table ActivityTracker";
101     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
102                 "value.object.finder.cache.enabled.com.liferay.portal.model.ActivityTracker"),
103             true);
104     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
105                 "lock.expiration.time.com.liferay.portal.model.ActivityTracker"));
106 
107     public ActivityTrackerModelImpl() {
108     }
109 
110     public long getPrimaryKey() {
111         return _activityTrackerId;
112     }
113 
114     public void setPrimaryKey(long pk) {
115         setActivityTrackerId(pk);
116     }
117 
118     public Serializable getPrimaryKeyObj() {
119         return new Long(_activityTrackerId);
120     }
121 
122     public long getActivityTrackerId() {
123         return _activityTrackerId;
124     }
125 
126     public void setActivityTrackerId(long activityTrackerId) {
127         if (activityTrackerId != _activityTrackerId) {
128             _activityTrackerId = activityTrackerId;
129         }
130     }
131 
132     public long getGroupId() {
133         return _groupId;
134     }
135 
136     public void setGroupId(long groupId) {
137         if (groupId != _groupId) {
138             _groupId = groupId;
139         }
140     }
141 
142     public long getCompanyId() {
143         return _companyId;
144     }
145 
146     public void setCompanyId(long companyId) {
147         if (companyId != _companyId) {
148             _companyId = companyId;
149         }
150     }
151 
152     public long getUserId() {
153         return _userId;
154     }
155 
156     public void setUserId(long userId) {
157         if (userId != _userId) {
158             _userId = userId;
159         }
160     }
161 
162     public String getUserName() {
163         return GetterUtil.getString(_userName);
164     }
165 
166     public void setUserName(String userName) {
167         if (((userName == null) && (_userName != null)) ||
168                 ((userName != null) && (_userName == null)) ||
169                 ((userName != null) && (_userName != null) &&
170                 !userName.equals(_userName))) {
171             _userName = userName;
172         }
173     }
174 
175     public Date getCreateDate() {
176         return _createDate;
177     }
178 
179     public void setCreateDate(Date createDate) {
180         if (((createDate == null) && (_createDate != null)) ||
181                 ((createDate != null) && (_createDate == null)) ||
182                 ((createDate != null) && (_createDate != null) &&
183                 !createDate.equals(_createDate))) {
184             _createDate = createDate;
185         }
186     }
187 
188     public long getClassNameId() {
189         return _classNameId;
190     }
191 
192     public void setClassNameId(long classNameId) {
193         if (classNameId != _classNameId) {
194             _classNameId = classNameId;
195         }
196     }
197 
198     public long getClassPK() {
199         return _classPK;
200     }
201 
202     public void setClassPK(long classPK) {
203         if (classPK != _classPK) {
204             _classPK = classPK;
205         }
206     }
207 
208     public String getActivity() {
209         return GetterUtil.getString(_activity);
210     }
211 
212     public void setActivity(String activity) {
213         if (((activity == null) && (_activity != null)) ||
214                 ((activity != null) && (_activity == null)) ||
215                 ((activity != null) && (_activity != null) &&
216                 !activity.equals(_activity))) {
217             _activity = activity;
218         }
219     }
220 
221     public String getExtraData() {
222         return GetterUtil.getString(_extraData);
223     }
224 
225     public void setExtraData(String extraData) {
226         if (((extraData == null) && (_extraData != null)) ||
227                 ((extraData != null) && (_extraData == null)) ||
228                 ((extraData != null) && (_extraData != null) &&
229                 !extraData.equals(_extraData))) {
230             _extraData = extraData;
231         }
232     }
233 
234     public long getReceiverUserId() {
235         return _receiverUserId;
236     }
237 
238     public void setReceiverUserId(long receiverUserId) {
239         if (receiverUserId != _receiverUserId) {
240             _receiverUserId = receiverUserId;
241         }
242     }
243 
244     public String getReceiverUserName() {
245         return GetterUtil.getString(_receiverUserName);
246     }
247 
248     public void setReceiverUserName(String receiverUserName) {
249         if (((receiverUserName == null) && (_receiverUserName != null)) ||
250                 ((receiverUserName != null) && (_receiverUserName == null)) ||
251                 ((receiverUserName != null) && (_receiverUserName != null) &&
252                 !receiverUserName.equals(_receiverUserName))) {
253             _receiverUserName = receiverUserName;
254         }
255     }
256 
257     public ActivityTracker toEscapedModel() {
258         if (isEscapedModel()) {
259             return (ActivityTracker)this;
260         }
261         else {
262             ActivityTracker model = new ActivityTrackerImpl();
263 
264             model.setEscapedModel(true);
265 
266             model.setActivityTrackerId(getActivityTrackerId());
267             model.setGroupId(getGroupId());
268             model.setCompanyId(getCompanyId());
269             model.setUserId(getUserId());
270             model.setUserName(Html.escape(getUserName()));
271             model.setCreateDate(getCreateDate());
272             model.setClassNameId(getClassNameId());
273             model.setClassPK(getClassPK());
274             model.setActivity(Html.escape(getActivity()));
275             model.setExtraData(Html.escape(getExtraData()));
276             model.setReceiverUserId(getReceiverUserId());
277             model.setReceiverUserName(Html.escape(getReceiverUserName()));
278 
279             model = (ActivityTracker)Proxy.newProxyInstance(ActivityTracker.class.getClassLoader(),
280                     new Class[] { ActivityTracker.class },
281                     new ReadOnlyBeanHandler(model));
282 
283             return model;
284         }
285     }
286 
287     public Object clone() {
288         ActivityTrackerImpl clone = new ActivityTrackerImpl();
289 
290         clone.setActivityTrackerId(getActivityTrackerId());
291         clone.setGroupId(getGroupId());
292         clone.setCompanyId(getCompanyId());
293         clone.setUserId(getUserId());
294         clone.setUserName(getUserName());
295         clone.setCreateDate(getCreateDate());
296         clone.setClassNameId(getClassNameId());
297         clone.setClassPK(getClassPK());
298         clone.setActivity(getActivity());
299         clone.setExtraData(getExtraData());
300         clone.setReceiverUserId(getReceiverUserId());
301         clone.setReceiverUserName(getReceiverUserName());
302 
303         return clone;
304     }
305 
306     public int compareTo(Object obj) {
307         if (obj == null) {
308             return -1;
309         }
310 
311         ActivityTrackerImpl activityTracker = (ActivityTrackerImpl)obj;
312 
313         int value = 0;
314 
315         value = DateUtil.compareTo(getCreateDate(),
316                 activityTracker.getCreateDate());
317 
318         value = value * -1;
319 
320         if (value != 0) {
321             return value;
322         }
323 
324         return 0;
325     }
326 
327     public boolean equals(Object obj) {
328         if (obj == null) {
329             return false;
330         }
331 
332         ActivityTrackerImpl activityTracker = null;
333 
334         try {
335             activityTracker = (ActivityTrackerImpl)obj;
336         }
337         catch (ClassCastException cce) {
338             return false;
339         }
340 
341         long pk = activityTracker.getPrimaryKey();
342 
343         if (getPrimaryKey() == pk) {
344             return true;
345         }
346         else {
347             return false;
348         }
349     }
350 
351     public int hashCode() {
352         return (int)getPrimaryKey();
353     }
354 
355     private long _activityTrackerId;
356     private long _groupId;
357     private long _companyId;
358     private long _userId;
359     private String _userName;
360     private Date _createDate;
361     private long _classNameId;
362     private long _classPK;
363     private String _activity;
364     private String _extraData;
365     private long _receiverUserId;
366     private String _receiverUserName;
367 }