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