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