1
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
57 public class UserTrackerModelImpl extends BaseModelImpl {
58 public static String TABLE_NAME = "UserTracker";
59 public static Object[][] TABLE_COLUMNS = {
60 { "userTrackerId", new Integer(Types.BIGINT) },
61 { "companyId", new Integer(Types.BIGINT) },
62 { "userId", new Integer(Types.BIGINT) },
63 { "modifiedDate", new Integer(Types.TIMESTAMP) },
64 { "sessionId", new Integer(Types.VARCHAR) },
65 { "remoteAddr", new Integer(Types.VARCHAR) },
66 { "remoteHost", new Integer(Types.VARCHAR) },
67 { "userAgent", new Integer(Types.VARCHAR) }
68 };
69 public static String TABLE_SQL_CREATE = "create table UserTracker (userTrackerId LONG not null primary key,companyId LONG,userId LONG,modifiedDate DATE null,sessionId VARCHAR(200) null,remoteAddr VARCHAR(75) null,remoteHost VARCHAR(75) null,userAgent VARCHAR(200) null)";
70 public static String TABLE_SQL_DROP = "drop table UserTracker";
71 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
72 "xss.allow.com.liferay.portal.model.UserTracker"), XSS_ALLOW);
73 public static boolean XSS_ALLOW_SESSIONID = GetterUtil.getBoolean(PropsUtil.get(
74 "xss.allow.com.liferay.portal.model.UserTracker.sessionId"),
75 XSS_ALLOW_BY_MODEL);
76 public static boolean XSS_ALLOW_REMOTEADDR = GetterUtil.getBoolean(PropsUtil.get(
77 "xss.allow.com.liferay.portal.model.UserTracker.remoteAddr"),
78 XSS_ALLOW_BY_MODEL);
79 public static boolean XSS_ALLOW_REMOTEHOST = GetterUtil.getBoolean(PropsUtil.get(
80 "xss.allow.com.liferay.portal.model.UserTracker.remoteHost"),
81 XSS_ALLOW_BY_MODEL);
82 public static boolean XSS_ALLOW_USERAGENT = GetterUtil.getBoolean(PropsUtil.get(
83 "xss.allow.com.liferay.portal.model.UserTracker.userAgent"),
84 XSS_ALLOW_BY_MODEL);
85 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
86 "lock.expiration.time.com.liferay.portal.model.UserTrackerModel"));
87
88 public UserTrackerModelImpl() {
89 }
90
91 public long getPrimaryKey() {
92 return _userTrackerId;
93 }
94
95 public void setPrimaryKey(long pk) {
96 setUserTrackerId(pk);
97 }
98
99 public Serializable getPrimaryKeyObj() {
100 return new Long(_userTrackerId);
101 }
102
103 public long getUserTrackerId() {
104 return _userTrackerId;
105 }
106
107 public void setUserTrackerId(long userTrackerId) {
108 if (userTrackerId != _userTrackerId) {
109 _userTrackerId = userTrackerId;
110 }
111 }
112
113 public long getCompanyId() {
114 return _companyId;
115 }
116
117 public void setCompanyId(long companyId) {
118 if (companyId != _companyId) {
119 _companyId = companyId;
120 }
121 }
122
123 public long getUserId() {
124 return _userId;
125 }
126
127 public void setUserId(long userId) {
128 if (userId != _userId) {
129 _userId = userId;
130 }
131 }
132
133 public Date getModifiedDate() {
134 return _modifiedDate;
135 }
136
137 public void setModifiedDate(Date modifiedDate) {
138 if (((modifiedDate == null) && (_modifiedDate != null)) ||
139 ((modifiedDate != null) && (_modifiedDate == null)) ||
140 ((modifiedDate != null) && (_modifiedDate != null) &&
141 !modifiedDate.equals(_modifiedDate))) {
142 _modifiedDate = modifiedDate;
143 }
144 }
145
146 public String getSessionId() {
147 return GetterUtil.getString(_sessionId);
148 }
149
150 public void setSessionId(String sessionId) {
151 if (((sessionId == null) && (_sessionId != null)) ||
152 ((sessionId != null) && (_sessionId == null)) ||
153 ((sessionId != null) && (_sessionId != null) &&
154 !sessionId.equals(_sessionId))) {
155 if (!XSS_ALLOW_SESSIONID) {
156 sessionId = XSSUtil.strip(sessionId);
157 }
158
159 _sessionId = sessionId;
160 }
161 }
162
163 public String getRemoteAddr() {
164 return GetterUtil.getString(_remoteAddr);
165 }
166
167 public void setRemoteAddr(String remoteAddr) {
168 if (((remoteAddr == null) && (_remoteAddr != null)) ||
169 ((remoteAddr != null) && (_remoteAddr == null)) ||
170 ((remoteAddr != null) && (_remoteAddr != null) &&
171 !remoteAddr.equals(_remoteAddr))) {
172 if (!XSS_ALLOW_REMOTEADDR) {
173 remoteAddr = XSSUtil.strip(remoteAddr);
174 }
175
176 _remoteAddr = remoteAddr;
177 }
178 }
179
180 public String getRemoteHost() {
181 return GetterUtil.getString(_remoteHost);
182 }
183
184 public void setRemoteHost(String remoteHost) {
185 if (((remoteHost == null) && (_remoteHost != null)) ||
186 ((remoteHost != null) && (_remoteHost == null)) ||
187 ((remoteHost != null) && (_remoteHost != null) &&
188 !remoteHost.equals(_remoteHost))) {
189 if (!XSS_ALLOW_REMOTEHOST) {
190 remoteHost = XSSUtil.strip(remoteHost);
191 }
192
193 _remoteHost = remoteHost;
194 }
195 }
196
197 public String getUserAgent() {
198 return GetterUtil.getString(_userAgent);
199 }
200
201 public void setUserAgent(String userAgent) {
202 if (((userAgent == null) && (_userAgent != null)) ||
203 ((userAgent != null) && (_userAgent == null)) ||
204 ((userAgent != null) && (_userAgent != null) &&
205 !userAgent.equals(_userAgent))) {
206 if (!XSS_ALLOW_USERAGENT) {
207 userAgent = XSSUtil.strip(userAgent);
208 }
209
210 _userAgent = userAgent;
211 }
212 }
213
214 public Object clone() {
215 UserTrackerImpl clone = new UserTrackerImpl();
216 clone.setUserTrackerId(getUserTrackerId());
217 clone.setCompanyId(getCompanyId());
218 clone.setUserId(getUserId());
219 clone.setModifiedDate(getModifiedDate());
220 clone.setSessionId(getSessionId());
221 clone.setRemoteAddr(getRemoteAddr());
222 clone.setRemoteHost(getRemoteHost());
223 clone.setUserAgent(getUserAgent());
224
225 return clone;
226 }
227
228 public int compareTo(Object obj) {
229 if (obj == null) {
230 return -1;
231 }
232
233 UserTrackerImpl userTracker = (UserTrackerImpl)obj;
234 long pk = userTracker.getPrimaryKey();
235
236 if (getPrimaryKey() < pk) {
237 return -1;
238 }
239 else if (getPrimaryKey() > pk) {
240 return 1;
241 }
242 else {
243 return 0;
244 }
245 }
246
247 public boolean equals(Object obj) {
248 if (obj == null) {
249 return false;
250 }
251
252 UserTrackerImpl userTracker = null;
253
254 try {
255 userTracker = (UserTrackerImpl)obj;
256 }
257 catch (ClassCastException cce) {
258 return false;
259 }
260
261 long pk = userTracker.getPrimaryKey();
262
263 if (getPrimaryKey() == pk) {
264 return true;
265 }
266 else {
267 return false;
268 }
269 }
270
271 public int hashCode() {
272 return (int)getPrimaryKey();
273 }
274
275 private long _userTrackerId;
276 private long _companyId;
277 private long _userId;
278 private Date _modifiedDate;
279 private String _sessionId;
280 private String _remoteAddr;
281 private String _remoteHost;
282 private String _userAgent;
283 }