001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
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    /**
040     * The base model implementation for the PasswordTracker service. Represents a row in the "PasswordTracker" database table, with each column mapped to a property of this class.
041     *
042     * <p>
043     * This implementation and its corresponding interface {@link com.liferay.portal.model.PasswordTrackerModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link PasswordTrackerImpl}.
044     * </p>
045     *
046     * <p>
047     * Never modify or reference this class directly. All methods that expect a password tracker model instance should use the {@link com.liferay.portal.model.PasswordTracker} interface instead.
048     * </p>
049     *
050     * @author Brian Wing Shun Chan
051     * @see PasswordTrackerImpl
052     * @see com.liferay.portal.model.PasswordTracker
053     * @see com.liferay.portal.model.PasswordTrackerModel
054     * @generated
055     */
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 clone = new PasswordTrackerImpl();
167    
168                    clone.setPasswordTrackerId(getPasswordTrackerId());
169                    clone.setUserId(getUserId());
170                    clone.setCreateDate(getCreateDate());
171                    clone.setPassword(getPassword());
172    
173                    return clone;
174            }
175    
176            public int compareTo(PasswordTracker passwordTracker) {
177                    int value = 0;
178    
179                    if (getUserId() < passwordTracker.getUserId()) {
180                            value = -1;
181                    }
182                    else if (getUserId() > passwordTracker.getUserId()) {
183                            value = 1;
184                    }
185                    else {
186                            value = 0;
187                    }
188    
189                    value = value * -1;
190    
191                    if (value != 0) {
192                            return value;
193                    }
194    
195                    value = DateUtil.compareTo(getCreateDate(),
196                                    passwordTracker.getCreateDate());
197    
198                    value = value * -1;
199    
200                    if (value != 0) {
201                            return value;
202                    }
203    
204                    return 0;
205            }
206    
207            public boolean equals(Object obj) {
208                    if (obj == null) {
209                            return false;
210                    }
211    
212                    PasswordTracker passwordTracker = null;
213    
214                    try {
215                            passwordTracker = (PasswordTracker)obj;
216                    }
217                    catch (ClassCastException cce) {
218                            return false;
219                    }
220    
221                    long pk = passwordTracker.getPrimaryKey();
222    
223                    if (getPrimaryKey() == pk) {
224                            return true;
225                    }
226                    else {
227                            return false;
228                    }
229            }
230    
231            public int hashCode() {
232                    return (int)getPrimaryKey();
233            }
234    
235            public String toString() {
236                    StringBundler sb = new StringBundler(9);
237    
238                    sb.append("{passwordTrackerId=");
239                    sb.append(getPasswordTrackerId());
240                    sb.append(", userId=");
241                    sb.append(getUserId());
242                    sb.append(", createDate=");
243                    sb.append(getCreateDate());
244                    sb.append(", password=");
245                    sb.append(getPassword());
246                    sb.append("}");
247    
248                    return sb.toString();
249            }
250    
251            public String toXmlString() {
252                    StringBundler sb = new StringBundler(16);
253    
254                    sb.append("<model><model-name>");
255                    sb.append("com.liferay.portal.model.PasswordTracker");
256                    sb.append("</model-name>");
257    
258                    sb.append(
259                            "<column><column-name>passwordTrackerId</column-name><column-value><![CDATA[");
260                    sb.append(getPasswordTrackerId());
261                    sb.append("]]></column-value></column>");
262                    sb.append(
263                            "<column><column-name>userId</column-name><column-value><![CDATA[");
264                    sb.append(getUserId());
265                    sb.append("]]></column-value></column>");
266                    sb.append(
267                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
268                    sb.append(getCreateDate());
269                    sb.append("]]></column-value></column>");
270                    sb.append(
271                            "<column><column-name>password</column-name><column-value><![CDATA[");
272                    sb.append(getPassword());
273                    sb.append("]]></column-value></column>");
274    
275                    sb.append("</model>");
276    
277                    return sb.toString();
278            }
279    
280            private long _passwordTrackerId;
281            private long _userId;
282            private String _userUuid;
283            private Date _createDate;
284            private String _password;
285            private transient ExpandoBridge _expandoBridge;
286    }