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