001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
020    import com.liferay.portal.kernel.util.GetterUtil;
021    import com.liferay.portal.kernel.util.ProxyUtil;
022    import com.liferay.portal.kernel.util.StringBundler;
023    import com.liferay.portal.kernel.util.StringPool;
024    import com.liferay.portal.model.CacheModel;
025    import com.liferay.portal.model.UserTrackerPath;
026    import com.liferay.portal.model.UserTrackerPathModel;
027    import com.liferay.portal.service.ServiceContext;
028    
029    import com.liferay.portlet.expando.model.ExpandoBridge;
030    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
031    
032    import java.io.Serializable;
033    
034    import java.sql.Types;
035    
036    import java.util.Date;
037    import java.util.HashMap;
038    import java.util.Map;
039    
040    /**
041     * 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.
042     *
043     * <p>
044     * This implementation and its corresponding interface {@link 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}.
045     * </p>
046     *
047     * @author Brian Wing Shun Chan
048     * @see UserTrackerPathImpl
049     * @see UserTrackerPath
050     * @see UserTrackerPathModel
051     * @generated
052     */
053    @ProviderType
054    public class UserTrackerPathModelImpl extends BaseModelImpl<UserTrackerPath>
055            implements UserTrackerPathModel {
056            /*
057             * NOTE FOR DEVELOPERS:
058             *
059             * Never modify or reference this class directly. All methods that expect a user tracker path model instance should use the {@link UserTrackerPath} interface instead.
060             */
061            public static final String TABLE_NAME = "UserTrackerPath";
062            public static final Object[][] TABLE_COLUMNS = {
063                            { "mvccVersion", Types.BIGINT },
064                            { "userTrackerPathId", Types.BIGINT },
065                            { "userTrackerId", Types.BIGINT },
066                            { "path_", Types.VARCHAR },
067                            { "pathDate", Types.TIMESTAMP }
068                    };
069            public static final Map<String, Integer> TABLE_COLUMNS_MAP = new HashMap<String, Integer>();
070    
071            static {
072                    TABLE_COLUMNS_MAP.put("mvccVersion", Types.BIGINT);
073                    TABLE_COLUMNS_MAP.put("userTrackerPathId", Types.BIGINT);
074                    TABLE_COLUMNS_MAP.put("userTrackerId", Types.BIGINT);
075                    TABLE_COLUMNS_MAP.put("path_", Types.VARCHAR);
076                    TABLE_COLUMNS_MAP.put("pathDate", Types.TIMESTAMP);
077            }
078    
079            public static final String TABLE_SQL_CREATE = "create table UserTrackerPath (mvccVersion LONG default 0,userTrackerPathId LONG not null primary key,userTrackerId LONG,path_ STRING null,pathDate DATE null)";
080            public static final String TABLE_SQL_DROP = "drop table UserTrackerPath";
081            public static final String ORDER_BY_JPQL = " ORDER BY userTrackerPath.userTrackerPathId ASC";
082            public static final String ORDER_BY_SQL = " ORDER BY UserTrackerPath.userTrackerPathId ASC";
083            public static final String DATA_SOURCE = "liferayDataSource";
084            public static final String SESSION_FACTORY = "liferaySessionFactory";
085            public static final String TX_MANAGER = "liferayTransactionManager";
086            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
087                                    "value.object.entity.cache.enabled.com.liferay.portal.model.UserTrackerPath"),
088                            true);
089            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
090                                    "value.object.finder.cache.enabled.com.liferay.portal.model.UserTrackerPath"),
091                            true);
092            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
093                                    "value.object.column.bitmask.enabled.com.liferay.portal.model.UserTrackerPath"),
094                            true);
095            public static final long USERTRACKERID_COLUMN_BITMASK = 1L;
096            public static final long USERTRACKERPATHID_COLUMN_BITMASK = 2L;
097            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
098                                    "lock.expiration.time.com.liferay.portal.model.UserTrackerPath"));
099    
100            public UserTrackerPathModelImpl() {
101            }
102    
103            @Override
104            public long getPrimaryKey() {
105                    return _userTrackerPathId;
106            }
107    
108            @Override
109            public void setPrimaryKey(long primaryKey) {
110                    setUserTrackerPathId(primaryKey);
111            }
112    
113            @Override
114            public Serializable getPrimaryKeyObj() {
115                    return _userTrackerPathId;
116            }
117    
118            @Override
119            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
120                    setPrimaryKey(((Long)primaryKeyObj).longValue());
121            }
122    
123            @Override
124            public Class<?> getModelClass() {
125                    return UserTrackerPath.class;
126            }
127    
128            @Override
129            public String getModelClassName() {
130                    return UserTrackerPath.class.getName();
131            }
132    
133            @Override
134            public Map<String, Object> getModelAttributes() {
135                    Map<String, Object> attributes = new HashMap<String, Object>();
136    
137                    attributes.put("mvccVersion", getMvccVersion());
138                    attributes.put("userTrackerPathId", getUserTrackerPathId());
139                    attributes.put("userTrackerId", getUserTrackerId());
140                    attributes.put("path", getPath());
141                    attributes.put("pathDate", getPathDate());
142    
143                    attributes.put("entityCacheEnabled", isEntityCacheEnabled());
144                    attributes.put("finderCacheEnabled", isFinderCacheEnabled());
145    
146                    return attributes;
147            }
148    
149            @Override
150            public void setModelAttributes(Map<String, Object> attributes) {
151                    Long mvccVersion = (Long)attributes.get("mvccVersion");
152    
153                    if (mvccVersion != null) {
154                            setMvccVersion(mvccVersion);
155                    }
156    
157                    Long userTrackerPathId = (Long)attributes.get("userTrackerPathId");
158    
159                    if (userTrackerPathId != null) {
160                            setUserTrackerPathId(userTrackerPathId);
161                    }
162    
163                    Long userTrackerId = (Long)attributes.get("userTrackerId");
164    
165                    if (userTrackerId != null) {
166                            setUserTrackerId(userTrackerId);
167                    }
168    
169                    String path = (String)attributes.get("path");
170    
171                    if (path != null) {
172                            setPath(path);
173                    }
174    
175                    Date pathDate = (Date)attributes.get("pathDate");
176    
177                    if (pathDate != null) {
178                            setPathDate(pathDate);
179                    }
180            }
181    
182            @Override
183            public long getMvccVersion() {
184                    return _mvccVersion;
185            }
186    
187            @Override
188            public void setMvccVersion(long mvccVersion) {
189                    _mvccVersion = mvccVersion;
190            }
191    
192            @Override
193            public long getUserTrackerPathId() {
194                    return _userTrackerPathId;
195            }
196    
197            @Override
198            public void setUserTrackerPathId(long userTrackerPathId) {
199                    _userTrackerPathId = userTrackerPathId;
200            }
201    
202            @Override
203            public long getUserTrackerId() {
204                    return _userTrackerId;
205            }
206    
207            @Override
208            public void setUserTrackerId(long userTrackerId) {
209                    _columnBitmask |= USERTRACKERID_COLUMN_BITMASK;
210    
211                    if (!_setOriginalUserTrackerId) {
212                            _setOriginalUserTrackerId = true;
213    
214                            _originalUserTrackerId = _userTrackerId;
215                    }
216    
217                    _userTrackerId = userTrackerId;
218            }
219    
220            public long getOriginalUserTrackerId() {
221                    return _originalUserTrackerId;
222            }
223    
224            @Override
225            public String getPath() {
226                    if (_path == null) {
227                            return StringPool.BLANK;
228                    }
229                    else {
230                            return _path;
231                    }
232            }
233    
234            @Override
235            public void setPath(String path) {
236                    _path = path;
237            }
238    
239            @Override
240            public Date getPathDate() {
241                    return _pathDate;
242            }
243    
244            @Override
245            public void setPathDate(Date pathDate) {
246                    _pathDate = pathDate;
247            }
248    
249            public long getColumnBitmask() {
250                    return _columnBitmask;
251            }
252    
253            @Override
254            public ExpandoBridge getExpandoBridge() {
255                    return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
256                            UserTrackerPath.class.getName(), getPrimaryKey());
257            }
258    
259            @Override
260            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
261                    ExpandoBridge expandoBridge = getExpandoBridge();
262    
263                    expandoBridge.setAttributes(serviceContext);
264            }
265    
266            @Override
267            public UserTrackerPath toEscapedModel() {
268                    if (_escapedModel == null) {
269                            _escapedModel = (UserTrackerPath)ProxyUtil.newProxyInstance(_classLoader,
270                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
271                    }
272    
273                    return _escapedModel;
274            }
275    
276            @Override
277            public Object clone() {
278                    UserTrackerPathImpl userTrackerPathImpl = new UserTrackerPathImpl();
279    
280                    userTrackerPathImpl.setMvccVersion(getMvccVersion());
281                    userTrackerPathImpl.setUserTrackerPathId(getUserTrackerPathId());
282                    userTrackerPathImpl.setUserTrackerId(getUserTrackerId());
283                    userTrackerPathImpl.setPath(getPath());
284                    userTrackerPathImpl.setPathDate(getPathDate());
285    
286                    userTrackerPathImpl.resetOriginalValues();
287    
288                    return userTrackerPathImpl;
289            }
290    
291            @Override
292            public int compareTo(UserTrackerPath userTrackerPath) {
293                    long primaryKey = userTrackerPath.getPrimaryKey();
294    
295                    if (getPrimaryKey() < primaryKey) {
296                            return -1;
297                    }
298                    else if (getPrimaryKey() > primaryKey) {
299                            return 1;
300                    }
301                    else {
302                            return 0;
303                    }
304            }
305    
306            @Override
307            public boolean equals(Object obj) {
308                    if (this == obj) {
309                            return true;
310                    }
311    
312                    if (!(obj instanceof UserTrackerPath)) {
313                            return false;
314                    }
315    
316                    UserTrackerPath userTrackerPath = (UserTrackerPath)obj;
317    
318                    long primaryKey = userTrackerPath.getPrimaryKey();
319    
320                    if (getPrimaryKey() == primaryKey) {
321                            return true;
322                    }
323                    else {
324                            return false;
325                    }
326            }
327    
328            @Override
329            public int hashCode() {
330                    return (int)getPrimaryKey();
331            }
332    
333            @Override
334            public boolean isEntityCacheEnabled() {
335                    return ENTITY_CACHE_ENABLED;
336            }
337    
338            @Override
339            public boolean isFinderCacheEnabled() {
340                    return FINDER_CACHE_ENABLED;
341            }
342    
343            @Override
344            public void resetOriginalValues() {
345                    UserTrackerPathModelImpl userTrackerPathModelImpl = this;
346    
347                    userTrackerPathModelImpl._originalUserTrackerId = userTrackerPathModelImpl._userTrackerId;
348    
349                    userTrackerPathModelImpl._setOriginalUserTrackerId = false;
350    
351                    userTrackerPathModelImpl._columnBitmask = 0;
352            }
353    
354            @Override
355            public CacheModel<UserTrackerPath> toCacheModel() {
356                    UserTrackerPathCacheModel userTrackerPathCacheModel = new UserTrackerPathCacheModel();
357    
358                    userTrackerPathCacheModel.mvccVersion = getMvccVersion();
359    
360                    userTrackerPathCacheModel.userTrackerPathId = getUserTrackerPathId();
361    
362                    userTrackerPathCacheModel.userTrackerId = getUserTrackerId();
363    
364                    userTrackerPathCacheModel.path = getPath();
365    
366                    String path = userTrackerPathCacheModel.path;
367    
368                    if ((path != null) && (path.length() == 0)) {
369                            userTrackerPathCacheModel.path = null;
370                    }
371    
372                    Date pathDate = getPathDate();
373    
374                    if (pathDate != null) {
375                            userTrackerPathCacheModel.pathDate = pathDate.getTime();
376                    }
377                    else {
378                            userTrackerPathCacheModel.pathDate = Long.MIN_VALUE;
379                    }
380    
381                    return userTrackerPathCacheModel;
382            }
383    
384            @Override
385            public String toString() {
386                    StringBundler sb = new StringBundler(11);
387    
388                    sb.append("{mvccVersion=");
389                    sb.append(getMvccVersion());
390                    sb.append(", userTrackerPathId=");
391                    sb.append(getUserTrackerPathId());
392                    sb.append(", userTrackerId=");
393                    sb.append(getUserTrackerId());
394                    sb.append(", path=");
395                    sb.append(getPath());
396                    sb.append(", pathDate=");
397                    sb.append(getPathDate());
398                    sb.append("}");
399    
400                    return sb.toString();
401            }
402    
403            @Override
404            public String toXmlString() {
405                    StringBundler sb = new StringBundler(19);
406    
407                    sb.append("<model><model-name>");
408                    sb.append("com.liferay.portal.model.UserTrackerPath");
409                    sb.append("</model-name>");
410    
411                    sb.append(
412                            "<column><column-name>mvccVersion</column-name><column-value><![CDATA[");
413                    sb.append(getMvccVersion());
414                    sb.append("]]></column-value></column>");
415                    sb.append(
416                            "<column><column-name>userTrackerPathId</column-name><column-value><![CDATA[");
417                    sb.append(getUserTrackerPathId());
418                    sb.append("]]></column-value></column>");
419                    sb.append(
420                            "<column><column-name>userTrackerId</column-name><column-value><![CDATA[");
421                    sb.append(getUserTrackerId());
422                    sb.append("]]></column-value></column>");
423                    sb.append(
424                            "<column><column-name>path</column-name><column-value><![CDATA[");
425                    sb.append(getPath());
426                    sb.append("]]></column-value></column>");
427                    sb.append(
428                            "<column><column-name>pathDate</column-name><column-value><![CDATA[");
429                    sb.append(getPathDate());
430                    sb.append("]]></column-value></column>");
431    
432                    sb.append("</model>");
433    
434                    return sb.toString();
435            }
436    
437            private static final ClassLoader _classLoader = UserTrackerPath.class.getClassLoader();
438            private static final Class<?>[] _escapedModelInterfaces = new Class[] {
439                            UserTrackerPath.class
440                    };
441            private long _mvccVersion;
442            private long _userTrackerPathId;
443            private long _userTrackerId;
444            private long _originalUserTrackerId;
445            private boolean _setOriginalUserTrackerId;
446            private String _path;
447            private Date _pathDate;
448            private long _columnBitmask;
449            private UserTrackerPath _escapedModel;
450    }