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  import com.liferay.portal.util.PropsUtil;
31  
32  import java.io.Serializable;
33  
34  import java.lang.reflect.Proxy;
35  
36  import java.sql.Types;
37  
38  import java.util.ArrayList;
39  import java.util.Date;
40  import java.util.List;
41  
42  /**
43   * <a href="UserTrackerPathModelImpl.java.html"><b><i>View Source</i></b></a>
44   *
45   * <p>
46   * ServiceBuilder generated this class. Modifications in this class will be
47   * overwritten the next time is generated.
48   * </p>
49   *
50   * <p>
51   * This class is a model that represents the <code>UserTrackerPath</code> table
52   * in the database.
53   * </p>
54   *
55   * @author Brian Wing Shun Chan
56   *
57   * @see com.liferay.portal.service.model.UserTrackerPath
58   * @see com.liferay.portal.service.model.UserTrackerPathModel
59   * @see com.liferay.portal.service.model.impl.UserTrackerPathImpl
60   *
61   */
62  public class UserTrackerPathModelImpl extends BaseModelImpl {
63      public static final String TABLE_NAME = "UserTrackerPath";
64      public static final Object[][] TABLE_COLUMNS = {
65              { "userTrackerPathId", new Integer(Types.BIGINT) },
66              
67  
68              { "userTrackerId", new Integer(Types.BIGINT) },
69              
70  
71              { "path_", new Integer(Types.VARCHAR) },
72              
73  
74              { "pathDate", new Integer(Types.TIMESTAMP) }
75          };
76      public static final String TABLE_SQL_CREATE = "create table UserTrackerPath (userTrackerPathId LONG not null primary key,userTrackerId LONG,path_ STRING null,pathDate DATE null)";
77      public static final String TABLE_SQL_DROP = "drop table UserTrackerPath";
78      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
79                  "value.object.finder.cache.enabled.com.liferay.portal.model.UserTrackerPath"),
80              true);
81  
82      public static UserTrackerPath toModel(UserTrackerPathSoap soapModel) {
83          UserTrackerPath model = new UserTrackerPathImpl();
84  
85          model.setUserTrackerPathId(soapModel.getUserTrackerPathId());
86          model.setUserTrackerId(soapModel.getUserTrackerId());
87          model.setPath(soapModel.getPath());
88          model.setPathDate(soapModel.getPathDate());
89  
90          return model;
91      }
92  
93      public static List<UserTrackerPath> toModels(
94          UserTrackerPathSoap[] soapModels) {
95          List<UserTrackerPath> models = new ArrayList<UserTrackerPath>(soapModels.length);
96  
97          for (UserTrackerPathSoap soapModel : soapModels) {
98              models.add(toModel(soapModel));
99          }
100 
101         return models;
102     }
103 
104     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
105                 "lock.expiration.time.com.liferay.portal.model.UserTrackerPath"));
106 
107     public UserTrackerPathModelImpl() {
108     }
109 
110     public long getPrimaryKey() {
111         return _userTrackerPathId;
112     }
113 
114     public void setPrimaryKey(long pk) {
115         setUserTrackerPathId(pk);
116     }
117 
118     public Serializable getPrimaryKeyObj() {
119         return new Long(_userTrackerPathId);
120     }
121 
122     public long getUserTrackerPathId() {
123         return _userTrackerPathId;
124     }
125 
126     public void setUserTrackerPathId(long userTrackerPathId) {
127         if (userTrackerPathId != _userTrackerPathId) {
128             _userTrackerPathId = userTrackerPathId;
129         }
130     }
131 
132     public long getUserTrackerId() {
133         return _userTrackerId;
134     }
135 
136     public void setUserTrackerId(long userTrackerId) {
137         if (userTrackerId != _userTrackerId) {
138             _userTrackerId = userTrackerId;
139         }
140     }
141 
142     public String getPath() {
143         return GetterUtil.getString(_path);
144     }
145 
146     public void setPath(String path) {
147         if (((path == null) && (_path != null)) ||
148                 ((path != null) && (_path == null)) ||
149                 ((path != null) && (_path != null) && !path.equals(_path))) {
150             _path = path;
151         }
152     }
153 
154     public Date getPathDate() {
155         return _pathDate;
156     }
157 
158     public void setPathDate(Date pathDate) {
159         if (((pathDate == null) && (_pathDate != null)) ||
160                 ((pathDate != null) && (_pathDate == null)) ||
161                 ((pathDate != null) && (_pathDate != null) &&
162                 !pathDate.equals(_pathDate))) {
163             _pathDate = pathDate;
164         }
165     }
166 
167     public UserTrackerPath toEscapedModel() {
168         if (isEscapedModel()) {
169             return (UserTrackerPath)this;
170         }
171         else {
172             UserTrackerPath model = new UserTrackerPathImpl();
173 
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 }