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