001    /**
002     * Copyright (c) 2000-2010 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.exception.SystemException;
019    import com.liferay.portal.kernel.util.GetterUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.model.BrowserTracker;
022    import com.liferay.portal.model.BrowserTrackerModel;
023    import com.liferay.portal.service.ServiceContext;
024    import com.liferay.portal.util.PortalUtil;
025    
026    import com.liferay.portlet.expando.model.ExpandoBridge;
027    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
028    
029    import java.io.Serializable;
030    
031    import java.lang.reflect.Proxy;
032    
033    import java.sql.Types;
034    
035    /**
036     * The base model implementation for the BrowserTracker service. Represents a row in the "BrowserTracker" database table, with each column mapped to a property of this class.
037     *
038     * <p>
039     * This implementation and its corresponding interface {@link com.liferay.portal.model.BrowserTrackerModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link BrowserTrackerImpl}.
040     * </p>
041     *
042     * <p>
043     * Never modify or reference this class directly. All methods that expect a browser tracker model instance should use the {@link com.liferay.portal.model.BrowserTracker} interface instead.
044     * </p>
045     *
046     * @author Brian Wing Shun Chan
047     * @see BrowserTrackerImpl
048     * @see com.liferay.portal.model.BrowserTracker
049     * @see com.liferay.portal.model.BrowserTrackerModel
050     * @generated
051     */
052    public class BrowserTrackerModelImpl extends BaseModelImpl<BrowserTracker>
053            implements BrowserTrackerModel {
054            public static final String TABLE_NAME = "BrowserTracker";
055            public static final Object[][] TABLE_COLUMNS = {
056                            { "browserTrackerId", new Integer(Types.BIGINT) },
057                            { "userId", new Integer(Types.BIGINT) },
058                            { "browserKey", new Integer(Types.BIGINT) }
059                    };
060            public static final String TABLE_SQL_CREATE = "create table BrowserTracker (browserTrackerId LONG not null primary key,userId LONG,browserKey LONG)";
061            public static final String TABLE_SQL_DROP = "drop table BrowserTracker";
062            public static final String DATA_SOURCE = "liferayDataSource";
063            public static final String SESSION_FACTORY = "liferaySessionFactory";
064            public static final String TX_MANAGER = "liferayTransactionManager";
065            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
066                                    "value.object.entity.cache.enabled.com.liferay.portal.model.BrowserTracker"),
067                            true);
068            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
069                                    "value.object.finder.cache.enabled.com.liferay.portal.model.BrowserTracker"),
070                            true);
071            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
072                                    "lock.expiration.time.com.liferay.portal.model.BrowserTracker"));
073    
074            public BrowserTrackerModelImpl() {
075            }
076    
077            public long getPrimaryKey() {
078                    return _browserTrackerId;
079            }
080    
081            public void setPrimaryKey(long pk) {
082                    setBrowserTrackerId(pk);
083            }
084    
085            public Serializable getPrimaryKeyObj() {
086                    return new Long(_browserTrackerId);
087            }
088    
089            public long getBrowserTrackerId() {
090                    return _browserTrackerId;
091            }
092    
093            public void setBrowserTrackerId(long browserTrackerId) {
094                    _browserTrackerId = browserTrackerId;
095            }
096    
097            public long getUserId() {
098                    return _userId;
099            }
100    
101            public void setUserId(long userId) {
102                    _userId = userId;
103    
104                    if (!_setOriginalUserId) {
105                            _setOriginalUserId = true;
106    
107                            _originalUserId = userId;
108                    }
109            }
110    
111            public String getUserUuid() throws SystemException {
112                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
113            }
114    
115            public void setUserUuid(String userUuid) {
116                    _userUuid = userUuid;
117            }
118    
119            public long getOriginalUserId() {
120                    return _originalUserId;
121            }
122    
123            public long getBrowserKey() {
124                    return _browserKey;
125            }
126    
127            public void setBrowserKey(long browserKey) {
128                    _browserKey = browserKey;
129            }
130    
131            public BrowserTracker toEscapedModel() {
132                    if (isEscapedModel()) {
133                            return (BrowserTracker)this;
134                    }
135                    else {
136                            return (BrowserTracker)Proxy.newProxyInstance(BrowserTracker.class.getClassLoader(),
137                                    new Class[] { BrowserTracker.class },
138                                    new AutoEscapeBeanHandler(this));
139                    }
140            }
141    
142            public ExpandoBridge getExpandoBridge() {
143                    if (_expandoBridge == null) {
144                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
145                                            BrowserTracker.class.getName(), getPrimaryKey());
146                    }
147    
148                    return _expandoBridge;
149            }
150    
151            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
152                    getExpandoBridge().setAttributes(serviceContext);
153            }
154    
155            public Object clone() {
156                    BrowserTrackerImpl clone = new BrowserTrackerImpl();
157    
158                    clone.setBrowserTrackerId(getBrowserTrackerId());
159                    clone.setUserId(getUserId());
160                    clone.setBrowserKey(getBrowserKey());
161    
162                    return clone;
163            }
164    
165            public int compareTo(BrowserTracker browserTracker) {
166                    long pk = browserTracker.getPrimaryKey();
167    
168                    if (getPrimaryKey() < pk) {
169                            return -1;
170                    }
171                    else if (getPrimaryKey() > pk) {
172                            return 1;
173                    }
174                    else {
175                            return 0;
176                    }
177            }
178    
179            public boolean equals(Object obj) {
180                    if (obj == null) {
181                            return false;
182                    }
183    
184                    BrowserTracker browserTracker = null;
185    
186                    try {
187                            browserTracker = (BrowserTracker)obj;
188                    }
189                    catch (ClassCastException cce) {
190                            return false;
191                    }
192    
193                    long pk = browserTracker.getPrimaryKey();
194    
195                    if (getPrimaryKey() == pk) {
196                            return true;
197                    }
198                    else {
199                            return false;
200                    }
201            }
202    
203            public int hashCode() {
204                    return (int)getPrimaryKey();
205            }
206    
207            public String toString() {
208                    StringBundler sb = new StringBundler(7);
209    
210                    sb.append("{browserTrackerId=");
211                    sb.append(getBrowserTrackerId());
212                    sb.append(", userId=");
213                    sb.append(getUserId());
214                    sb.append(", browserKey=");
215                    sb.append(getBrowserKey());
216                    sb.append("}");
217    
218                    return sb.toString();
219            }
220    
221            public String toXmlString() {
222                    StringBundler sb = new StringBundler(13);
223    
224                    sb.append("<model><model-name>");
225                    sb.append("com.liferay.portal.model.BrowserTracker");
226                    sb.append("</model-name>");
227    
228                    sb.append(
229                            "<column><column-name>browserTrackerId</column-name><column-value><![CDATA[");
230                    sb.append(getBrowserTrackerId());
231                    sb.append("]]></column-value></column>");
232                    sb.append(
233                            "<column><column-name>userId</column-name><column-value><![CDATA[");
234                    sb.append(getUserId());
235                    sb.append("]]></column-value></column>");
236                    sb.append(
237                            "<column><column-name>browserKey</column-name><column-value><![CDATA[");
238                    sb.append(getBrowserKey());
239                    sb.append("]]></column-value></column>");
240    
241                    sb.append("</model>");
242    
243                    return sb.toString();
244            }
245    
246            private long _browserTrackerId;
247            private long _userId;
248            private String _userUuid;
249            private long _originalUserId;
250            private boolean _setOriginalUserId;
251            private long _browserKey;
252            private transient ExpandoBridge _expandoBridge;
253    }