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