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 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<UserTrackerPath> {
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 ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
81                  "value.object.entity.cache.enabled.com.liferay.portal.model.UserTrackerPath"),
82              true);
83      public static final boolean FINDER_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         _userTrackerPathId = userTrackerPathId;
133     }
134 
135     public long getUserTrackerId() {
136         return _userTrackerId;
137     }
138 
139     public void setUserTrackerId(long userTrackerId) {
140         _userTrackerId = userTrackerId;
141     }
142 
143     public String getPath() {
144         return GetterUtil.getString(_path);
145     }
146 
147     public void setPath(String path) {
148         _path = path;
149     }
150 
151     public Date getPathDate() {
152         return _pathDate;
153     }
154 
155     public void setPathDate(Date pathDate) {
156         _pathDate = pathDate;
157     }
158 
159     public UserTrackerPath toEscapedModel() {
160         if (isEscapedModel()) {
161             return (UserTrackerPath)this;
162         }
163         else {
164             UserTrackerPath model = new UserTrackerPathImpl();
165 
166             model.setNew(isNew());
167             model.setEscapedModel(true);
168 
169             model.setUserTrackerPathId(getUserTrackerPathId());
170             model.setUserTrackerId(getUserTrackerId());
171             model.setPath(HtmlUtil.escape(getPath()));
172             model.setPathDate(getPathDate());
173 
174             model = (UserTrackerPath)Proxy.newProxyInstance(UserTrackerPath.class.getClassLoader(),
175                     new Class[] { UserTrackerPath.class },
176                     new ReadOnlyBeanHandler(model));
177 
178             return model;
179         }
180     }
181 
182     public Object clone() {
183         UserTrackerPathImpl clone = new UserTrackerPathImpl();
184 
185         clone.setUserTrackerPathId(getUserTrackerPathId());
186         clone.setUserTrackerId(getUserTrackerId());
187         clone.setPath(getPath());
188         clone.setPathDate(getPathDate());
189 
190         return clone;
191     }
192 
193     public int compareTo(UserTrackerPath userTrackerPath) {
194         long pk = userTrackerPath.getPrimaryKey();
195 
196         if (getPrimaryKey() < pk) {
197             return -1;
198         }
199         else if (getPrimaryKey() > pk) {
200             return 1;
201         }
202         else {
203             return 0;
204         }
205     }
206 
207     public boolean equals(Object obj) {
208         if (obj == null) {
209             return false;
210         }
211 
212         UserTrackerPath userTrackerPath = null;
213 
214         try {
215             userTrackerPath = (UserTrackerPath)obj;
216         }
217         catch (ClassCastException cce) {
218             return false;
219         }
220 
221         long pk = userTrackerPath.getPrimaryKey();
222 
223         if (getPrimaryKey() == pk) {
224             return true;
225         }
226         else {
227             return false;
228         }
229     }
230 
231     public int hashCode() {
232         return (int)getPrimaryKey();
233     }
234 
235     public String toString() {
236         StringBuilder sb = new StringBuilder();
237 
238         sb.append("{userTrackerPathId=");
239         sb.append(getUserTrackerPathId());
240         sb.append(", userTrackerId=");
241         sb.append(getUserTrackerId());
242         sb.append(", path=");
243         sb.append(getPath());
244         sb.append(", pathDate=");
245         sb.append(getPathDate());
246         sb.append("}");
247 
248         return sb.toString();
249     }
250 
251     public String toXmlString() {
252         StringBuilder sb = new StringBuilder();
253 
254         sb.append("<model><model-name>");
255         sb.append("com.liferay.portal.model.UserTrackerPath");
256         sb.append("</model-name>");
257 
258         sb.append(
259             "<column><column-name>userTrackerPathId</column-name><column-value><![CDATA[");
260         sb.append(getUserTrackerPathId());
261         sb.append("]]></column-value></column>");
262         sb.append(
263             "<column><column-name>userTrackerId</column-name><column-value><![CDATA[");
264         sb.append(getUserTrackerId());
265         sb.append("]]></column-value></column>");
266         sb.append(
267             "<column><column-name>path</column-name><column-value><![CDATA[");
268         sb.append(getPath());
269         sb.append("]]></column-value></column>");
270         sb.append(
271             "<column><column-name>pathDate</column-name><column-value><![CDATA[");
272         sb.append(getPathDate());
273         sb.append("]]></column-value></column>");
274 
275         sb.append("</model>");
276 
277         return sb.toString();
278     }
279 
280     private long _userTrackerPathId;
281     private long _userTrackerId;
282     private String _path;
283     private Date _pathDate;
284 }