001
014
015 package com.liferay.portal.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.util.DateUtil;
020 import com.liferay.portal.kernel.util.GetterUtil;
021 import com.liferay.portal.kernel.util.StringBundler;
022 import com.liferay.portal.kernel.util.StringPool;
023 import com.liferay.portal.model.PasswordTracker;
024 import com.liferay.portal.model.PasswordTrackerModel;
025 import com.liferay.portal.service.ServiceContext;
026 import com.liferay.portal.util.PortalUtil;
027
028 import com.liferay.portlet.expando.model.ExpandoBridge;
029 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
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
056 public class PasswordTrackerModelImpl extends BaseModelImpl<PasswordTracker>
057 implements PasswordTrackerModel {
058 public static final String TABLE_NAME = "PasswordTracker";
059 public static final Object[][] TABLE_COLUMNS = {
060 { "passwordTrackerId", new Integer(Types.BIGINT) },
061 { "userId", new Integer(Types.BIGINT) },
062 { "createDate", new Integer(Types.TIMESTAMP) },
063 { "password_", new Integer(Types.VARCHAR) }
064 };
065 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)";
066 public static final String TABLE_SQL_DROP = "drop table PasswordTracker";
067 public static final String ORDER_BY_JPQL = " ORDER BY passwordTracker.userId DESC, passwordTracker.createDate DESC";
068 public static final String ORDER_BY_SQL = " ORDER BY PasswordTracker.userId DESC, PasswordTracker.createDate DESC";
069 public static final String DATA_SOURCE = "liferayDataSource";
070 public static final String SESSION_FACTORY = "liferaySessionFactory";
071 public static final String TX_MANAGER = "liferayTransactionManager";
072 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
073 "value.object.entity.cache.enabled.com.liferay.portal.model.PasswordTracker"),
074 true);
075 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
076 "value.object.finder.cache.enabled.com.liferay.portal.model.PasswordTracker"),
077 true);
078 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
079 "lock.expiration.time.com.liferay.portal.model.PasswordTracker"));
080
081 public PasswordTrackerModelImpl() {
082 }
083
084 public long getPrimaryKey() {
085 return _passwordTrackerId;
086 }
087
088 public void setPrimaryKey(long pk) {
089 setPasswordTrackerId(pk);
090 }
091
092 public Serializable getPrimaryKeyObj() {
093 return new Long(_passwordTrackerId);
094 }
095
096 public long getPasswordTrackerId() {
097 return _passwordTrackerId;
098 }
099
100 public void setPasswordTrackerId(long passwordTrackerId) {
101 _passwordTrackerId = passwordTrackerId;
102 }
103
104 public long getUserId() {
105 return _userId;
106 }
107
108 public void setUserId(long userId) {
109 _userId = userId;
110 }
111
112 public String getUserUuid() throws SystemException {
113 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
114 }
115
116 public void setUserUuid(String userUuid) {
117 _userUuid = userUuid;
118 }
119
120 public Date getCreateDate() {
121 return _createDate;
122 }
123
124 public void setCreateDate(Date createDate) {
125 _createDate = createDate;
126 }
127
128 public String getPassword() {
129 if (_password == null) {
130 return StringPool.BLANK;
131 }
132 else {
133 return _password;
134 }
135 }
136
137 public void setPassword(String password) {
138 _password = password;
139 }
140
141 public PasswordTracker toEscapedModel() {
142 if (isEscapedModel()) {
143 return (PasswordTracker)this;
144 }
145 else {
146 return (PasswordTracker)Proxy.newProxyInstance(PasswordTracker.class.getClassLoader(),
147 new Class[] { PasswordTracker.class },
148 new AutoEscapeBeanHandler(this));
149 }
150 }
151
152 public ExpandoBridge getExpandoBridge() {
153 if (_expandoBridge == null) {
154 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
155 PasswordTracker.class.getName(), getPrimaryKey());
156 }
157
158 return _expandoBridge;
159 }
160
161 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
162 getExpandoBridge().setAttributes(serviceContext);
163 }
164
165 public Object clone() {
166 PasswordTrackerImpl passwordTrackerImpl = new PasswordTrackerImpl();
167
168 passwordTrackerImpl.setPasswordTrackerId(getPasswordTrackerId());
169
170 passwordTrackerImpl.setUserId(getUserId());
171
172 passwordTrackerImpl.setCreateDate(getCreateDate());
173
174 passwordTrackerImpl.setPassword(getPassword());
175
176 return passwordTrackerImpl;
177 }
178
179 public int compareTo(PasswordTracker passwordTracker) {
180 int value = 0;
181
182 if (getUserId() < passwordTracker.getUserId()) {
183 value = -1;
184 }
185 else if (getUserId() > passwordTracker.getUserId()) {
186 value = 1;
187 }
188 else {
189 value = 0;
190 }
191
192 value = value * -1;
193
194 if (value != 0) {
195 return value;
196 }
197
198 value = DateUtil.compareTo(getCreateDate(),
199 passwordTracker.getCreateDate());
200
201 value = value * -1;
202
203 if (value != 0) {
204 return value;
205 }
206
207 return 0;
208 }
209
210 public boolean equals(Object obj) {
211 if (obj == null) {
212 return false;
213 }
214
215 PasswordTracker passwordTracker = null;
216
217 try {
218 passwordTracker = (PasswordTracker)obj;
219 }
220 catch (ClassCastException cce) {
221 return false;
222 }
223
224 long pk = passwordTracker.getPrimaryKey();
225
226 if (getPrimaryKey() == pk) {
227 return true;
228 }
229 else {
230 return false;
231 }
232 }
233
234 public int hashCode() {
235 return (int)getPrimaryKey();
236 }
237
238 public String toString() {
239 StringBundler sb = new StringBundler(9);
240
241 sb.append("{passwordTrackerId=");
242 sb.append(getPasswordTrackerId());
243 sb.append(", userId=");
244 sb.append(getUserId());
245 sb.append(", createDate=");
246 sb.append(getCreateDate());
247 sb.append(", password=");
248 sb.append(getPassword());
249 sb.append("}");
250
251 return sb.toString();
252 }
253
254 public String toXmlString() {
255 StringBundler sb = new StringBundler(16);
256
257 sb.append("<model><model-name>");
258 sb.append("com.liferay.portal.model.PasswordTracker");
259 sb.append("</model-name>");
260
261 sb.append(
262 "<column><column-name>passwordTrackerId</column-name><column-value><![CDATA[");
263 sb.append(getPasswordTrackerId());
264 sb.append("]]></column-value></column>");
265 sb.append(
266 "<column><column-name>userId</column-name><column-value><![CDATA[");
267 sb.append(getUserId());
268 sb.append("]]></column-value></column>");
269 sb.append(
270 "<column><column-name>createDate</column-name><column-value><![CDATA[");
271 sb.append(getCreateDate());
272 sb.append("]]></column-value></column>");
273 sb.append(
274 "<column><column-name>password</column-name><column-value><![CDATA[");
275 sb.append(getPassword());
276 sb.append("]]></column-value></column>");
277
278 sb.append("</model>");
279
280 return sb.toString();
281 }
282
283 private long _passwordTrackerId;
284 private long _userId;
285 private String _userUuid;
286 private Date _createDate;
287 private String _password;
288 private transient ExpandoBridge _expandoBridge;
289 }