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<UserTrackerPath> {
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 ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
84                  "value.object.entity.cache.enabled.com.liferay.portal.model.UserTrackerPath"),
85              true);
86      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
87                  "value.object.finder.cache.enabled.com.liferay.portal.model.UserTrackerPath"),
88              true);
89  
90      public static UserTrackerPath toModel(UserTrackerPathSoap soapModel) {
91          UserTrackerPath model = new UserTrackerPathImpl();
92  
93          model.setUserTrackerPathId(soapModel.getUserTrackerPathId());
94          model.setUserTrackerId(soapModel.getUserTrackerId());
95          model.setPath(soapModel.getPath());
96          model.setPathDate(soapModel.getPathDate());
97  
98          return model;
99      }
100 
101     public static List<UserTrackerPath> toModels(
102         UserTrackerPathSoap[] soapModels) {
103         List<UserTrackerPath> models = new ArrayList<UserTrackerPath>(soapModels.length);
104 
105         for (UserTrackerPathSoap soapModel : soapModels) {
106             models.add(toModel(soapModel));
107         }
108 
109         return models;
110     }
111 
112     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
113                 "lock.expiration.time.com.liferay.portal.model.UserTrackerPath"));
114 
115     public UserTrackerPathModelImpl() {
116     }
117 
118     public long getPrimaryKey() {
119         return _userTrackerPathId;
120     }
121 
122     public void setPrimaryKey(long pk) {
123         setUserTrackerPathId(pk);
124     }
125 
126     public Serializable getPrimaryKeyObj() {
127         return new Long(_userTrackerPathId);
128     }
129 
130     public long getUserTrackerPathId() {
131         return _userTrackerPathId;
132     }
133 
134     public void setUserTrackerPathId(long userTrackerPathId) {
135         _userTrackerPathId = userTrackerPathId;
136     }
137 
138     public long getUserTrackerId() {
139         return _userTrackerId;
140     }
141 
142     public void setUserTrackerId(long userTrackerId) {
143         _userTrackerId = userTrackerId;
144     }
145 
146     public String getPath() {
147         return GetterUtil.getString(_path);
148     }
149 
150     public void setPath(String path) {
151         _path = path;
152     }
153 
154     public Date getPathDate() {
155         return _pathDate;
156     }
157 
158     public void setPathDate(Date pathDate) {
159         _pathDate = pathDate;
160     }
161 
162     public UserTrackerPath toEscapedModel() {
163         if (isEscapedModel()) {
164             return (UserTrackerPath)this;
165         }
166         else {
167             UserTrackerPath model = new UserTrackerPathImpl();
168 
169             model.setNew(isNew());
170             model.setEscapedModel(true);
171 
172             model.setUserTrackerPathId(getUserTrackerPathId());
173             model.setUserTrackerId(getUserTrackerId());
174             model.setPath(HtmlUtil.escape(getPath()));
175             model.setPathDate(getPathDate());
176 
177             model = (UserTrackerPath)Proxy.newProxyInstance(UserTrackerPath.class.getClassLoader(),
178                     new Class[] { UserTrackerPath.class },
179                     new ReadOnlyBeanHandler(model));
180 
181             return model;
182         }
183     }
184 
185     public ExpandoBridge getExpandoBridge() {
186         if (_expandoBridge == null) {
187             _expandoBridge = new ExpandoBridgeImpl(UserTrackerPath.class.getName(),
188                     getPrimaryKey());
189         }
190 
191         return _expandoBridge;
192     }
193 
194     public Object clone() {
195         UserTrackerPathImpl clone = new UserTrackerPathImpl();
196 
197         clone.setUserTrackerPathId(getUserTrackerPathId());
198         clone.setUserTrackerId(getUserTrackerId());
199         clone.setPath(getPath());
200         clone.setPathDate(getPathDate());
201 
202         return clone;
203     }
204 
205     public int compareTo(UserTrackerPath userTrackerPath) {
206         long pk = userTrackerPath.getPrimaryKey();
207 
208         if (getPrimaryKey() < pk) {
209             return -1;
210         }
211         else if (getPrimaryKey() > pk) {
212             return 1;
213         }
214         else {
215             return 0;
216         }
217     }
218 
219     public boolean equals(Object obj) {
220         if (obj == null) {
221             return false;
222         }
223 
224         UserTrackerPath userTrackerPath = null;
225 
226         try {
227             userTrackerPath = (UserTrackerPath)obj;
228         }
229         catch (ClassCastException cce) {
230             return false;
231         }
232 
233         long pk = userTrackerPath.getPrimaryKey();
234 
235         if (getPrimaryKey() == pk) {
236             return true;
237         }
238         else {
239             return false;
240         }
241     }
242 
243     public int hashCode() {
244         return (int)getPrimaryKey();
245     }
246 
247     public String toString() {
248         StringBuilder sb = new StringBuilder();
249 
250         sb.append("{userTrackerPathId=");
251         sb.append(getUserTrackerPathId());
252         sb.append(", userTrackerId=");
253         sb.append(getUserTrackerId());
254         sb.append(", path=");
255         sb.append(getPath());
256         sb.append(", pathDate=");
257         sb.append(getPathDate());
258         sb.append("}");
259 
260         return sb.toString();
261     }
262 
263     public String toXmlString() {
264         StringBuilder sb = new StringBuilder();
265 
266         sb.append("<model><model-name>");
267         sb.append("com.liferay.portal.model.UserTrackerPath");
268         sb.append("</model-name>");
269 
270         sb.append(
271             "<column><column-name>userTrackerPathId</column-name><column-value><![CDATA[");
272         sb.append(getUserTrackerPathId());
273         sb.append("]]></column-value></column>");
274         sb.append(
275             "<column><column-name>userTrackerId</column-name><column-value><![CDATA[");
276         sb.append(getUserTrackerId());
277         sb.append("]]></column-value></column>");
278         sb.append(
279             "<column><column-name>path</column-name><column-value><![CDATA[");
280         sb.append(getPath());
281         sb.append("]]></column-value></column>");
282         sb.append(
283             "<column><column-name>pathDate</column-name><column-value><![CDATA[");
284         sb.append(getPathDate());
285         sb.append("]]></column-value></column>");
286 
287         sb.append("</model>");
288 
289         return sb.toString();
290     }
291 
292     private long _userTrackerPathId;
293     private long _userTrackerId;
294     private String _path;
295     private Date _pathDate;
296     private transient ExpandoBridge _expandoBridge;
297 }