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            @Override
090            public long getPrimaryKey() {
091                    return _userTrackerPathId;
092            }
093    
094            @Override
095            public void setPrimaryKey(long primaryKey) {
096                    setUserTrackerPathId(primaryKey);
097            }
098    
099            @Override
100            public Serializable getPrimaryKeyObj() {
101                    return _userTrackerPathId;
102            }
103    
104            @Override
105            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
106                    setPrimaryKey(((Long)primaryKeyObj).longValue());
107            }
108    
109            @Override
110            public Class<?> getModelClass() {
111                    return UserTrackerPath.class;
112            }
113    
114            @Override
115            public String getModelClassName() {
116                    return UserTrackerPath.class.getName();
117            }
118    
119            @Override
120            public Map<String, Object> getModelAttributes() {
121                    Map<String, Object> attributes = new HashMap<String, Object>();
122    
123                    attributes.put("userTrackerPathId", getUserTrackerPathId());
124                    attributes.put("userTrackerId", getUserTrackerId());
125                    attributes.put("path", getPath());
126                    attributes.put("pathDate", getPathDate());
127    
128                    return attributes;
129            }
130    
131            @Override
132            public void setModelAttributes(Map<String, Object> attributes) {
133                    Long userTrackerPathId = (Long)attributes.get("userTrackerPathId");
134    
135                    if (userTrackerPathId != null) {
136                            setUserTrackerPathId(userTrackerPathId);
137                    }
138    
139                    Long userTrackerId = (Long)attributes.get("userTrackerId");
140    
141                    if (userTrackerId != null) {
142                            setUserTrackerId(userTrackerId);
143                    }
144    
145                    String path = (String)attributes.get("path");
146    
147                    if (path != null) {
148                            setPath(path);
149                    }
150    
151                    Date pathDate = (Date)attributes.get("pathDate");
152    
153                    if (pathDate != null) {
154                            setPathDate(pathDate);
155                    }
156            }
157    
158            @Override
159            public long getUserTrackerPathId() {
160                    return _userTrackerPathId;
161            }
162    
163            @Override
164            public void setUserTrackerPathId(long userTrackerPathId) {
165                    _userTrackerPathId = userTrackerPathId;
166            }
167    
168            @Override
169            public long getUserTrackerId() {
170                    return _userTrackerId;
171            }
172    
173            @Override
174            public void setUserTrackerId(long userTrackerId) {
175                    _columnBitmask |= USERTRACKERID_COLUMN_BITMASK;
176    
177                    if (!_setOriginalUserTrackerId) {
178                            _setOriginalUserTrackerId = true;
179    
180                            _originalUserTrackerId = _userTrackerId;
181                    }
182    
183                    _userTrackerId = userTrackerId;
184            }
185    
186            public long getOriginalUserTrackerId() {
187                    return _originalUserTrackerId;
188            }
189    
190            @Override
191            public String getPath() {
192                    if (_path == null) {
193                            return StringPool.BLANK;
194                    }
195                    else {
196                            return _path;
197                    }
198            }
199    
200            @Override
201            public void setPath(String path) {
202                    _path = path;
203            }
204    
205            @Override
206            public Date getPathDate() {
207                    return _pathDate;
208            }
209    
210            @Override
211            public void setPathDate(Date pathDate) {
212                    _pathDate = pathDate;
213            }
214    
215            public long getColumnBitmask() {
216                    return _columnBitmask;
217            }
218    
219            @Override
220            public ExpandoBridge getExpandoBridge() {
221                    return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
222                            UserTrackerPath.class.getName(), getPrimaryKey());
223            }
224    
225            @Override
226            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
227                    ExpandoBridge expandoBridge = getExpandoBridge();
228    
229                    expandoBridge.setAttributes(serviceContext);
230            }
231    
232            @Override
233            public UserTrackerPath toEscapedModel() {
234                    if (_escapedModel == null) {
235                            _escapedModel = (UserTrackerPath)ProxyUtil.newProxyInstance(_classLoader,
236                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
237                    }
238    
239                    return _escapedModel;
240            }
241    
242            @Override
243            public Object clone() {
244                    UserTrackerPathImpl userTrackerPathImpl = new UserTrackerPathImpl();
245    
246                    userTrackerPathImpl.setUserTrackerPathId(getUserTrackerPathId());
247                    userTrackerPathImpl.setUserTrackerId(getUserTrackerId());
248                    userTrackerPathImpl.setPath(getPath());
249                    userTrackerPathImpl.setPathDate(getPathDate());
250    
251                    userTrackerPathImpl.resetOriginalValues();
252    
253                    return userTrackerPathImpl;
254            }
255    
256            @Override
257            public int compareTo(UserTrackerPath userTrackerPath) {
258                    long primaryKey = userTrackerPath.getPrimaryKey();
259    
260                    if (getPrimaryKey() < primaryKey) {
261                            return -1;
262                    }
263                    else if (getPrimaryKey() > primaryKey) {
264                            return 1;
265                    }
266                    else {
267                            return 0;
268                    }
269            }
270    
271            @Override
272            public boolean equals(Object obj) {
273                    if (this == obj) {
274                            return true;
275                    }
276    
277                    if (!(obj instanceof UserTrackerPath)) {
278                            return false;
279                    }
280    
281                    UserTrackerPath userTrackerPath = (UserTrackerPath)obj;
282    
283                    long primaryKey = userTrackerPath.getPrimaryKey();
284    
285                    if (getPrimaryKey() == primaryKey) {
286                            return true;
287                    }
288                    else {
289                            return false;
290                    }
291            }
292    
293            @Override
294            public int hashCode() {
295                    return (int)getPrimaryKey();
296            }
297    
298            @Override
299            public void resetOriginalValues() {
300                    UserTrackerPathModelImpl userTrackerPathModelImpl = this;
301    
302                    userTrackerPathModelImpl._originalUserTrackerId = userTrackerPathModelImpl._userTrackerId;
303    
304                    userTrackerPathModelImpl._setOriginalUserTrackerId = false;
305    
306                    userTrackerPathModelImpl._columnBitmask = 0;
307            }
308    
309            @Override
310            public CacheModel<UserTrackerPath> toCacheModel() {
311                    UserTrackerPathCacheModel userTrackerPathCacheModel = new UserTrackerPathCacheModel();
312    
313                    userTrackerPathCacheModel.userTrackerPathId = getUserTrackerPathId();
314    
315                    userTrackerPathCacheModel.userTrackerId = getUserTrackerId();
316    
317                    userTrackerPathCacheModel.path = getPath();
318    
319                    String path = userTrackerPathCacheModel.path;
320    
321                    if ((path != null) && (path.length() == 0)) {
322                            userTrackerPathCacheModel.path = null;
323                    }
324    
325                    Date pathDate = getPathDate();
326    
327                    if (pathDate != null) {
328                            userTrackerPathCacheModel.pathDate = pathDate.getTime();
329                    }
330                    else {
331                            userTrackerPathCacheModel.pathDate = Long.MIN_VALUE;
332                    }
333    
334                    return userTrackerPathCacheModel;
335            }
336    
337            @Override
338            public String toString() {
339                    StringBundler sb = new StringBundler(9);
340    
341                    sb.append("{userTrackerPathId=");
342                    sb.append(getUserTrackerPathId());
343                    sb.append(", userTrackerId=");
344                    sb.append(getUserTrackerId());
345                    sb.append(", path=");
346                    sb.append(getPath());
347                    sb.append(", pathDate=");
348                    sb.append(getPathDate());
349                    sb.append("}");
350    
351                    return sb.toString();
352            }
353    
354            @Override
355            public String toXmlString() {
356                    StringBundler sb = new StringBundler(16);
357    
358                    sb.append("<model><model-name>");
359                    sb.append("com.liferay.portal.model.UserTrackerPath");
360                    sb.append("</model-name>");
361    
362                    sb.append(
363                            "<column><column-name>userTrackerPathId</column-name><column-value><![CDATA[");
364                    sb.append(getUserTrackerPathId());
365                    sb.append("]]></column-value></column>");
366                    sb.append(
367                            "<column><column-name>userTrackerId</column-name><column-value><![CDATA[");
368                    sb.append(getUserTrackerId());
369                    sb.append("]]></column-value></column>");
370                    sb.append(
371                            "<column><column-name>path</column-name><column-value><![CDATA[");
372                    sb.append(getPath());
373                    sb.append("]]></column-value></column>");
374                    sb.append(
375                            "<column><column-name>pathDate</column-name><column-value><![CDATA[");
376                    sb.append(getPathDate());
377                    sb.append("]]></column-value></column>");
378    
379                    sb.append("</model>");
380    
381                    return sb.toString();
382            }
383    
384            private static ClassLoader _classLoader = UserTrackerPath.class.getClassLoader();
385            private static Class<?>[] _escapedModelInterfaces = new Class[] {
386                            UserTrackerPath.class
387                    };
388            private long _userTrackerPathId;
389            private long _userTrackerId;
390            private long _originalUserTrackerId;
391            private boolean _setOriginalUserTrackerId;
392            private String _path;
393            private Date _pathDate;
394            private long _columnBitmask;
395            private UserTrackerPath _escapedModel;
396    }