1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.model.impl;
21  
22  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23  import com.liferay.portal.kernel.util.GetterUtil;
24  import com.liferay.portal.kernel.util.HtmlUtil;
25  import com.liferay.portal.model.UserTrackerPath;
26  import com.liferay.portal.model.UserTrackerPathSoap;
27  
28  import java.io.Serializable;
29  
30  import java.lang.reflect.Proxy;
31  
32  import java.sql.Types;
33  
34  import java.util.ArrayList;
35  import java.util.Date;
36  import java.util.List;
37  
38  /**
39   * <a href="UserTrackerPathModelImpl.java.html"><b><i>View Source</i></b></a>
40   *
41   * <p>
42   * ServiceBuilder generated this class. Modifications in this class will be
43   * overwritten the next time is generated.
44   * </p>
45   *
46   * <p>
47   * This class is a model that represents the <code>UserTrackerPath</code> table
48   * in the database.
49   * </p>
50   *
51   * @author Brian Wing Shun Chan
52   *
53   * @see com.liferay.portal.model.UserTrackerPath
54   * @see com.liferay.portal.model.UserTrackerPathModel
55   * @see com.liferay.portal.model.impl.UserTrackerPathImpl
56   *
57   */
58  public class UserTrackerPathModelImpl extends BaseModelImpl {
59      public static final String TABLE_NAME = "UserTrackerPath";
60      public static final Object[][] TABLE_COLUMNS = {
61              { "userTrackerPathId", new Integer(Types.BIGINT) },
62              
63  
64              { "userTrackerId", new Integer(Types.BIGINT) },
65              
66  
67              { "path_", new Integer(Types.VARCHAR) },
68              
69  
70              { "pathDate", new Integer(Types.TIMESTAMP) }
71          };
72      public static final String TABLE_SQL_CREATE = "create table UserTrackerPath (userTrackerPathId LONG not null primary key,userTrackerId LONG,path_ STRING null,pathDate DATE null)";
73      public static final String TABLE_SQL_DROP = "drop table UserTrackerPath";
74      public static final String DATA_SOURCE = "liferayDataSource";
75      public static final String SESSION_FACTORY = "liferaySessionFactory";
76      public static final String TX_MANAGER = "liferayTransactionManager";
77      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
78                  "value.object.finder.cache.enabled.com.liferay.portal.model.UserTrackerPath"),
79              true);
80  
81      public static UserTrackerPath toModel(UserTrackerPathSoap soapModel) {
82          UserTrackerPath model = new UserTrackerPathImpl();
83  
84          model.setUserTrackerPathId(soapModel.getUserTrackerPathId());
85          model.setUserTrackerId(soapModel.getUserTrackerId());
86          model.setPath(soapModel.getPath());
87          model.setPathDate(soapModel.getPathDate());
88  
89          return model;
90      }
91  
92      public static List<UserTrackerPath> toModels(
93          UserTrackerPathSoap[] soapModels) {
94          List<UserTrackerPath> models = new ArrayList<UserTrackerPath>(soapModels.length);
95  
96          for (UserTrackerPathSoap soapModel : soapModels) {
97              models.add(toModel(soapModel));
98          }
99  
100         return models;
101     }
102 
103     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
104                 "lock.expiration.time.com.liferay.portal.model.UserTrackerPath"));
105 
106     public UserTrackerPathModelImpl() {
107     }
108 
109     public long getPrimaryKey() {
110         return _userTrackerPathId;
111     }
112 
113     public void setPrimaryKey(long pk) {
114         setUserTrackerPathId(pk);
115     }
116 
117     public Serializable getPrimaryKeyObj() {
118         return new Long(_userTrackerPathId);
119     }
120 
121     public long getUserTrackerPathId() {
122         return _userTrackerPathId;
123     }
124 
125     public void setUserTrackerPathId(long userTrackerPathId) {
126         if (userTrackerPathId != _userTrackerPathId) {
127             _userTrackerPathId = userTrackerPathId;
128         }
129     }
130 
131     public long getUserTrackerId() {
132         return _userTrackerId;
133     }
134 
135     public void setUserTrackerId(long userTrackerId) {
136         if (userTrackerId != _userTrackerId) {
137             _userTrackerId = userTrackerId;
138         }
139     }
140 
141     public String getPath() {
142         return GetterUtil.getString(_path);
143     }
144 
145     public void setPath(String path) {
146         if (((path == null) && (_path != null)) ||
147                 ((path != null) && (_path == null)) ||
148                 ((path != null) && (_path != null) && !path.equals(_path))) {
149             _path = path;
150         }
151     }
152 
153     public Date getPathDate() {
154         return _pathDate;
155     }
156 
157     public void setPathDate(Date pathDate) {
158         if (((pathDate == null) && (_pathDate != null)) ||
159                 ((pathDate != null) && (_pathDate == null)) ||
160                 ((pathDate != null) && (_pathDate != null) &&
161                 !pathDate.equals(_pathDate))) {
162             _pathDate = pathDate;
163         }
164     }
165 
166     public UserTrackerPath toEscapedModel() {
167         if (isEscapedModel()) {
168             return (UserTrackerPath)this;
169         }
170         else {
171             UserTrackerPath model = new UserTrackerPathImpl();
172 
173             model.setNew(isNew());
174             model.setEscapedModel(true);
175 
176             model.setUserTrackerPathId(getUserTrackerPathId());
177             model.setUserTrackerId(getUserTrackerId());
178             model.setPath(HtmlUtil.escape(getPath()));
179             model.setPathDate(getPathDate());
180 
181             model = (UserTrackerPath)Proxy.newProxyInstance(UserTrackerPath.class.getClassLoader(),
182                     new Class[] { UserTrackerPath.class },
183                     new ReadOnlyBeanHandler(model));
184 
185             return model;
186         }
187     }
188 
189     public Object clone() {
190         UserTrackerPathImpl clone = new UserTrackerPathImpl();
191 
192         clone.setUserTrackerPathId(getUserTrackerPathId());
193         clone.setUserTrackerId(getUserTrackerId());
194         clone.setPath(getPath());
195         clone.setPathDate(getPathDate());
196 
197         return clone;
198     }
199 
200     public int compareTo(Object obj) {
201         if (obj == null) {
202             return -1;
203         }
204 
205         UserTrackerPathImpl userTrackerPath = (UserTrackerPathImpl)obj;
206 
207         long pk = userTrackerPath.getPrimaryKey();
208 
209         if (getPrimaryKey() < pk) {
210             return -1;
211         }
212         else if (getPrimaryKey() > pk) {
213             return 1;
214         }
215         else {
216             return 0;
217         }
218     }
219 
220     public boolean equals(Object obj) {
221         if (obj == null) {
222             return false;
223         }
224 
225         UserTrackerPathImpl userTrackerPath = null;
226 
227         try {
228             userTrackerPath = (UserTrackerPathImpl)obj;
229         }
230         catch (ClassCastException cce) {
231             return false;
232         }
233 
234         long pk = userTrackerPath.getPrimaryKey();
235 
236         if (getPrimaryKey() == pk) {
237             return true;
238         }
239         else {
240             return false;
241         }
242     }
243 
244     public int hashCode() {
245         return (int)getPrimaryKey();
246     }
247 
248     private long _userTrackerPathId;
249     private long _userTrackerId;
250     private String _path;
251     private Date _pathDate;
252 }