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