001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.model.UserTracker;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.util.Html;
029:
030: import java.io.Serializable;
031:
032: import java.lang.reflect.Proxy;
033:
034: import java.sql.Types;
035:
036: import java.util.Date;
037:
038: /**
039: * <a href="UserTrackerModelImpl.java.html"><b><i>View Source</i></b></a>
040: *
041: * <p>
042: * ServiceBuilder generated this class. Modifications in this class will be
043: * overwritten the next time is generated.
044: * </p>
045: *
046: * <p>
047: * This class is a model that represents the <code>UserTracker</code> table
048: * in the database.
049: * </p>
050: *
051: * @author Brian Wing Shun Chan
052: *
053: * @see com.liferay.portal.service.model.UserTracker
054: * @see com.liferay.portal.service.model.UserTrackerModel
055: * @see com.liferay.portal.service.model.impl.UserTrackerImpl
056: *
057: */
058: public class UserTrackerModelImpl extends BaseModelImpl {
059: public static final String TABLE_NAME = "UserTracker";
060: public static final Object[][] TABLE_COLUMNS = {
061: { "userTrackerId", new Integer(Types.BIGINT) },
062:
063: { "companyId", new Integer(Types.BIGINT) },
064:
065: { "userId", new Integer(Types.BIGINT) },
066:
067: { "modifiedDate", new Integer(Types.TIMESTAMP) },
068:
069: { "sessionId", new Integer(Types.VARCHAR) },
070:
071: { "remoteAddr", new Integer(Types.VARCHAR) },
072:
073: { "remoteHost", new Integer(Types.VARCHAR) },
074:
075: { "userAgent", new Integer(Types.VARCHAR) } };
076: public static final 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)";
077: public static final String TABLE_SQL_DROP = "drop table UserTracker";
078: public static final boolean CACHE_ENABLED = GetterUtil
079: .getBoolean(
080: PropsUtil
081: .get("value.object.finder.cache.enabled.com.liferay.portal.model.UserTracker"),
082: true);
083: public static final long LOCK_EXPIRATION_TIME = GetterUtil
084: .getLong(PropsUtil
085: .get("lock.expiration.time.com.liferay.portal.model.UserTracker"));
086:
087: public UserTrackerModelImpl() {
088: }
089:
090: public long getPrimaryKey() {
091: return _userTrackerId;
092: }
093:
094: public void setPrimaryKey(long pk) {
095: setUserTrackerId(pk);
096: }
097:
098: public Serializable getPrimaryKeyObj() {
099: return new Long(_userTrackerId);
100: }
101:
102: public long getUserTrackerId() {
103: return _userTrackerId;
104: }
105:
106: public void setUserTrackerId(long userTrackerId) {
107: if (userTrackerId != _userTrackerId) {
108: _userTrackerId = userTrackerId;
109: }
110: }
111:
112: public long getCompanyId() {
113: return _companyId;
114: }
115:
116: public void setCompanyId(long companyId) {
117: if (companyId != _companyId) {
118: _companyId = companyId;
119: }
120: }
121:
122: public long getUserId() {
123: return _userId;
124: }
125:
126: public void setUserId(long userId) {
127: if (userId != _userId) {
128: _userId = userId;
129: }
130: }
131:
132: public Date getModifiedDate() {
133: return _modifiedDate;
134: }
135:
136: public void setModifiedDate(Date modifiedDate) {
137: if (((modifiedDate == null) && (_modifiedDate != null))
138: || ((modifiedDate != null) && (_modifiedDate == null))
139: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
140: .equals(_modifiedDate))) {
141: _modifiedDate = modifiedDate;
142: }
143: }
144:
145: public String getSessionId() {
146: return GetterUtil.getString(_sessionId);
147: }
148:
149: public void setSessionId(String sessionId) {
150: if (((sessionId == null) && (_sessionId != null))
151: || ((sessionId != null) && (_sessionId == null))
152: || ((sessionId != null) && (_sessionId != null) && !sessionId
153: .equals(_sessionId))) {
154: _sessionId = sessionId;
155: }
156: }
157:
158: public String getRemoteAddr() {
159: return GetterUtil.getString(_remoteAddr);
160: }
161:
162: public void setRemoteAddr(String remoteAddr) {
163: if (((remoteAddr == null) && (_remoteAddr != null))
164: || ((remoteAddr != null) && (_remoteAddr == null))
165: || ((remoteAddr != null) && (_remoteAddr != null) && !remoteAddr
166: .equals(_remoteAddr))) {
167: _remoteAddr = remoteAddr;
168: }
169: }
170:
171: public String getRemoteHost() {
172: return GetterUtil.getString(_remoteHost);
173: }
174:
175: public void setRemoteHost(String remoteHost) {
176: if (((remoteHost == null) && (_remoteHost != null))
177: || ((remoteHost != null) && (_remoteHost == null))
178: || ((remoteHost != null) && (_remoteHost != null) && !remoteHost
179: .equals(_remoteHost))) {
180: _remoteHost = remoteHost;
181: }
182: }
183:
184: public String getUserAgent() {
185: return GetterUtil.getString(_userAgent);
186: }
187:
188: public void setUserAgent(String userAgent) {
189: if (((userAgent == null) && (_userAgent != null))
190: || ((userAgent != null) && (_userAgent == null))
191: || ((userAgent != null) && (_userAgent != null) && !userAgent
192: .equals(_userAgent))) {
193: _userAgent = userAgent;
194: }
195: }
196:
197: public UserTracker toEscapedModel() {
198: if (isEscapedModel()) {
199: return (UserTracker) this ;
200: } else {
201: UserTracker model = new UserTrackerImpl();
202:
203: model.setEscapedModel(true);
204:
205: model.setUserTrackerId(getUserTrackerId());
206: model.setCompanyId(getCompanyId());
207: model.setUserId(getUserId());
208: model.setModifiedDate(getModifiedDate());
209: model.setSessionId(Html.escape(getSessionId()));
210: model.setRemoteAddr(Html.escape(getRemoteAddr()));
211: model.setRemoteHost(Html.escape(getRemoteHost()));
212: model.setUserAgent(Html.escape(getUserAgent()));
213:
214: model = (UserTracker) Proxy.newProxyInstance(
215: UserTracker.class.getClassLoader(),
216: new Class[] { UserTracker.class },
217: new ReadOnlyBeanHandler(model));
218:
219: return model;
220: }
221: }
222:
223: public Object clone() {
224: UserTrackerImpl clone = new UserTrackerImpl();
225:
226: clone.setUserTrackerId(getUserTrackerId());
227: clone.setCompanyId(getCompanyId());
228: clone.setUserId(getUserId());
229: clone.setModifiedDate(getModifiedDate());
230: clone.setSessionId(getSessionId());
231: clone.setRemoteAddr(getRemoteAddr());
232: clone.setRemoteHost(getRemoteHost());
233: clone.setUserAgent(getUserAgent());
234:
235: return clone;
236: }
237:
238: public int compareTo(Object obj) {
239: if (obj == null) {
240: return -1;
241: }
242:
243: UserTrackerImpl userTracker = (UserTrackerImpl) obj;
244:
245: long pk = userTracker.getPrimaryKey();
246:
247: if (getPrimaryKey() < pk) {
248: return -1;
249: } else if (getPrimaryKey() > pk) {
250: return 1;
251: } else {
252: return 0;
253: }
254: }
255:
256: public boolean equals(Object obj) {
257: if (obj == null) {
258: return false;
259: }
260:
261: UserTrackerImpl userTracker = null;
262:
263: try {
264: userTracker = (UserTrackerImpl) obj;
265: } catch (ClassCastException cce) {
266: return false;
267: }
268:
269: long pk = userTracker.getPrimaryKey();
270:
271: if (getPrimaryKey() == pk) {
272: return true;
273: } else {
274: return false;
275: }
276: }
277:
278: public int hashCode() {
279: return (int) getPrimaryKey();
280: }
281:
282: private long _userTrackerId;
283: private long _companyId;
284: private long _userId;
285: private Date _modifiedDate;
286: private String _sessionId;
287: private String _remoteAddr;
288: private String _remoteHost;
289: private String _userAgent;
290: }
|