1
14
15 package com.liferay.portal.model.impl;
16
17 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
18 import com.liferay.portal.kernel.exception.SystemException;
19 import com.liferay.portal.kernel.util.DateUtil;
20 import com.liferay.portal.kernel.util.GetterUtil;
21 import com.liferay.portal.kernel.util.HtmlUtil;
22 import com.liferay.portal.kernel.util.StringBundler;
23 import com.liferay.portal.model.PasswordTracker;
24 import com.liferay.portal.model.PasswordTrackerSoap;
25 import com.liferay.portal.service.ServiceContext;
26 import com.liferay.portal.util.PortalUtil;
27
28 import com.liferay.portlet.expando.model.ExpandoBridge;
29 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
30
31 import java.io.Serializable;
32
33 import java.lang.reflect.Proxy;
34
35 import java.sql.Types;
36
37 import java.util.ArrayList;
38 import java.util.Date;
39 import java.util.List;
40
41
60 public class PasswordTrackerModelImpl extends BaseModelImpl<PasswordTracker> {
61 public static final String TABLE_NAME = "PasswordTracker";
62 public static final Object[][] TABLE_COLUMNS = {
63 { "passwordTrackerId", new Integer(Types.BIGINT) },
64 { "userId", new Integer(Types.BIGINT) },
65 { "createDate", new Integer(Types.TIMESTAMP) },
66 { "password_", new Integer(Types.VARCHAR) }
67 };
68 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)";
69 public static final String TABLE_SQL_DROP = "drop table PasswordTracker";
70 public static final String ORDER_BY_JPQL = " ORDER BY passwordTracker.userId DESC, passwordTracker.createDate DESC";
71 public static final String ORDER_BY_SQL = " ORDER BY PasswordTracker.userId DESC, PasswordTracker.createDate DESC";
72 public static final String DATA_SOURCE = "liferayDataSource";
73 public static final String SESSION_FACTORY = "liferaySessionFactory";
74 public static final String TX_MANAGER = "liferayTransactionManager";
75 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
76 "value.object.entity.cache.enabled.com.liferay.portal.model.PasswordTracker"),
77 true);
78 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
79 "value.object.finder.cache.enabled.com.liferay.portal.model.PasswordTracker"),
80 true);
81
82 public static PasswordTracker toModel(PasswordTrackerSoap soapModel) {
83 PasswordTracker model = new PasswordTrackerImpl();
84
85 model.setPasswordTrackerId(soapModel.getPasswordTrackerId());
86 model.setUserId(soapModel.getUserId());
87 model.setCreateDate(soapModel.getCreateDate());
88 model.setPassword(soapModel.getPassword());
89
90 return model;
91 }
92
93 public static List<PasswordTracker> toModels(
94 PasswordTrackerSoap[] soapModels) {
95 List<PasswordTracker> models = new ArrayList<PasswordTracker>(soapModels.length);
96
97 for (PasswordTrackerSoap soapModel : soapModels) {
98 models.add(toModel(soapModel));
99 }
100
101 return models;
102 }
103
104 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
105 "lock.expiration.time.com.liferay.portal.model.PasswordTracker"));
106
107 public PasswordTrackerModelImpl() {
108 }
109
110 public long getPrimaryKey() {
111 return _passwordTrackerId;
112 }
113
114 public void setPrimaryKey(long pk) {
115 setPasswordTrackerId(pk);
116 }
117
118 public Serializable getPrimaryKeyObj() {
119 return new Long(_passwordTrackerId);
120 }
121
122 public long getPasswordTrackerId() {
123 return _passwordTrackerId;
124 }
125
126 public void setPasswordTrackerId(long passwordTrackerId) {
127 _passwordTrackerId = passwordTrackerId;
128 }
129
130 public long getUserId() {
131 return _userId;
132 }
133
134 public void setUserId(long userId) {
135 _userId = userId;
136 }
137
138 public String getUserUuid() throws SystemException {
139 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
140 }
141
142 public void setUserUuid(String userUuid) {
143 _userUuid = userUuid;
144 }
145
146 public Date getCreateDate() {
147 return _createDate;
148 }
149
150 public void setCreateDate(Date createDate) {
151 _createDate = createDate;
152 }
153
154 public String getPassword() {
155 return GetterUtil.getString(_password);
156 }
157
158 public void setPassword(String password) {
159 _password = password;
160 }
161
162 public PasswordTracker toEscapedModel() {
163 if (isEscapedModel()) {
164 return (PasswordTracker)this;
165 }
166 else {
167 PasswordTracker model = new PasswordTrackerImpl();
168
169 model.setNew(isNew());
170 model.setEscapedModel(true);
171
172 model.setPasswordTrackerId(getPasswordTrackerId());
173 model.setUserId(getUserId());
174 model.setCreateDate(getCreateDate());
175 model.setPassword(HtmlUtil.escape(getPassword()));
176
177 model = (PasswordTracker)Proxy.newProxyInstance(PasswordTracker.class.getClassLoader(),
178 new Class[] { PasswordTracker.class },
179 new ReadOnlyBeanHandler(model));
180
181 return model;
182 }
183 }
184
185 public ExpandoBridge getExpandoBridge() {
186 if (_expandoBridge == null) {
187 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
188 PasswordTracker.class.getName(), getPrimaryKey());
189 }
190
191 return _expandoBridge;
192 }
193
194 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
195 getExpandoBridge().setAttributes(serviceContext);
196 }
197
198 public Object clone() {
199 PasswordTrackerImpl clone = new PasswordTrackerImpl();
200
201 clone.setPasswordTrackerId(getPasswordTrackerId());
202 clone.setUserId(getUserId());
203 clone.setCreateDate(getCreateDate());
204 clone.setPassword(getPassword());
205
206 return clone;
207 }
208
209 public int compareTo(PasswordTracker passwordTracker) {
210 int value = 0;
211
212 if (getUserId() < passwordTracker.getUserId()) {
213 value = -1;
214 }
215 else if (getUserId() > passwordTracker.getUserId()) {
216 value = 1;
217 }
218 else {
219 value = 0;
220 }
221
222 value = value * -1;
223
224 if (value != 0) {
225 return value;
226 }
227
228 value = DateUtil.compareTo(getCreateDate(),
229 passwordTracker.getCreateDate());
230
231 value = value * -1;
232
233 if (value != 0) {
234 return value;
235 }
236
237 return 0;
238 }
239
240 public boolean equals(Object obj) {
241 if (obj == null) {
242 return false;
243 }
244
245 PasswordTracker passwordTracker = null;
246
247 try {
248 passwordTracker = (PasswordTracker)obj;
249 }
250 catch (ClassCastException cce) {
251 return false;
252 }
253
254 long pk = passwordTracker.getPrimaryKey();
255
256 if (getPrimaryKey() == pk) {
257 return true;
258 }
259 else {
260 return false;
261 }
262 }
263
264 public int hashCode() {
265 return (int)getPrimaryKey();
266 }
267
268 public String toString() {
269 StringBundler sb = new StringBundler(9);
270
271 sb.append("{passwordTrackerId=");
272 sb.append(getPasswordTrackerId());
273 sb.append(", userId=");
274 sb.append(getUserId());
275 sb.append(", createDate=");
276 sb.append(getCreateDate());
277 sb.append(", password=");
278 sb.append(getPassword());
279 sb.append("}");
280
281 return sb.toString();
282 }
283
284 public String toXmlString() {
285 StringBundler sb = new StringBundler(16);
286
287 sb.append("<model><model-name>");
288 sb.append("com.liferay.portal.model.PasswordTracker");
289 sb.append("</model-name>");
290
291 sb.append(
292 "<column><column-name>passwordTrackerId</column-name><column-value><![CDATA[");
293 sb.append(getPasswordTrackerId());
294 sb.append("]]></column-value></column>");
295 sb.append(
296 "<column><column-name>userId</column-name><column-value><![CDATA[");
297 sb.append(getUserId());
298 sb.append("]]></column-value></column>");
299 sb.append(
300 "<column><column-name>createDate</column-name><column-value><![CDATA[");
301 sb.append(getCreateDate());
302 sb.append("]]></column-value></column>");
303 sb.append(
304 "<column><column-name>password</column-name><column-value><![CDATA[");
305 sb.append(getPassword());
306 sb.append("]]></column-value></column>");
307
308 sb.append("</model>");
309
310 return sb.toString();
311 }
312
313 private long _passwordTrackerId;
314 private long _userId;
315 private String _userUuid;
316 private Date _createDate;
317 private String _password;
318 private transient ExpandoBridge _expandoBridge;
319 }