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