1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.model.impl;
21  
22  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23  import com.liferay.portal.kernel.util.GetterUtil;
24  import com.liferay.portal.kernel.util.HtmlUtil;
25  import com.liferay.portal.model.UserTrackerPath;
26  import com.liferay.portal.model.UserTrackerPathSoap;
27  
28  import com.liferay.portlet.expando.model.ExpandoBridge;
29  import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
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 ExpandoBridge getExpandoBridge() {
183         if (_expandoBridge == null) {
184             _expandoBridge = new ExpandoBridgeImpl(UserTrackerPath.class.getName(),
185                     getPrimaryKey());
186         }
187 
188         return _expandoBridge;
189     }
190 
191     public Object clone() {
192         UserTrackerPathImpl clone = new UserTrackerPathImpl();
193 
194         clone.setUserTrackerPathId(getUserTrackerPathId());
195         clone.setUserTrackerId(getUserTrackerId());
196         clone.setPath(getPath());
197         clone.setPathDate(getPathDate());
198 
199         return clone;
200     }
201 
202     public int compareTo(UserTrackerPath userTrackerPath) {
203         long pk = userTrackerPath.getPrimaryKey();
204 
205         if (getPrimaryKey() < pk) {
206             return -1;
207         }
208         else if (getPrimaryKey() > pk) {
209             return 1;
210         }
211         else {
212             return 0;
213         }
214     }
215 
216     public boolean equals(Object obj) {
217         if (obj == null) {
218             return false;
219         }
220 
221         UserTrackerPath userTrackerPath = null;
222 
223         try {
224             userTrackerPath = (UserTrackerPath)obj;
225         }
226         catch (ClassCastException cce) {
227             return false;
228         }
229 
230         long pk = userTrackerPath.getPrimaryKey();
231 
232         if (getPrimaryKey() == pk) {
233             return true;
234         }
235         else {
236             return false;
237         }
238     }
239 
240     public int hashCode() {
241         return (int)getPrimaryKey();
242     }
243 
244     public String toString() {
245         StringBuilder sb = new StringBuilder();
246 
247         sb.append("{userTrackerPathId=");
248         sb.append(getUserTrackerPathId());
249         sb.append(", userTrackerId=");
250         sb.append(getUserTrackerId());
251         sb.append(", path=");
252         sb.append(getPath());
253         sb.append(", pathDate=");
254         sb.append(getPathDate());
255         sb.append("}");
256 
257         return sb.toString();
258     }
259 
260     public String toXmlString() {
261         StringBuilder sb = new StringBuilder();
262 
263         sb.append("<model><model-name>");
264         sb.append("com.liferay.portal.model.UserTrackerPath");
265         sb.append("</model-name>");
266 
267         sb.append(
268             "<column><column-name>userTrackerPathId</column-name><column-value><![CDATA[");
269         sb.append(getUserTrackerPathId());
270         sb.append("]]></column-value></column>");
271         sb.append(
272             "<column><column-name>userTrackerId</column-name><column-value><![CDATA[");
273         sb.append(getUserTrackerId());
274         sb.append("]]></column-value></column>");
275         sb.append(
276             "<column><column-name>path</column-name><column-value><![CDATA[");
277         sb.append(getPath());
278         sb.append("]]></column-value></column>");
279         sb.append(
280             "<column><column-name>pathDate</column-name><column-value><![CDATA[");
281         sb.append(getPathDate());
282         sb.append("]]></column-value></column>");
283 
284         sb.append("</model>");
285 
286         return sb.toString();
287     }
288 
289     private long _userTrackerPathId;
290     private long _userTrackerId;
291     private String _path;
292     private Date _pathDate;
293     private transient ExpandoBridge _expandoBridge;
294 }