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.model.UserTrackerPath
57   * @see com.liferay.portal.model.UserTrackerPathModel
58   * @see com.liferay.portal.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.setNew(isNew());
177             model.setEscapedModel(true);
178 
179             model.setUserTrackerPathId(getUserTrackerPathId());
180             model.setUserTrackerId(getUserTrackerId());
181             model.setPath(HtmlUtil.escape(getPath()));
182             model.setPathDate(getPathDate());
183 
184             model = (UserTrackerPath)Proxy.newProxyInstance(UserTrackerPath.class.getClassLoader(),
185                     new Class[] { UserTrackerPath.class },
186                     new ReadOnlyBeanHandler(model));
187 
188             return model;
189         }
190     }
191 
192     public Object clone() {
193         UserTrackerPathImpl clone = new UserTrackerPathImpl();
194 
195         clone.setUserTrackerPathId(getUserTrackerPathId());
196         clone.setUserTrackerId(getUserTrackerId());
197         clone.setPath(getPath());
198         clone.setPathDate(getPathDate());
199 
200         return clone;
201     }
202 
203     public int compareTo(Object obj) {
204         if (obj == null) {
205             return -1;
206         }
207 
208         UserTrackerPathImpl userTrackerPath = (UserTrackerPathImpl)obj;
209 
210         long pk = userTrackerPath.getPrimaryKey();
211 
212         if (getPrimaryKey() < pk) {
213             return -1;
214         }
215         else if (getPrimaryKey() > pk) {
216             return 1;
217         }
218         else {
219             return 0;
220         }
221     }
222 
223     public boolean equals(Object obj) {
224         if (obj == null) {
225             return false;
226         }
227 
228         UserTrackerPathImpl userTrackerPath = null;
229 
230         try {
231             userTrackerPath = (UserTrackerPathImpl)obj;
232         }
233         catch (ClassCastException cce) {
234             return false;
235         }
236 
237         long pk = userTrackerPath.getPrimaryKey();
238 
239         if (getPrimaryKey() == pk) {
240             return true;
241         }
242         else {
243             return false;
244         }
245     }
246 
247     public int hashCode() {
248         return (int)getPrimaryKey();
249     }
250 
251     private long _userTrackerPathId;
252     private long _userTrackerId;
253     private String _path;
254     private Date _pathDate;
255 }