1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.model.impl;
16  
17  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
18  import com.liferay.portal.kernel.util.GetterUtil;
19  import com.liferay.portal.kernel.util.HtmlUtil;
20  import com.liferay.portal.kernel.util.StringBundler;
21  import com.liferay.portal.model.UserTrackerPath;
22  import com.liferay.portal.model.UserTrackerPathSoap;
23  import com.liferay.portal.service.ServiceContext;
24  
25  import com.liferay.portlet.expando.model.ExpandoBridge;
26  import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
27  
28  import java.io.Serializable;
29  
30  import java.lang.reflect.Proxy;
31  
32  import java.sql.Types;
33  
34  import java.util.ArrayList;
35  import java.util.Date;
36  import java.util.List;
37  
38  /**
39   * <a href="UserTrackerPathModelImpl.java.html"><b><i>View Source</i></b></a>
40   *
41   * <p>
42   * ServiceBuilder generated this class. Modifications in this class will be
43   * overwritten the next time is generated.
44   * </p>
45   *
46   * <p>
47   * This interface is a model that represents the UserTrackerPath table in the
48   * database.
49   * </p>
50   *
51   * @author    Brian Wing Shun Chan
52   * @see       UserTrackerPathImpl
53   * @see       com.liferay.portal.model.UserTrackerPath
54   * @see       com.liferay.portal.model.UserTrackerPathModel
55   * @generated
56   */
57  public class UserTrackerPathModelImpl extends BaseModelImpl<UserTrackerPath> {
58      public static final String TABLE_NAME = "UserTrackerPath";
59      public static final Object[][] TABLE_COLUMNS = {
60              { "userTrackerPathId", new Integer(Types.BIGINT) },
61              { "userTrackerId", new Integer(Types.BIGINT) },
62              { "path_", new Integer(Types.VARCHAR) },
63              { "pathDate", new Integer(Types.TIMESTAMP) }
64          };
65      public static final String TABLE_SQL_CREATE = "create table UserTrackerPath (userTrackerPathId LONG not null primary key,userTrackerId LONG,path_ STRING null,pathDate DATE null)";
66      public static final String TABLE_SQL_DROP = "drop table UserTrackerPath";
67      public static final String DATA_SOURCE = "liferayDataSource";
68      public static final String SESSION_FACTORY = "liferaySessionFactory";
69      public static final String TX_MANAGER = "liferayTransactionManager";
70      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
71                  "value.object.entity.cache.enabled.com.liferay.portal.model.UserTrackerPath"),
72              true);
73      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
74                  "value.object.finder.cache.enabled.com.liferay.portal.model.UserTrackerPath"),
75              true);
76  
77      public static UserTrackerPath toModel(UserTrackerPathSoap soapModel) {
78          UserTrackerPath model = new UserTrackerPathImpl();
79  
80          model.setUserTrackerPathId(soapModel.getUserTrackerPathId());
81          model.setUserTrackerId(soapModel.getUserTrackerId());
82          model.setPath(soapModel.getPath());
83          model.setPathDate(soapModel.getPathDate());
84  
85          return model;
86      }
87  
88      public static List<UserTrackerPath> toModels(
89          UserTrackerPathSoap[] soapModels) {
90          List<UserTrackerPath> models = new ArrayList<UserTrackerPath>(soapModels.length);
91  
92          for (UserTrackerPathSoap soapModel : soapModels) {
93              models.add(toModel(soapModel));
94          }
95  
96          return models;
97      }
98  
99      public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
100                 "lock.expiration.time.com.liferay.portal.model.UserTrackerPath"));
101 
102     public UserTrackerPathModelImpl() {
103     }
104 
105     public long getPrimaryKey() {
106         return _userTrackerPathId;
107     }
108 
109     public void setPrimaryKey(long pk) {
110         setUserTrackerPathId(pk);
111     }
112 
113     public Serializable getPrimaryKeyObj() {
114         return new Long(_userTrackerPathId);
115     }
116 
117     public long getUserTrackerPathId() {
118         return _userTrackerPathId;
119     }
120 
121     public void setUserTrackerPathId(long userTrackerPathId) {
122         _userTrackerPathId = userTrackerPathId;
123     }
124 
125     public long getUserTrackerId() {
126         return _userTrackerId;
127     }
128 
129     public void setUserTrackerId(long userTrackerId) {
130         _userTrackerId = userTrackerId;
131     }
132 
133     public String getPath() {
134         return GetterUtil.getString(_path);
135     }
136 
137     public void setPath(String path) {
138         _path = path;
139     }
140 
141     public Date getPathDate() {
142         return _pathDate;
143     }
144 
145     public void setPathDate(Date pathDate) {
146         _pathDate = pathDate;
147     }
148 
149     public UserTrackerPath toEscapedModel() {
150         if (isEscapedModel()) {
151             return (UserTrackerPath)this;
152         }
153         else {
154             UserTrackerPath model = new UserTrackerPathImpl();
155 
156             model.setNew(isNew());
157             model.setEscapedModel(true);
158 
159             model.setUserTrackerPathId(getUserTrackerPathId());
160             model.setUserTrackerId(getUserTrackerId());
161             model.setPath(HtmlUtil.escape(getPath()));
162             model.setPathDate(getPathDate());
163 
164             model = (UserTrackerPath)Proxy.newProxyInstance(UserTrackerPath.class.getClassLoader(),
165                     new Class[] { UserTrackerPath.class },
166                     new ReadOnlyBeanHandler(model));
167 
168             return model;
169         }
170     }
171 
172     public ExpandoBridge getExpandoBridge() {
173         if (_expandoBridge == null) {
174             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
175                     UserTrackerPath.class.getName(), getPrimaryKey());
176         }
177 
178         return _expandoBridge;
179     }
180 
181     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
182         getExpandoBridge().setAttributes(serviceContext);
183     }
184 
185     public Object clone() {
186         UserTrackerPathImpl clone = new UserTrackerPathImpl();
187 
188         clone.setUserTrackerPathId(getUserTrackerPathId());
189         clone.setUserTrackerId(getUserTrackerId());
190         clone.setPath(getPath());
191         clone.setPathDate(getPathDate());
192 
193         return clone;
194     }
195 
196     public int compareTo(UserTrackerPath userTrackerPath) {
197         long pk = userTrackerPath.getPrimaryKey();
198 
199         if (getPrimaryKey() < pk) {
200             return -1;
201         }
202         else if (getPrimaryKey() > pk) {
203             return 1;
204         }
205         else {
206             return 0;
207         }
208     }
209 
210     public boolean equals(Object obj) {
211         if (obj == null) {
212             return false;
213         }
214 
215         UserTrackerPath userTrackerPath = null;
216 
217         try {
218             userTrackerPath = (UserTrackerPath)obj;
219         }
220         catch (ClassCastException cce) {
221             return false;
222         }
223 
224         long pk = userTrackerPath.getPrimaryKey();
225 
226         if (getPrimaryKey() == pk) {
227             return true;
228         }
229         else {
230             return false;
231         }
232     }
233 
234     public int hashCode() {
235         return (int)getPrimaryKey();
236     }
237 
238     public String toString() {
239         StringBundler sb = new StringBundler(9);
240 
241         sb.append("{userTrackerPathId=");
242         sb.append(getUserTrackerPathId());
243         sb.append(", userTrackerId=");
244         sb.append(getUserTrackerId());
245         sb.append(", path=");
246         sb.append(getPath());
247         sb.append(", pathDate=");
248         sb.append(getPathDate());
249         sb.append("}");
250 
251         return sb.toString();
252     }
253 
254     public String toXmlString() {
255         StringBundler sb = new StringBundler(16);
256 
257         sb.append("<model><model-name>");
258         sb.append("com.liferay.portal.model.UserTrackerPath");
259         sb.append("</model-name>");
260 
261         sb.append(
262             "<column><column-name>userTrackerPathId</column-name><column-value><![CDATA[");
263         sb.append(getUserTrackerPathId());
264         sb.append("]]></column-value></column>");
265         sb.append(
266             "<column><column-name>userTrackerId</column-name><column-value><![CDATA[");
267         sb.append(getUserTrackerId());
268         sb.append("]]></column-value></column>");
269         sb.append(
270             "<column><column-name>path</column-name><column-value><![CDATA[");
271         sb.append(getPath());
272         sb.append("]]></column-value></column>");
273         sb.append(
274             "<column><column-name>pathDate</column-name><column-value><![CDATA[");
275         sb.append(getPathDate());
276         sb.append("]]></column-value></column>");
277 
278         sb.append("</model>");
279 
280         return sb.toString();
281     }
282 
283     private long _userTrackerPathId;
284     private long _userTrackerId;
285     private String _path;
286     private Date _pathDate;
287     private transient ExpandoBridge _expandoBridge;
288 }