1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.DateUtil;
27 import com.liferay.portal.kernel.util.GetterUtil;
28 import com.liferay.portal.kernel.util.HtmlUtil;
29 import com.liferay.portal.model.PasswordTracker;
30 import com.liferay.portal.model.PasswordTrackerSoap;
31 import com.liferay.portal.util.PropsUtil;
32
33 import java.io.Serializable;
34
35 import java.lang.reflect.Proxy;
36
37 import java.sql.Types;
38
39 import java.util.ArrayList;
40 import java.util.Date;
41 import java.util.List;
42
43
63 public class PasswordTrackerModelImpl extends BaseModelImpl {
64 public static final String TABLE_NAME = "PasswordTracker";
65 public static final Object[][] TABLE_COLUMNS = {
66 { "passwordTrackerId", new Integer(Types.BIGINT) },
67
68
69 { "userId", new Integer(Types.BIGINT) },
70
71
72 { "createDate", new Integer(Types.TIMESTAMP) },
73
74
75 { "password_", new Integer(Types.VARCHAR) }
76 };
77 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)";
78 public static final String TABLE_SQL_DROP = "drop table PasswordTracker";
79 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
80 "value.object.finder.cache.enabled.com.liferay.portal.model.PasswordTracker"),
81 true);
82
83 public static PasswordTracker toModel(PasswordTrackerSoap soapModel) {
84 PasswordTracker model = new PasswordTrackerImpl();
85
86 model.setPasswordTrackerId(soapModel.getPasswordTrackerId());
87 model.setUserId(soapModel.getUserId());
88 model.setCreateDate(soapModel.getCreateDate());
89 model.setPassword(soapModel.getPassword());
90
91 return model;
92 }
93
94 public static List<PasswordTracker> toModels(
95 PasswordTrackerSoap[] soapModels) {
96 List<PasswordTracker> models = new ArrayList<PasswordTracker>(soapModels.length);
97
98 for (PasswordTrackerSoap soapModel : soapModels) {
99 models.add(toModel(soapModel));
100 }
101
102 return models;
103 }
104
105 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
106 "lock.expiration.time.com.liferay.portal.model.PasswordTracker"));
107
108 public PasswordTrackerModelImpl() {
109 }
110
111 public long getPrimaryKey() {
112 return _passwordTrackerId;
113 }
114
115 public void setPrimaryKey(long pk) {
116 setPasswordTrackerId(pk);
117 }
118
119 public Serializable getPrimaryKeyObj() {
120 return new Long(_passwordTrackerId);
121 }
122
123 public long getPasswordTrackerId() {
124 return _passwordTrackerId;
125 }
126
127 public void setPasswordTrackerId(long passwordTrackerId) {
128 if (passwordTrackerId != _passwordTrackerId) {
129 _passwordTrackerId = passwordTrackerId;
130 }
131 }
132
133 public long getUserId() {
134 return _userId;
135 }
136
137 public void setUserId(long userId) {
138 if (userId != _userId) {
139 _userId = userId;
140 }
141 }
142
143 public Date getCreateDate() {
144 return _createDate;
145 }
146
147 public void setCreateDate(Date createDate) {
148 if (((createDate == null) && (_createDate != null)) ||
149 ((createDate != null) && (_createDate == null)) ||
150 ((createDate != null) && (_createDate != null) &&
151 !createDate.equals(_createDate))) {
152 _createDate = createDate;
153 }
154 }
155
156 public String getPassword() {
157 return GetterUtil.getString(_password);
158 }
159
160 public void setPassword(String password) {
161 if (((password == null) && (_password != null)) ||
162 ((password != null) && (_password == null)) ||
163 ((password != null) && (_password != null) &&
164 !password.equals(_password))) {
165 _password = password;
166 }
167 }
168
169 public PasswordTracker toEscapedModel() {
170 if (isEscapedModel()) {
171 return (PasswordTracker)this;
172 }
173 else {
174 PasswordTracker model = new PasswordTrackerImpl();
175
176 model.setEscapedModel(true);
177
178 model.setPasswordTrackerId(getPasswordTrackerId());
179 model.setUserId(getUserId());
180 model.setCreateDate(getCreateDate());
181 model.setPassword(HtmlUtil.escape(getPassword()));
182
183 model = (PasswordTracker)Proxy.newProxyInstance(PasswordTracker.class.getClassLoader(),
184 new Class[] { PasswordTracker.class },
185 new ReadOnlyBeanHandler(model));
186
187 return model;
188 }
189 }
190
191 public Object clone() {
192 PasswordTrackerImpl clone = new PasswordTrackerImpl();
193
194 clone.setPasswordTrackerId(getPasswordTrackerId());
195 clone.setUserId(getUserId());
196 clone.setCreateDate(getCreateDate());
197 clone.setPassword(getPassword());
198
199 return clone;
200 }
201
202 public int compareTo(Object obj) {
203 if (obj == null) {
204 return -1;
205 }
206
207 PasswordTrackerImpl passwordTracker = (PasswordTrackerImpl)obj;
208
209 int value = 0;
210
211 if (getUserId() < passwordTracker.getUserId()) {
212 value = -1;
213 }
214 else if (getUserId() > passwordTracker.getUserId()) {
215 value = 1;
216 }
217 else {
218 value = 0;
219 }
220
221 value = value * -1;
222
223 if (value != 0) {
224 return value;
225 }
226
227 value = DateUtil.compareTo(getCreateDate(),
228 passwordTracker.getCreateDate());
229
230 value = value * -1;
231
232 if (value != 0) {
233 return value;
234 }
235
236 return 0;
237 }
238
239 public boolean equals(Object obj) {
240 if (obj == null) {
241 return false;
242 }
243
244 PasswordTrackerImpl passwordTracker = null;
245
246 try {
247 passwordTracker = (PasswordTrackerImpl)obj;
248 }
249 catch (ClassCastException cce) {
250 return false;
251 }
252
253 long pk = passwordTracker.getPrimaryKey();
254
255 if (getPrimaryKey() == pk) {
256 return true;
257 }
258 else {
259 return false;
260 }
261 }
262
263 public int hashCode() {
264 return (int)getPrimaryKey();
265 }
266
267 private long _passwordTrackerId;
268 private long _userId;
269 private Date _createDate;
270 private String _password;
271 }