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