1
14
15 package com.liferay.portal.model.impl;
16
17 import com.liferay.portal.SystemException;
18 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
19 import com.liferay.portal.kernel.util.DateUtil;
20 import com.liferay.portal.kernel.util.GetterUtil;
21 import com.liferay.portal.kernel.util.StringBundler;
22 import com.liferay.portal.kernel.util.StringPool;
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 if (_password == null) {
156 return StringPool.BLANK;
157 }
158 else {
159 return _password;
160 }
161 }
162
163 public void setPassword(String password) {
164 _password = password;
165 }
166
167 public PasswordTracker toEscapedModel() {
168 if (isEscapedModel()) {
169 return (PasswordTracker)this;
170 }
171 else {
172 return (PasswordTracker)Proxy.newProxyInstance(PasswordTracker.class.getClassLoader(),
173 new Class[] { PasswordTracker.class },
174 new AutoEscapeBeanHandler(this));
175 }
176 }
177
178 public ExpandoBridge getExpandoBridge() {
179 if (_expandoBridge == null) {
180 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(PasswordTracker.class.getName(),
181 getPrimaryKey());
182 }
183
184 return _expandoBridge;
185 }
186
187 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
188 getExpandoBridge().setAttributes(serviceContext);
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(PasswordTracker passwordTracker) {
203 int value = 0;
204
205 if (getUserId() < passwordTracker.getUserId()) {
206 value = -1;
207 }
208 else if (getUserId() > passwordTracker.getUserId()) {
209 value = 1;
210 }
211 else {
212 value = 0;
213 }
214
215 value = value * -1;
216
217 if (value != 0) {
218 return value;
219 }
220
221 value = DateUtil.compareTo(getCreateDate(),
222 passwordTracker.getCreateDate());
223
224 value = value * -1;
225
226 if (value != 0) {
227 return value;
228 }
229
230 return 0;
231 }
232
233 public boolean equals(Object obj) {
234 if (obj == null) {
235 return false;
236 }
237
238 PasswordTracker passwordTracker = null;
239
240 try {
241 passwordTracker = (PasswordTracker)obj;
242 }
243 catch (ClassCastException cce) {
244 return false;
245 }
246
247 long pk = passwordTracker.getPrimaryKey();
248
249 if (getPrimaryKey() == pk) {
250 return true;
251 }
252 else {
253 return false;
254 }
255 }
256
257 public int hashCode() {
258 return (int)getPrimaryKey();
259 }
260
261 public String toString() {
262 StringBundler sb = new StringBundler(9);
263
264 sb.append("{passwordTrackerId=");
265 sb.append(getPasswordTrackerId());
266 sb.append(", userId=");
267 sb.append(getUserId());
268 sb.append(", createDate=");
269 sb.append(getCreateDate());
270 sb.append(", password=");
271 sb.append(getPassword());
272 sb.append("}");
273
274 return sb.toString();
275 }
276
277 public String toXmlString() {
278 StringBundler sb = new StringBundler(16);
279
280 sb.append("<model><model-name>");
281 sb.append("com.liferay.portal.model.PasswordTracker");
282 sb.append("</model-name>");
283
284 sb.append(
285 "<column><column-name>passwordTrackerId</column-name><column-value><![CDATA[");
286 sb.append(getPasswordTrackerId());
287 sb.append("]]></column-value></column>");
288 sb.append(
289 "<column><column-name>userId</column-name><column-value><![CDATA[");
290 sb.append(getUserId());
291 sb.append("]]></column-value></column>");
292 sb.append(
293 "<column><column-name>createDate</column-name><column-value><![CDATA[");
294 sb.append(getCreateDate());
295 sb.append("]]></column-value></column>");
296 sb.append(
297 "<column><column-name>password</column-name><column-value><![CDATA[");
298 sb.append(getPassword());
299 sb.append("]]></column-value></column>");
300
301 sb.append("</model>");
302
303 return sb.toString();
304 }
305
306 private long _passwordTrackerId;
307 private long _userId;
308 private String _userUuid;
309 private Date _createDate;
310 private String _password;
311 private transient ExpandoBridge _expandoBridge;
312 }