001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.util.GetterUtil;
019    import com.liferay.portal.kernel.util.ProxyUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.CacheModel;
023    import com.liferay.portal.model.UserTrackerPath;
024    import com.liferay.portal.model.UserTrackerPathModel;
025    import com.liferay.portal.service.ServiceContext;
026    
027    import com.liferay.portlet.expando.model.ExpandoBridge;
028    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
029    
030    import java.io.Serializable;
031    
032    import java.sql.Types;
033    
034    import java.util.Date;
035    
036    /**
037     * The base model implementation for the UserTrackerPath service. Represents a row in the "UserTrackerPath" database table, with each column mapped to a property of this class.
038     *
039     * <p>
040     * This implementation and its corresponding interface {@link com.liferay.portal.model.UserTrackerPathModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link UserTrackerPathImpl}.
041     * </p>
042     *
043     * @author Brian Wing Shun Chan
044     * @see UserTrackerPathImpl
045     * @see com.liferay.portal.model.UserTrackerPath
046     * @see com.liferay.portal.model.UserTrackerPathModel
047     * @generated
048     */
049    public class UserTrackerPathModelImpl extends BaseModelImpl<UserTrackerPath>
050            implements UserTrackerPathModel {
051            /*
052             * NOTE FOR DEVELOPERS:
053             *
054             * Never modify or reference this class directly. All methods that expect a user tracker path model instance should use the {@link com.liferay.portal.model.UserTrackerPath} interface instead.
055             */
056            public static final String TABLE_NAME = "UserTrackerPath";
057            public static final Object[][] TABLE_COLUMNS = {
058                            { "userTrackerPathId", Types.BIGINT },
059                            { "userTrackerId", Types.BIGINT },
060                            { "path_", Types.VARCHAR },
061                            { "pathDate", Types.TIMESTAMP }
062                    };
063            public static final String TABLE_SQL_CREATE = "create table UserTrackerPath (userTrackerPathId LONG not null primary key,userTrackerId LONG,path_ STRING null,pathDate DATE null)";
064            public static final String TABLE_SQL_DROP = "drop table UserTrackerPath";
065            public static final String DATA_SOURCE = "liferayDataSource";
066            public static final String SESSION_FACTORY = "liferaySessionFactory";
067            public static final String TX_MANAGER = "liferayTransactionManager";
068            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
069                                    "value.object.entity.cache.enabled.com.liferay.portal.model.UserTrackerPath"),
070                            true);
071            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
072                                    "value.object.finder.cache.enabled.com.liferay.portal.model.UserTrackerPath"),
073                            true);
074            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
075                                    "value.object.column.bitmask.enabled.com.liferay.portal.model.UserTrackerPath"),
076                            true);
077            public static long USERTRACKERID_COLUMN_BITMASK = 1L;
078            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
079                                    "lock.expiration.time.com.liferay.portal.model.UserTrackerPath"));
080    
081            public UserTrackerPathModelImpl() {
082            }
083    
084            public long getPrimaryKey() {
085                    return _userTrackerPathId;
086            }
087    
088            public void setPrimaryKey(long primaryKey) {
089                    setUserTrackerPathId(primaryKey);
090            }
091    
092            public Serializable getPrimaryKeyObj() {
093                    return new Long(_userTrackerPathId);
094            }
095    
096            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
097                    setPrimaryKey(((Long)primaryKeyObj).longValue());
098            }
099    
100            public Class<?> getModelClass() {
101                    return UserTrackerPath.class;
102            }
103    
104            public String getModelClassName() {
105                    return UserTrackerPath.class.getName();
106            }
107    
108            public long getUserTrackerPathId() {
109                    return _userTrackerPathId;
110            }
111    
112            public void setUserTrackerPathId(long userTrackerPathId) {
113                    _userTrackerPathId = userTrackerPathId;
114            }
115    
116            public long getUserTrackerId() {
117                    return _userTrackerId;
118            }
119    
120            public void setUserTrackerId(long userTrackerId) {
121                    _columnBitmask |= USERTRACKERID_COLUMN_BITMASK;
122    
123                    if (!_setOriginalUserTrackerId) {
124                            _setOriginalUserTrackerId = true;
125    
126                            _originalUserTrackerId = _userTrackerId;
127                    }
128    
129                    _userTrackerId = userTrackerId;
130            }
131    
132            public long getOriginalUserTrackerId() {
133                    return _originalUserTrackerId;
134            }
135    
136            public String getPath() {
137                    if (_path == null) {
138                            return StringPool.BLANK;
139                    }
140                    else {
141                            return _path;
142                    }
143            }
144    
145            public void setPath(String path) {
146                    _path = path;
147            }
148    
149            public Date getPathDate() {
150                    return _pathDate;
151            }
152    
153            public void setPathDate(Date pathDate) {
154                    _pathDate = pathDate;
155            }
156    
157            public long getColumnBitmask() {
158                    return _columnBitmask;
159            }
160    
161            @Override
162            public UserTrackerPath toEscapedModel() {
163                    if (_escapedModelProxy == null) {
164                            _escapedModelProxy = (UserTrackerPath)ProxyUtil.newProxyInstance(_classLoader,
165                                            _escapedModelProxyInterfaces,
166                                            new AutoEscapeBeanHandler(this));
167                    }
168    
169                    return _escapedModelProxy;
170            }
171    
172            @Override
173            public ExpandoBridge getExpandoBridge() {
174                    if (_expandoBridge == null) {
175                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
176                                            UserTrackerPath.class.getName(), getPrimaryKey());
177                    }
178    
179                    return _expandoBridge;
180            }
181    
182            @Override
183            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
184                    getExpandoBridge().setAttributes(serviceContext);
185            }
186    
187            @Override
188            public Object clone() {
189                    UserTrackerPathImpl userTrackerPathImpl = new UserTrackerPathImpl();
190    
191                    userTrackerPathImpl.setUserTrackerPathId(getUserTrackerPathId());
192                    userTrackerPathImpl.setUserTrackerId(getUserTrackerId());
193                    userTrackerPathImpl.setPath(getPath());
194                    userTrackerPathImpl.setPathDate(getPathDate());
195    
196                    userTrackerPathImpl.resetOriginalValues();
197    
198                    return userTrackerPathImpl;
199            }
200    
201            public int compareTo(UserTrackerPath userTrackerPath) {
202                    long primaryKey = userTrackerPath.getPrimaryKey();
203    
204                    if (getPrimaryKey() < primaryKey) {
205                            return -1;
206                    }
207                    else if (getPrimaryKey() > primaryKey) {
208                            return 1;
209                    }
210                    else {
211                            return 0;
212                    }
213            }
214    
215            @Override
216            public boolean equals(Object obj) {
217                    if (obj == null) {
218                            return false;
219                    }
220    
221                    UserTrackerPath userTrackerPath = null;
222    
223                    try {
224                            userTrackerPath = (UserTrackerPath)obj;
225                    }
226                    catch (ClassCastException cce) {
227                            return false;
228                    }
229    
230                    long primaryKey = userTrackerPath.getPrimaryKey();
231    
232                    if (getPrimaryKey() == primaryKey) {
233                            return true;
234                    }
235                    else {
236                            return false;
237                    }
238            }
239    
240            @Override
241            public int hashCode() {
242                    return (int)getPrimaryKey();
243            }
244    
245            @Override
246            public void resetOriginalValues() {
247                    UserTrackerPathModelImpl userTrackerPathModelImpl = this;
248    
249                    userTrackerPathModelImpl._originalUserTrackerId = userTrackerPathModelImpl._userTrackerId;
250    
251                    userTrackerPathModelImpl._setOriginalUserTrackerId = false;
252    
253                    userTrackerPathModelImpl._columnBitmask = 0;
254            }
255    
256            @Override
257            public CacheModel<UserTrackerPath> toCacheModel() {
258                    UserTrackerPathCacheModel userTrackerPathCacheModel = new UserTrackerPathCacheModel();
259    
260                    userTrackerPathCacheModel.userTrackerPathId = getUserTrackerPathId();
261    
262                    userTrackerPathCacheModel.userTrackerId = getUserTrackerId();
263    
264                    userTrackerPathCacheModel.path = getPath();
265    
266                    String path = userTrackerPathCacheModel.path;
267    
268                    if ((path != null) && (path.length() == 0)) {
269                            userTrackerPathCacheModel.path = null;
270                    }
271    
272                    Date pathDate = getPathDate();
273    
274                    if (pathDate != null) {
275                            userTrackerPathCacheModel.pathDate = pathDate.getTime();
276                    }
277                    else {
278                            userTrackerPathCacheModel.pathDate = Long.MIN_VALUE;
279                    }
280    
281                    return userTrackerPathCacheModel;
282            }
283    
284            @Override
285            public String toString() {
286                    StringBundler sb = new StringBundler(9);
287    
288                    sb.append("{userTrackerPathId=");
289                    sb.append(getUserTrackerPathId());
290                    sb.append(", userTrackerId=");
291                    sb.append(getUserTrackerId());
292                    sb.append(", path=");
293                    sb.append(getPath());
294                    sb.append(", pathDate=");
295                    sb.append(getPathDate());
296                    sb.append("}");
297    
298                    return sb.toString();
299            }
300    
301            public String toXmlString() {
302                    StringBundler sb = new StringBundler(16);
303    
304                    sb.append("<model><model-name>");
305                    sb.append("com.liferay.portal.model.UserTrackerPath");
306                    sb.append("</model-name>");
307    
308                    sb.append(
309                            "<column><column-name>userTrackerPathId</column-name><column-value><![CDATA[");
310                    sb.append(getUserTrackerPathId());
311                    sb.append("]]></column-value></column>");
312                    sb.append(
313                            "<column><column-name>userTrackerId</column-name><column-value><![CDATA[");
314                    sb.append(getUserTrackerId());
315                    sb.append("]]></column-value></column>");
316                    sb.append(
317                            "<column><column-name>path</column-name><column-value><![CDATA[");
318                    sb.append(getPath());
319                    sb.append("]]></column-value></column>");
320                    sb.append(
321                            "<column><column-name>pathDate</column-name><column-value><![CDATA[");
322                    sb.append(getPathDate());
323                    sb.append("]]></column-value></column>");
324    
325                    sb.append("</model>");
326    
327                    return sb.toString();
328            }
329    
330            private static ClassLoader _classLoader = UserTrackerPath.class.getClassLoader();
331            private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
332                            UserTrackerPath.class
333                    };
334            private long _userTrackerPathId;
335            private long _userTrackerId;
336            private long _originalUserTrackerId;
337            private boolean _setOriginalUserTrackerId;
338            private String _path;
339            private Date _pathDate;
340            private transient ExpandoBridge _expandoBridge;
341            private long _columnBitmask;
342            private UserTrackerPath _escapedModelProxy;
343    }