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.UserTrackerPath;
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="UserTrackerPathModelImpl.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>UserTrackerPath</code> table
50   * in the database.
51   * </p>
52   *
53   * @author Brian Wing Shun Chan
54   *
55   * @see com.liferay.portal.service.model.UserTrackerPath
56   * @see com.liferay.portal.service.model.UserTrackerPathModel
57   * @see com.liferay.portal.service.model.impl.UserTrackerPathImpl
58   *
59   */
60  public class UserTrackerPathModelImpl extends BaseModelImpl {
61      public static final String TABLE_NAME = "UserTrackerPath";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "userTrackerPathId", new Integer(Types.BIGINT) },
64              
65  
66              { "userTrackerId", new Integer(Types.BIGINT) },
67              
68  
69              { "path_", new Integer(Types.VARCHAR) },
70              
71  
72              { "pathDate", new Integer(Types.TIMESTAMP) }
73          };
74      public static final String TABLE_SQL_CREATE = "create table UserTrackerPath (userTrackerPathId LONG not null primary key,userTrackerId LONG,path_ STRING null,pathDate DATE null)";
75      public static final String TABLE_SQL_DROP = "drop table UserTrackerPath";
76      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
77                  "value.object.finder.cache.enabled.com.liferay.portal.model.UserTrackerPath"),
78              true);
79      public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
80                  "lock.expiration.time.com.liferay.portal.model.UserTrackerPath"));
81  
82      public UserTrackerPathModelImpl() {
83      }
84  
85      public long getPrimaryKey() {
86          return _userTrackerPathId;
87      }
88  
89      public void setPrimaryKey(long pk) {
90          setUserTrackerPathId(pk);
91      }
92  
93      public Serializable getPrimaryKeyObj() {
94          return new Long(_userTrackerPathId);
95      }
96  
97      public long getUserTrackerPathId() {
98          return _userTrackerPathId;
99      }
100 
101     public void setUserTrackerPathId(long userTrackerPathId) {
102         if (userTrackerPathId != _userTrackerPathId) {
103             _userTrackerPathId = userTrackerPathId;
104         }
105     }
106 
107     public long getUserTrackerId() {
108         return _userTrackerId;
109     }
110 
111     public void setUserTrackerId(long userTrackerId) {
112         if (userTrackerId != _userTrackerId) {
113             _userTrackerId = userTrackerId;
114         }
115     }
116 
117     public String getPath() {
118         return GetterUtil.getString(_path);
119     }
120 
121     public void setPath(String path) {
122         if (((path == null) && (_path != null)) ||
123                 ((path != null) && (_path == null)) ||
124                 ((path != null) && (_path != null) && !path.equals(_path))) {
125             _path = path;
126         }
127     }
128 
129     public Date getPathDate() {
130         return _pathDate;
131     }
132 
133     public void setPathDate(Date pathDate) {
134         if (((pathDate == null) && (_pathDate != null)) ||
135                 ((pathDate != null) && (_pathDate == null)) ||
136                 ((pathDate != null) && (_pathDate != null) &&
137                 !pathDate.equals(_pathDate))) {
138             _pathDate = pathDate;
139         }
140     }
141 
142     public UserTrackerPath toEscapedModel() {
143         if (isEscapedModel()) {
144             return (UserTrackerPath)this;
145         }
146         else {
147             UserTrackerPath model = new UserTrackerPathImpl();
148 
149             model.setEscapedModel(true);
150 
151             model.setUserTrackerPathId(getUserTrackerPathId());
152             model.setUserTrackerId(getUserTrackerId());
153             model.setPath(Html.escape(getPath()));
154             model.setPathDate(getPathDate());
155 
156             model = (UserTrackerPath)Proxy.newProxyInstance(UserTrackerPath.class.getClassLoader(),
157                     new Class[] { UserTrackerPath.class },
158                     new ReadOnlyBeanHandler(model));
159 
160             return model;
161         }
162     }
163 
164     public Object clone() {
165         UserTrackerPathImpl clone = new UserTrackerPathImpl();
166 
167         clone.setUserTrackerPathId(getUserTrackerPathId());
168         clone.setUserTrackerId(getUserTrackerId());
169         clone.setPath(getPath());
170         clone.setPathDate(getPathDate());
171 
172         return clone;
173     }
174 
175     public int compareTo(Object obj) {
176         if (obj == null) {
177             return -1;
178         }
179 
180         UserTrackerPathImpl userTrackerPath = (UserTrackerPathImpl)obj;
181 
182         long pk = userTrackerPath.getPrimaryKey();
183 
184         if (getPrimaryKey() < pk) {
185             return -1;
186         }
187         else if (getPrimaryKey() > pk) {
188             return 1;
189         }
190         else {
191             return 0;
192         }
193     }
194 
195     public boolean equals(Object obj) {
196         if (obj == null) {
197             return false;
198         }
199 
200         UserTrackerPathImpl userTrackerPath = null;
201 
202         try {
203             userTrackerPath = (UserTrackerPathImpl)obj;
204         }
205         catch (ClassCastException cce) {
206             return false;
207         }
208 
209         long pk = userTrackerPath.getPrimaryKey();
210 
211         if (getPrimaryKey() == pk) {
212             return true;
213         }
214         else {
215             return false;
216         }
217     }
218 
219     public int hashCode() {
220         return (int)getPrimaryKey();
221     }
222 
223     private long _userTrackerPathId;
224     private long _userTrackerId;
225     private String _path;
226     private Date _pathDate;
227 }