1   /**
2    * Copyright (c) 2000-2007 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.util.GetterUtil;
26  import com.liferay.portal.model.impl.BaseModelImpl;
27  import com.liferay.portal.util.PropsUtil;
28  
29  import com.liferay.util.XSSUtil;
30  
31  import java.io.Serializable;
32  
33  import java.sql.Types;
34  
35  import java.util.Date;
36  
37  /**
38   * <a href="UserTrackerPathModelImpl.java.html"><b><i>View Source</i></b></a>
39   *
40   * <p>
41   * ServiceBuilder generated this class. Modifications in this class will be overwritten
42   * the next time is generated.
43   * </p>
44   *
45   * <p>
46   * This class is a model that represents the <code>UserTrackerPath</code> table
47   * in the database.
48   * </p>
49   *
50   * @author Brian Wing Shun Chan
51   *
52   * @see com.liferay.portal.service.model.UserTrackerPath
53   * @see com.liferay.portal.service.model.UserTrackerPathModel
54   * @see com.liferay.portal.service.model.impl.UserTrackerPathImpl
55   *
56   */
57  public class UserTrackerPathModelImpl extends BaseModelImpl {
58      public static String TABLE_NAME = "UserTrackerPath";
59      public static 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 String TABLE_SQL_CREATE = "create table UserTrackerPath (userTrackerPathId LONG not null primary key,userTrackerId LONG,path_ STRING null,pathDate DATE null)";
66      public static String TABLE_SQL_DROP = "drop table UserTrackerPath";
67      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
68                  "xss.allow.com.liferay.portal.model.UserTrackerPath"), XSS_ALLOW);
69      public static boolean XSS_ALLOW_PATH = GetterUtil.getBoolean(PropsUtil.get(
70                  "xss.allow.com.liferay.portal.model.UserTrackerPath.path"),
71              XSS_ALLOW_BY_MODEL);
72      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
73                  "lock.expiration.time.com.liferay.portal.model.UserTrackerPathModel"));
74  
75      public UserTrackerPathModelImpl() {
76      }
77  
78      public long getPrimaryKey() {
79          return _userTrackerPathId;
80      }
81  
82      public void setPrimaryKey(long pk) {
83          setUserTrackerPathId(pk);
84      }
85  
86      public Serializable getPrimaryKeyObj() {
87          return new Long(_userTrackerPathId);
88      }
89  
90      public long getUserTrackerPathId() {
91          return _userTrackerPathId;
92      }
93  
94      public void setUserTrackerPathId(long userTrackerPathId) {
95          if (userTrackerPathId != _userTrackerPathId) {
96              _userTrackerPathId = userTrackerPathId;
97          }
98      }
99  
100     public long getUserTrackerId() {
101         return _userTrackerId;
102     }
103 
104     public void setUserTrackerId(long userTrackerId) {
105         if (userTrackerId != _userTrackerId) {
106             _userTrackerId = userTrackerId;
107         }
108     }
109 
110     public String getPath() {
111         return GetterUtil.getString(_path);
112     }
113 
114     public void setPath(String path) {
115         if (((path == null) && (_path != null)) ||
116                 ((path != null) && (_path == null)) ||
117                 ((path != null) && (_path != null) && !path.equals(_path))) {
118             if (!XSS_ALLOW_PATH) {
119                 path = XSSUtil.strip(path);
120             }
121 
122             _path = path;
123         }
124     }
125 
126     public Date getPathDate() {
127         return _pathDate;
128     }
129 
130     public void setPathDate(Date pathDate) {
131         if (((pathDate == null) && (_pathDate != null)) ||
132                 ((pathDate != null) && (_pathDate == null)) ||
133                 ((pathDate != null) && (_pathDate != null) &&
134                 !pathDate.equals(_pathDate))) {
135             _pathDate = pathDate;
136         }
137     }
138 
139     public Object clone() {
140         UserTrackerPathImpl clone = new UserTrackerPathImpl();
141         clone.setUserTrackerPathId(getUserTrackerPathId());
142         clone.setUserTrackerId(getUserTrackerId());
143         clone.setPath(getPath());
144         clone.setPathDate(getPathDate());
145 
146         return clone;
147     }
148 
149     public int compareTo(Object obj) {
150         if (obj == null) {
151             return -1;
152         }
153 
154         UserTrackerPathImpl userTrackerPath = (UserTrackerPathImpl)obj;
155         long pk = userTrackerPath.getPrimaryKey();
156 
157         if (getPrimaryKey() < pk) {
158             return -1;
159         }
160         else if (getPrimaryKey() > pk) {
161             return 1;
162         }
163         else {
164             return 0;
165         }
166     }
167 
168     public boolean equals(Object obj) {
169         if (obj == null) {
170             return false;
171         }
172 
173         UserTrackerPathImpl userTrackerPath = null;
174 
175         try {
176             userTrackerPath = (UserTrackerPathImpl)obj;
177         }
178         catch (ClassCastException cce) {
179             return false;
180         }
181 
182         long pk = userTrackerPath.getPrimaryKey();
183 
184         if (getPrimaryKey() == pk) {
185             return true;
186         }
187         else {
188             return false;
189         }
190     }
191 
192     public int hashCode() {
193         return (int)getPrimaryKey();
194     }
195 
196     private long _userTrackerPathId;
197     private long _userTrackerId;
198     private String _path;
199     private Date _pathDate;
200 }