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.DateUtil;
025: import com.liferay.portal.kernel.util.GetterUtil;
026: import com.liferay.portal.model.PasswordTracker;
027: import com.liferay.portal.util.PropsUtil;
028:
029: import com.liferay.util.Html;
030:
031: import java.io.Serializable;
032:
033: import java.lang.reflect.Proxy;
034:
035: import java.sql.Types;
036:
037: import java.util.Date;
038:
039: /**
040: * <a href="PasswordTrackerModelImpl.java.html"><b><i>View Source</i></b></a>
041: *
042: * <p>
043: * ServiceBuilder generated this class. Modifications in this class will be
044: * overwritten the next time is generated.
045: * </p>
046: *
047: * <p>
048: * This class is a model that represents the <code>PasswordTracker</code> table
049: * in the database.
050: * </p>
051: *
052: * @author Brian Wing Shun Chan
053: *
054: * @see com.liferay.portal.service.model.PasswordTracker
055: * @see com.liferay.portal.service.model.PasswordTrackerModel
056: * @see com.liferay.portal.service.model.impl.PasswordTrackerImpl
057: *
058: */
059: public class PasswordTrackerModelImpl extends BaseModelImpl {
060: public static final String TABLE_NAME = "PasswordTracker";
061: public static final Object[][] TABLE_COLUMNS = {
062: { "passwordTrackerId", new Integer(Types.BIGINT) },
063:
064: { "userId", new Integer(Types.BIGINT) },
065:
066: { "createDate", new Integer(Types.TIMESTAMP) },
067:
068: { "password_", new Integer(Types.VARCHAR) } };
069: public static final String TABLE_SQL_CREATE = "create table PasswordTracker (passwordTrackerId LONG not null primary key,userId LONG,createDate DATE null,password_ VARCHAR(75) null)";
070: public static final String TABLE_SQL_DROP = "drop table PasswordTracker";
071: public static final boolean CACHE_ENABLED = GetterUtil
072: .getBoolean(
073: PropsUtil
074: .get("value.object.finder.cache.enabled.com.liferay.portal.model.PasswordTracker"),
075: true);
076: public static final long LOCK_EXPIRATION_TIME = GetterUtil
077: .getLong(PropsUtil
078: .get("lock.expiration.time.com.liferay.portal.model.PasswordTracker"));
079:
080: public PasswordTrackerModelImpl() {
081: }
082:
083: public long getPrimaryKey() {
084: return _passwordTrackerId;
085: }
086:
087: public void setPrimaryKey(long pk) {
088: setPasswordTrackerId(pk);
089: }
090:
091: public Serializable getPrimaryKeyObj() {
092: return new Long(_passwordTrackerId);
093: }
094:
095: public long getPasswordTrackerId() {
096: return _passwordTrackerId;
097: }
098:
099: public void setPasswordTrackerId(long passwordTrackerId) {
100: if (passwordTrackerId != _passwordTrackerId) {
101: _passwordTrackerId = passwordTrackerId;
102: }
103: }
104:
105: public long getUserId() {
106: return _userId;
107: }
108:
109: public void setUserId(long userId) {
110: if (userId != _userId) {
111: _userId = userId;
112: }
113: }
114:
115: public Date getCreateDate() {
116: return _createDate;
117: }
118:
119: public void setCreateDate(Date createDate) {
120: if (((createDate == null) && (_createDate != null))
121: || ((createDate != null) && (_createDate == null))
122: || ((createDate != null) && (_createDate != null) && !createDate
123: .equals(_createDate))) {
124: _createDate = createDate;
125: }
126: }
127:
128: public String getPassword() {
129: return GetterUtil.getString(_password);
130: }
131:
132: public void setPassword(String password) {
133: if (((password == null) && (_password != null))
134: || ((password != null) && (_password == null))
135: || ((password != null) && (_password != null) && !password
136: .equals(_password))) {
137: _password = password;
138: }
139: }
140:
141: public PasswordTracker toEscapedModel() {
142: if (isEscapedModel()) {
143: return (PasswordTracker) this ;
144: } else {
145: PasswordTracker model = new PasswordTrackerImpl();
146:
147: model.setEscapedModel(true);
148:
149: model.setPasswordTrackerId(getPasswordTrackerId());
150: model.setUserId(getUserId());
151: model.setCreateDate(getCreateDate());
152: model.setPassword(Html.escape(getPassword()));
153:
154: model = (PasswordTracker) Proxy.newProxyInstance(
155: PasswordTracker.class.getClassLoader(),
156: new Class[] { PasswordTracker.class },
157: new ReadOnlyBeanHandler(model));
158:
159: return model;
160: }
161: }
162:
163: public Object clone() {
164: PasswordTrackerImpl clone = new PasswordTrackerImpl();
165:
166: clone.setPasswordTrackerId(getPasswordTrackerId());
167: clone.setUserId(getUserId());
168: clone.setCreateDate(getCreateDate());
169: clone.setPassword(getPassword());
170:
171: return clone;
172: }
173:
174: public int compareTo(Object obj) {
175: if (obj == null) {
176: return -1;
177: }
178:
179: PasswordTrackerImpl passwordTracker = (PasswordTrackerImpl) obj;
180:
181: int value = 0;
182:
183: if (getUserId() < passwordTracker.getUserId()) {
184: value = -1;
185: } else if (getUserId() > passwordTracker.getUserId()) {
186: value = 1;
187: } else {
188: value = 0;
189: }
190:
191: value = value * -1;
192:
193: if (value != 0) {
194: return value;
195: }
196:
197: value = DateUtil.compareTo(getCreateDate(), passwordTracker
198: .getCreateDate());
199:
200: value = value * -1;
201:
202: if (value != 0) {
203: return value;
204: }
205:
206: return 0;
207: }
208:
209: public boolean equals(Object obj) {
210: if (obj == null) {
211: return false;
212: }
213:
214: PasswordTrackerImpl passwordTracker = null;
215:
216: try {
217: passwordTracker = (PasswordTrackerImpl) obj;
218: } catch (ClassCastException cce) {
219: return false;
220: }
221:
222: long pk = passwordTracker.getPrimaryKey();
223:
224: if (getPrimaryKey() == pk) {
225: return true;
226: } else {
227: return false;
228: }
229: }
230:
231: public int hashCode() {
232: return (int) getPrimaryKey();
233: }
234:
235: private long _passwordTrackerId;
236: private long _userId;
237: private Date _createDate;
238: private String _password;
239: }
|