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