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.portlet.social.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.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.impl.BaseModelImpl;
022    import com.liferay.portal.service.ServiceContext;
023    import com.liferay.portal.util.PortalUtil;
024    
025    import com.liferay.portlet.expando.model.ExpandoBridge;
026    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
027    import com.liferay.portlet.social.model.SocialEquitySetting;
028    import com.liferay.portlet.social.model.SocialEquitySettingModel;
029    
030    import java.io.Serializable;
031    
032    import java.lang.reflect.Proxy;
033    
034    import java.sql.Types;
035    
036    /**
037     * The base model implementation for the SocialEquitySetting service. Represents a row in the "SocialEquitySetting" database table, with each column mapped to a property of this class.
038     *
039     * <p>
040     * This implementation and its corresponding interface {@link com.liferay.portlet.social.model.SocialEquitySettingModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link SocialEquitySettingImpl}.
041     * </p>
042     *
043     * <p>
044     * Never modify or reference this class directly. All methods that expect a social equity setting model instance should use the {@link com.liferay.portlet.social.model.SocialEquitySetting} interface instead.
045     * </p>
046     *
047     * @author Brian Wing Shun Chan
048     * @see SocialEquitySettingImpl
049     * @see com.liferay.portlet.social.model.SocialEquitySetting
050     * @see com.liferay.portlet.social.model.SocialEquitySettingModel
051     * @generated
052     */
053    public class SocialEquitySettingModelImpl extends BaseModelImpl<SocialEquitySetting>
054            implements SocialEquitySettingModel {
055            public static final String TABLE_NAME = "SocialEquitySetting";
056            public static final Object[][] TABLE_COLUMNS = {
057                            { "equitySettingId", new Integer(Types.BIGINT) },
058                            { "groupId", new Integer(Types.BIGINT) },
059                            { "companyId", new Integer(Types.BIGINT) },
060                            { "classNameId", new Integer(Types.BIGINT) },
061                            { "actionId", new Integer(Types.VARCHAR) },
062                            { "dailyLimit", new Integer(Types.INTEGER) },
063                            { "lifespan", new Integer(Types.INTEGER) },
064                            { "type_", new Integer(Types.INTEGER) },
065                            { "uniqueEntry", new Integer(Types.BOOLEAN) },
066                            { "value", new Integer(Types.INTEGER) }
067                    };
068            public static final String TABLE_SQL_CREATE = "create table SocialEquitySetting (equitySettingId LONG not null primary key,groupId LONG,companyId LONG,classNameId LONG,actionId VARCHAR(75) null,dailyLimit INTEGER,lifespan INTEGER,type_ INTEGER,uniqueEntry BOOLEAN,value INTEGER)";
069            public static final String TABLE_SQL_DROP = "drop table SocialEquitySetting";
070            public static final String DATA_SOURCE = "liferayDataSource";
071            public static final String SESSION_FACTORY = "liferaySessionFactory";
072            public static final String TX_MANAGER = "liferayTransactionManager";
073            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
074                                    "value.object.entity.cache.enabled.com.liferay.portlet.social.model.SocialEquitySetting"),
075                            true);
076            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
077                                    "value.object.finder.cache.enabled.com.liferay.portlet.social.model.SocialEquitySetting"),
078                            true);
079            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
080                                    "lock.expiration.time.com.liferay.portlet.social.model.SocialEquitySetting"));
081    
082            public SocialEquitySettingModelImpl() {
083            }
084    
085            public long getPrimaryKey() {
086                    return _equitySettingId;
087            }
088    
089            public void setPrimaryKey(long pk) {
090                    setEquitySettingId(pk);
091            }
092    
093            public Serializable getPrimaryKeyObj() {
094                    return new Long(_equitySettingId);
095            }
096    
097            public long getEquitySettingId() {
098                    return _equitySettingId;
099            }
100    
101            public void setEquitySettingId(long equitySettingId) {
102                    _equitySettingId = equitySettingId;
103            }
104    
105            public long getGroupId() {
106                    return _groupId;
107            }
108    
109            public void setGroupId(long groupId) {
110                    _groupId = groupId;
111    
112                    if (!_setOriginalGroupId) {
113                            _setOriginalGroupId = true;
114    
115                            _originalGroupId = groupId;
116                    }
117            }
118    
119            public long getOriginalGroupId() {
120                    return _originalGroupId;
121            }
122    
123            public long getCompanyId() {
124                    return _companyId;
125            }
126    
127            public void setCompanyId(long companyId) {
128                    _companyId = companyId;
129            }
130    
131            public String getClassName() {
132                    if (getClassNameId() <= 0) {
133                            return StringPool.BLANK;
134                    }
135    
136                    return PortalUtil.getClassName(getClassNameId());
137            }
138    
139            public long getClassNameId() {
140                    return _classNameId;
141            }
142    
143            public void setClassNameId(long classNameId) {
144                    _classNameId = classNameId;
145    
146                    if (!_setOriginalClassNameId) {
147                            _setOriginalClassNameId = true;
148    
149                            _originalClassNameId = classNameId;
150                    }
151            }
152    
153            public long getOriginalClassNameId() {
154                    return _originalClassNameId;
155            }
156    
157            public String getActionId() {
158                    if (_actionId == null) {
159                            return StringPool.BLANK;
160                    }
161                    else {
162                            return _actionId;
163                    }
164            }
165    
166            public void setActionId(String actionId) {
167                    _actionId = actionId;
168    
169                    if (_originalActionId == null) {
170                            _originalActionId = actionId;
171                    }
172            }
173    
174            public String getOriginalActionId() {
175                    return GetterUtil.getString(_originalActionId);
176            }
177    
178            public int getDailyLimit() {
179                    return _dailyLimit;
180            }
181    
182            public void setDailyLimit(int dailyLimit) {
183                    _dailyLimit = dailyLimit;
184            }
185    
186            public int getLifespan() {
187                    return _lifespan;
188            }
189    
190            public void setLifespan(int lifespan) {
191                    _lifespan = lifespan;
192            }
193    
194            public int getType() {
195                    return _type;
196            }
197    
198            public void setType(int type) {
199                    _type = type;
200    
201                    if (!_setOriginalType) {
202                            _setOriginalType = true;
203    
204                            _originalType = type;
205                    }
206            }
207    
208            public int getOriginalType() {
209                    return _originalType;
210            }
211    
212            public boolean getUniqueEntry() {
213                    return _uniqueEntry;
214            }
215    
216            public boolean isUniqueEntry() {
217                    return _uniqueEntry;
218            }
219    
220            public void setUniqueEntry(boolean uniqueEntry) {
221                    _uniqueEntry = uniqueEntry;
222            }
223    
224            public int getValue() {
225                    return _value;
226            }
227    
228            public void setValue(int value) {
229                    _value = value;
230            }
231    
232            public SocialEquitySetting toEscapedModel() {
233                    if (isEscapedModel()) {
234                            return (SocialEquitySetting)this;
235                    }
236                    else {
237                            return (SocialEquitySetting)Proxy.newProxyInstance(SocialEquitySetting.class.getClassLoader(),
238                                    new Class[] { SocialEquitySetting.class },
239                                    new AutoEscapeBeanHandler(this));
240                    }
241            }
242    
243            public ExpandoBridge getExpandoBridge() {
244                    if (_expandoBridge == null) {
245                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
246                                            SocialEquitySetting.class.getName(), getPrimaryKey());
247                    }
248    
249                    return _expandoBridge;
250            }
251    
252            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
253                    getExpandoBridge().setAttributes(serviceContext);
254            }
255    
256            public Object clone() {
257                    SocialEquitySettingImpl clone = new SocialEquitySettingImpl();
258    
259                    clone.setEquitySettingId(getEquitySettingId());
260                    clone.setGroupId(getGroupId());
261                    clone.setCompanyId(getCompanyId());
262                    clone.setClassNameId(getClassNameId());
263                    clone.setActionId(getActionId());
264                    clone.setDailyLimit(getDailyLimit());
265                    clone.setLifespan(getLifespan());
266                    clone.setType(getType());
267                    clone.setUniqueEntry(getUniqueEntry());
268                    clone.setValue(getValue());
269    
270                    return clone;
271            }
272    
273            public int compareTo(SocialEquitySetting socialEquitySetting) {
274                    long pk = socialEquitySetting.getPrimaryKey();
275    
276                    if (getPrimaryKey() < pk) {
277                            return -1;
278                    }
279                    else if (getPrimaryKey() > pk) {
280                            return 1;
281                    }
282                    else {
283                            return 0;
284                    }
285            }
286    
287            public boolean equals(Object obj) {
288                    if (obj == null) {
289                            return false;
290                    }
291    
292                    SocialEquitySetting socialEquitySetting = null;
293    
294                    try {
295                            socialEquitySetting = (SocialEquitySetting)obj;
296                    }
297                    catch (ClassCastException cce) {
298                            return false;
299                    }
300    
301                    long pk = socialEquitySetting.getPrimaryKey();
302    
303                    if (getPrimaryKey() == pk) {
304                            return true;
305                    }
306                    else {
307                            return false;
308                    }
309            }
310    
311            public int hashCode() {
312                    return (int)getPrimaryKey();
313            }
314    
315            public String toString() {
316                    StringBundler sb = new StringBundler(21);
317    
318                    sb.append("{equitySettingId=");
319                    sb.append(getEquitySettingId());
320                    sb.append(", groupId=");
321                    sb.append(getGroupId());
322                    sb.append(", companyId=");
323                    sb.append(getCompanyId());
324                    sb.append(", classNameId=");
325                    sb.append(getClassNameId());
326                    sb.append(", actionId=");
327                    sb.append(getActionId());
328                    sb.append(", dailyLimit=");
329                    sb.append(getDailyLimit());
330                    sb.append(", lifespan=");
331                    sb.append(getLifespan());
332                    sb.append(", type=");
333                    sb.append(getType());
334                    sb.append(", uniqueEntry=");
335                    sb.append(getUniqueEntry());
336                    sb.append(", value=");
337                    sb.append(getValue());
338                    sb.append("}");
339    
340                    return sb.toString();
341            }
342    
343            public String toXmlString() {
344                    StringBundler sb = new StringBundler(34);
345    
346                    sb.append("<model><model-name>");
347                    sb.append("com.liferay.portlet.social.model.SocialEquitySetting");
348                    sb.append("</model-name>");
349    
350                    sb.append(
351                            "<column><column-name>equitySettingId</column-name><column-value><![CDATA[");
352                    sb.append(getEquitySettingId());
353                    sb.append("]]></column-value></column>");
354                    sb.append(
355                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
356                    sb.append(getGroupId());
357                    sb.append("]]></column-value></column>");
358                    sb.append(
359                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
360                    sb.append(getCompanyId());
361                    sb.append("]]></column-value></column>");
362                    sb.append(
363                            "<column><column-name>classNameId</column-name><column-value><![CDATA[");
364                    sb.append(getClassNameId());
365                    sb.append("]]></column-value></column>");
366                    sb.append(
367                            "<column><column-name>actionId</column-name><column-value><![CDATA[");
368                    sb.append(getActionId());
369                    sb.append("]]></column-value></column>");
370                    sb.append(
371                            "<column><column-name>dailyLimit</column-name><column-value><![CDATA[");
372                    sb.append(getDailyLimit());
373                    sb.append("]]></column-value></column>");
374                    sb.append(
375                            "<column><column-name>lifespan</column-name><column-value><![CDATA[");
376                    sb.append(getLifespan());
377                    sb.append("]]></column-value></column>");
378                    sb.append(
379                            "<column><column-name>type</column-name><column-value><![CDATA[");
380                    sb.append(getType());
381                    sb.append("]]></column-value></column>");
382                    sb.append(
383                            "<column><column-name>uniqueEntry</column-name><column-value><![CDATA[");
384                    sb.append(getUniqueEntry());
385                    sb.append("]]></column-value></column>");
386                    sb.append(
387                            "<column><column-name>value</column-name><column-value><![CDATA[");
388                    sb.append(getValue());
389                    sb.append("]]></column-value></column>");
390    
391                    sb.append("</model>");
392    
393                    return sb.toString();
394            }
395    
396            private long _equitySettingId;
397            private long _groupId;
398            private long _originalGroupId;
399            private boolean _setOriginalGroupId;
400            private long _companyId;
401            private long _classNameId;
402            private long _originalClassNameId;
403            private boolean _setOriginalClassNameId;
404            private String _actionId;
405            private String _originalActionId;
406            private int _dailyLimit;
407            private int _lifespan;
408            private int _type;
409            private int _originalType;
410            private boolean _setOriginalType;
411            private boolean _uniqueEntry;
412            private int _value;
413            private transient ExpandoBridge _expandoBridge;
414    }