001    /**
002     * Copyright (c) 2000-2013 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    import java.util.HashMap;
036    import java.util.Map;
037    
038    /**
039     * 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.
040     *
041     * <p>
042     * 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}.
043     * </p>
044     *
045     * @author Brian Wing Shun Chan
046     * @see UserTrackerPathImpl
047     * @see com.liferay.portal.model.UserTrackerPath
048     * @see com.liferay.portal.model.UserTrackerPathModel
049     * @generated
050     */
051    public class UserTrackerPathModelImpl extends BaseModelImpl<UserTrackerPath>
052            implements UserTrackerPathModel {
053            /*
054             * NOTE FOR DEVELOPERS:
055             *
056             * 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.
057             */
058            public static final String TABLE_NAME = "UserTrackerPath";
059            public static final Object[][] TABLE_COLUMNS = {
060                            { "userTrackerPathId", Types.BIGINT },
061                            { "userTrackerId", Types.BIGINT },
062                            { "path_", Types.VARCHAR },
063                            { "pathDate", Types.TIMESTAMP }
064                    };
065            public static final String TABLE_SQL_CREATE = "create table UserTrackerPath (userTrackerPathId LONG not null primary key,userTrackerId LONG,path_ STRING null,pathDate DATE null)";
066            public static final String TABLE_SQL_DROP = "drop table UserTrackerPath";
067            public static final String ORDER_BY_JPQL = " ORDER BY userTrackerPath.userTrackerPathId ASC";
068            public static final String ORDER_BY_SQL = " ORDER BY UserTrackerPath.userTrackerPathId ASC";
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.UserTrackerPath"),
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.UserTrackerPath"),
077                            true);
078            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
079                                    "value.object.column.bitmask.enabled.com.liferay.portal.model.UserTrackerPath"),
080                            true);
081            public static long USERTRACKERID_COLUMN_BITMASK = 1L;
082            public static long USERTRACKERPATHID_COLUMN_BITMASK = 2L;
083            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
084                                    "lock.expiration.time.com.liferay.portal.model.UserTrackerPath"));
085    
086            public UserTrackerPathModelImpl() {
087            }
088    
089            public long getPrimaryKey() {
090                    return _userTrackerPathId;
091            }
092    
093            public void setPrimaryKey(long primaryKey) {
094                    setUserTrackerPathId(primaryKey);
095            }
096    
097            public Serializable getPrimaryKeyObj() {
098                    return _userTrackerPathId;
099            }
100    
101            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
102                    setPrimaryKey(((Long)primaryKeyObj).longValue());
103            }
104    
105            public Class<?> getModelClass() {
106                    return UserTrackerPath.class;
107            }
108    
109            public String getModelClassName() {
110                    return UserTrackerPath.class.getName();
111            }
112    
113            @Override
114            public Map<String, Object> getModelAttributes() {
115                    Map<String, Object> attributes = new HashMap<String, Object>();
116    
117                    attributes.put("userTrackerPathId", getUserTrackerPathId());
118                    attributes.put("userTrackerId", getUserTrackerId());
119                    attributes.put("path", getPath());
120                    attributes.put("pathDate", getPathDate());
121    
122                    return attributes;
123            }
124    
125            @Override
126            public void setModelAttributes(Map<String, Object> attributes) {
127                    Long userTrackerPathId = (Long)attributes.get("userTrackerPathId");
128    
129                    if (userTrackerPathId != null) {
130                            setUserTrackerPathId(userTrackerPathId);
131                    }
132    
133                    Long userTrackerId = (Long)attributes.get("userTrackerId");
134    
135                    if (userTrackerId != null) {
136                            setUserTrackerId(userTrackerId);
137                    }
138    
139                    String path = (String)attributes.get("path");
140    
141                    if (path != null) {
142                            setPath(path);
143                    }
144    
145                    Date pathDate = (Date)attributes.get("pathDate");
146    
147                    if (pathDate != null) {
148                            setPathDate(pathDate);
149                    }
150            }
151    
152            public long getUserTrackerPathId() {
153                    return _userTrackerPathId;
154            }
155    
156            public void setUserTrackerPathId(long userTrackerPathId) {
157                    _userTrackerPathId = userTrackerPathId;
158            }
159    
160            public long getUserTrackerId() {
161                    return _userTrackerId;
162            }
163    
164            public void setUserTrackerId(long userTrackerId) {
165                    _columnBitmask |= USERTRACKERID_COLUMN_BITMASK;
166    
167                    if (!_setOriginalUserTrackerId) {
168                            _setOriginalUserTrackerId = true;
169    
170                            _originalUserTrackerId = _userTrackerId;
171                    }
172    
173                    _userTrackerId = userTrackerId;
174            }
175    
176            public long getOriginalUserTrackerId() {
177                    return _originalUserTrackerId;
178            }
179    
180            public String getPath() {
181                    if (_path == null) {
182                            return StringPool.BLANK;
183                    }
184                    else {
185                            return _path;
186                    }
187            }
188    
189            public void setPath(String path) {
190                    _path = path;
191            }
192    
193            public Date getPathDate() {
194                    return _pathDate;
195            }
196    
197            public void setPathDate(Date pathDate) {
198                    _pathDate = pathDate;
199            }
200    
201            public long getColumnBitmask() {
202                    return _columnBitmask;
203            }
204    
205            @Override
206            public ExpandoBridge getExpandoBridge() {
207                    return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
208                            UserTrackerPath.class.getName(), getPrimaryKey());
209            }
210    
211            @Override
212            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
213                    ExpandoBridge expandoBridge = getExpandoBridge();
214    
215                    expandoBridge.setAttributes(serviceContext);
216            }
217    
218            @Override
219            public UserTrackerPath toEscapedModel() {
220                    if (_escapedModel == null) {
221                            _escapedModel = (UserTrackerPath)ProxyUtil.newProxyInstance(_classLoader,
222                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
223                    }
224    
225                    return _escapedModel;
226            }
227    
228            @Override
229            public Object clone() {
230                    UserTrackerPathImpl userTrackerPathImpl = new UserTrackerPathImpl();
231    
232                    userTrackerPathImpl.setUserTrackerPathId(getUserTrackerPathId());
233                    userTrackerPathImpl.setUserTrackerId(getUserTrackerId());
234                    userTrackerPathImpl.setPath(getPath());
235                    userTrackerPathImpl.setPathDate(getPathDate());
236    
237                    userTrackerPathImpl.resetOriginalValues();
238    
239                    return userTrackerPathImpl;
240            }
241    
242            public int compareTo(UserTrackerPath userTrackerPath) {
243                    long primaryKey = userTrackerPath.getPrimaryKey();
244    
245                    if (getPrimaryKey() < primaryKey) {
246                            return -1;
247                    }
248                    else if (getPrimaryKey() > primaryKey) {
249                            return 1;
250                    }
251                    else {
252                            return 0;
253                    }
254            }
255    
256            @Override
257            public boolean equals(Object obj) {
258                    if (obj == null) {
259                            return false;
260                    }
261    
262                    UserTrackerPath userTrackerPath = null;
263    
264                    try {
265                            userTrackerPath = (UserTrackerPath)obj;
266                    }
267                    catch (ClassCastException cce) {
268                            return false;
269                    }
270    
271                    long primaryKey = userTrackerPath.getPrimaryKey();
272    
273                    if (getPrimaryKey() == primaryKey) {
274                            return true;
275                    }
276                    else {
277                            return false;
278                    }
279            }
280    
281            @Override
282            public int hashCode() {
283                    return (int)getPrimaryKey();
284            }
285    
286            @Override
287            public void resetOriginalValues() {
288                    UserTrackerPathModelImpl userTrackerPathModelImpl = this;
289    
290                    userTrackerPathModelImpl._originalUserTrackerId = userTrackerPathModelImpl._userTrackerId;
291    
292                    userTrackerPathModelImpl._setOriginalUserTrackerId = false;
293    
294                    userTrackerPathModelImpl._columnBitmask = 0;
295            }
296    
297            @Override
298            public CacheModel<UserTrackerPath> toCacheModel() {
299                    UserTrackerPathCacheModel userTrackerPathCacheModel = new UserTrackerPathCacheModel();
300    
301                    userTrackerPathCacheModel.userTrackerPathId = getUserTrackerPathId();
302    
303                    userTrackerPathCacheModel.userTrackerId = getUserTrackerId();
304    
305                    userTrackerPathCacheModel.path = getPath();
306    
307                    String path = userTrackerPathCacheModel.path;
308    
309                    if ((path != null) && (path.length() == 0)) {
310                            userTrackerPathCacheModel.path = null;
311                    }
312    
313                    Date pathDate = getPathDate();
314    
315                    if (pathDate != null) {
316                            userTrackerPathCacheModel.pathDate = pathDate.getTime();
317                    }
318                    else {
319                            userTrackerPathCacheModel.pathDate = Long.MIN_VALUE;
320                    }
321    
322                    return userTrackerPathCacheModel;
323            }
324    
325            @Override
326            public String toString() {
327                    StringBundler sb = new StringBundler(9);
328    
329                    sb.append("{userTrackerPathId=");
330                    sb.append(getUserTrackerPathId());
331                    sb.append(", userTrackerId=");
332                    sb.append(getUserTrackerId());
333                    sb.append(", path=");
334                    sb.append(getPath());
335                    sb.append(", pathDate=");
336                    sb.append(getPathDate());
337                    sb.append("}");
338    
339                    return sb.toString();
340            }
341    
342            public String toXmlString() {
343                    StringBundler sb = new StringBundler(16);
344    
345                    sb.append("<model><model-name>");
346                    sb.append("com.liferay.portal.model.UserTrackerPath");
347                    sb.append("</model-name>");
348    
349                    sb.append(
350                            "<column><column-name>userTrackerPathId</column-name><column-value><![CDATA[");
351                    sb.append(getUserTrackerPathId());
352                    sb.append("]]></column-value></column>");
353                    sb.append(
354                            "<column><column-name>userTrackerId</column-name><column-value><![CDATA[");
355                    sb.append(getUserTrackerId());
356                    sb.append("]]></column-value></column>");
357                    sb.append(
358                            "<column><column-name>path</column-name><column-value><![CDATA[");
359                    sb.append(getPath());
360                    sb.append("]]></column-value></column>");
361                    sb.append(
362                            "<column><column-name>pathDate</column-name><column-value><![CDATA[");
363                    sb.append(getPathDate());
364                    sb.append("]]></column-value></column>");
365    
366                    sb.append("</model>");
367    
368                    return sb.toString();
369            }
370    
371            private static ClassLoader _classLoader = UserTrackerPath.class.getClassLoader();
372            private static Class<?>[] _escapedModelInterfaces = new Class[] {
373                            UserTrackerPath.class
374                    };
375            private long _userTrackerPathId;
376            private long _userTrackerId;
377            private long _originalUserTrackerId;
378            private boolean _setOriginalUserTrackerId;
379            private String _path;
380            private Date _pathDate;
381            private long _columnBitmask;
382            private UserTrackerPath _escapedModel;
383    }