001    /**
002     * Copyright (c) 2000-2011 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.SocialEquityGroupSetting;
028    import com.liferay.portlet.social.model.SocialEquityGroupSettingModel;
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 SocialEquityGroupSetting service. Represents a row in the "SocialEquityGroupSetting" 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.SocialEquityGroupSettingModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link SocialEquityGroupSettingImpl}.
041     * </p>
042     *
043     * <p>
044     * Never modify or reference this class directly. All methods that expect a social equity group setting model instance should use the {@link com.liferay.portlet.social.model.SocialEquityGroupSetting} interface instead.
045     * </p>
046     *
047     * @author Brian Wing Shun Chan
048     * @see SocialEquityGroupSettingImpl
049     * @see com.liferay.portlet.social.model.SocialEquityGroupSetting
050     * @see com.liferay.portlet.social.model.SocialEquityGroupSettingModel
051     * @generated
052     */
053    public class SocialEquityGroupSettingModelImpl extends BaseModelImpl<SocialEquityGroupSetting>
054            implements SocialEquityGroupSettingModel {
055            public static final String TABLE_NAME = "SocialEquityGroupSetting";
056            public static final Object[][] TABLE_COLUMNS = {
057                            { "equityGroupSettingId", new Integer(Types.BIGINT) },
058                            { "groupId", new Integer(Types.BIGINT) },
059                            { "companyId", new Integer(Types.BIGINT) },
060                            { "classNameId", new Integer(Types.BIGINT) },
061                            { "type_", new Integer(Types.INTEGER) },
062                            { "enabled", new Integer(Types.BOOLEAN) }
063                    };
064            public static final String TABLE_SQL_CREATE = "create table SocialEquityGroupSetting (equityGroupSettingId LONG not null primary key,groupId LONG,companyId LONG,classNameId LONG,type_ INTEGER,enabled BOOLEAN)";
065            public static final String TABLE_SQL_DROP = "drop table SocialEquityGroupSetting";
066            public static final String DATA_SOURCE = "liferayDataSource";
067            public static final String SESSION_FACTORY = "liferaySessionFactory";
068            public static final String TX_MANAGER = "liferayTransactionManager";
069            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
070                                    "value.object.entity.cache.enabled.com.liferay.portlet.social.model.SocialEquityGroupSetting"),
071                            true);
072            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
073                                    "value.object.finder.cache.enabled.com.liferay.portlet.social.model.SocialEquityGroupSetting"),
074                            true);
075            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
076                                    "lock.expiration.time.com.liferay.portlet.social.model.SocialEquityGroupSetting"));
077    
078            public SocialEquityGroupSettingModelImpl() {
079            }
080    
081            public long getPrimaryKey() {
082                    return _equityGroupSettingId;
083            }
084    
085            public void setPrimaryKey(long pk) {
086                    setEquityGroupSettingId(pk);
087            }
088    
089            public Serializable getPrimaryKeyObj() {
090                    return new Long(_equityGroupSettingId);
091            }
092    
093            public long getEquityGroupSettingId() {
094                    return _equityGroupSettingId;
095            }
096    
097            public void setEquityGroupSettingId(long equityGroupSettingId) {
098                    _equityGroupSettingId = equityGroupSettingId;
099            }
100    
101            public long getGroupId() {
102                    return _groupId;
103            }
104    
105            public void setGroupId(long groupId) {
106                    if (!_setOriginalGroupId) {
107                            _setOriginalGroupId = true;
108    
109                            _originalGroupId = _groupId;
110                    }
111    
112                    _groupId = groupId;
113            }
114    
115            public long getOriginalGroupId() {
116                    return _originalGroupId;
117            }
118    
119            public long getCompanyId() {
120                    return _companyId;
121            }
122    
123            public void setCompanyId(long companyId) {
124                    _companyId = companyId;
125            }
126    
127            public String getClassName() {
128                    if (getClassNameId() <= 0) {
129                            return StringPool.BLANK;
130                    }
131    
132                    return PortalUtil.getClassName(getClassNameId());
133            }
134    
135            public long getClassNameId() {
136                    return _classNameId;
137            }
138    
139            public void setClassNameId(long classNameId) {
140                    if (!_setOriginalClassNameId) {
141                            _setOriginalClassNameId = true;
142    
143                            _originalClassNameId = _classNameId;
144                    }
145    
146                    _classNameId = classNameId;
147            }
148    
149            public long getOriginalClassNameId() {
150                    return _originalClassNameId;
151            }
152    
153            public int getType() {
154                    return _type;
155            }
156    
157            public void setType(int type) {
158                    if (!_setOriginalType) {
159                            _setOriginalType = true;
160    
161                            _originalType = _type;
162                    }
163    
164                    _type = type;
165            }
166    
167            public int getOriginalType() {
168                    return _originalType;
169            }
170    
171            public boolean getEnabled() {
172                    return _enabled;
173            }
174    
175            public boolean isEnabled() {
176                    return _enabled;
177            }
178    
179            public void setEnabled(boolean enabled) {
180                    _enabled = enabled;
181            }
182    
183            public SocialEquityGroupSetting toEscapedModel() {
184                    if (isEscapedModel()) {
185                            return (SocialEquityGroupSetting)this;
186                    }
187                    else {
188                            return (SocialEquityGroupSetting)Proxy.newProxyInstance(SocialEquityGroupSetting.class.getClassLoader(),
189                                    new Class[] { SocialEquityGroupSetting.class },
190                                    new AutoEscapeBeanHandler(this));
191                    }
192            }
193    
194            public ExpandoBridge getExpandoBridge() {
195                    if (_expandoBridge == null) {
196                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
197                                            SocialEquityGroupSetting.class.getName(), getPrimaryKey());
198                    }
199    
200                    return _expandoBridge;
201            }
202    
203            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
204                    getExpandoBridge().setAttributes(serviceContext);
205            }
206    
207            public Object clone() {
208                    SocialEquityGroupSettingImpl socialEquityGroupSettingImpl = new SocialEquityGroupSettingImpl();
209    
210                    socialEquityGroupSettingImpl.setEquityGroupSettingId(getEquityGroupSettingId());
211    
212                    socialEquityGroupSettingImpl.setGroupId(getGroupId());
213    
214                    SocialEquityGroupSettingModelImpl socialEquityGroupSettingModelImpl = socialEquityGroupSettingImpl;
215    
216                    socialEquityGroupSettingModelImpl._originalGroupId = socialEquityGroupSettingModelImpl._groupId;
217    
218                    socialEquityGroupSettingModelImpl._setOriginalGroupId = false;
219                    socialEquityGroupSettingImpl.setCompanyId(getCompanyId());
220    
221                    socialEquityGroupSettingImpl.setClassNameId(getClassNameId());
222    
223                    socialEquityGroupSettingModelImpl._originalClassNameId = socialEquityGroupSettingModelImpl._classNameId;
224    
225                    socialEquityGroupSettingModelImpl._setOriginalClassNameId = false;
226                    socialEquityGroupSettingImpl.setType(getType());
227    
228                    socialEquityGroupSettingModelImpl._originalType = socialEquityGroupSettingModelImpl._type;
229    
230                    socialEquityGroupSettingModelImpl._setOriginalType = false;
231                    socialEquityGroupSettingImpl.setEnabled(getEnabled());
232    
233                    return socialEquityGroupSettingImpl;
234            }
235    
236            public int compareTo(SocialEquityGroupSetting socialEquityGroupSetting) {
237                    long pk = socialEquityGroupSetting.getPrimaryKey();
238    
239                    if (getPrimaryKey() < pk) {
240                            return -1;
241                    }
242                    else if (getPrimaryKey() > pk) {
243                            return 1;
244                    }
245                    else {
246                            return 0;
247                    }
248            }
249    
250            public boolean equals(Object obj) {
251                    if (obj == null) {
252                            return false;
253                    }
254    
255                    SocialEquityGroupSetting socialEquityGroupSetting = null;
256    
257                    try {
258                            socialEquityGroupSetting = (SocialEquityGroupSetting)obj;
259                    }
260                    catch (ClassCastException cce) {
261                            return false;
262                    }
263    
264                    long pk = socialEquityGroupSetting.getPrimaryKey();
265    
266                    if (getPrimaryKey() == pk) {
267                            return true;
268                    }
269                    else {
270                            return false;
271                    }
272            }
273    
274            public int hashCode() {
275                    return (int)getPrimaryKey();
276            }
277    
278            public String toString() {
279                    StringBundler sb = new StringBundler(13);
280    
281                    sb.append("{equityGroupSettingId=");
282                    sb.append(getEquityGroupSettingId());
283                    sb.append(", groupId=");
284                    sb.append(getGroupId());
285                    sb.append(", companyId=");
286                    sb.append(getCompanyId());
287                    sb.append(", classNameId=");
288                    sb.append(getClassNameId());
289                    sb.append(", type=");
290                    sb.append(getType());
291                    sb.append(", enabled=");
292                    sb.append(getEnabled());
293                    sb.append("}");
294    
295                    return sb.toString();
296            }
297    
298            public String toXmlString() {
299                    StringBundler sb = new StringBundler(22);
300    
301                    sb.append("<model><model-name>");
302                    sb.append("com.liferay.portlet.social.model.SocialEquityGroupSetting");
303                    sb.append("</model-name>");
304    
305                    sb.append(
306                            "<column><column-name>equityGroupSettingId</column-name><column-value><![CDATA[");
307                    sb.append(getEquityGroupSettingId());
308                    sb.append("]]></column-value></column>");
309                    sb.append(
310                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
311                    sb.append(getGroupId());
312                    sb.append("]]></column-value></column>");
313                    sb.append(
314                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
315                    sb.append(getCompanyId());
316                    sb.append("]]></column-value></column>");
317                    sb.append(
318                            "<column><column-name>classNameId</column-name><column-value><![CDATA[");
319                    sb.append(getClassNameId());
320                    sb.append("]]></column-value></column>");
321                    sb.append(
322                            "<column><column-name>type</column-name><column-value><![CDATA[");
323                    sb.append(getType());
324                    sb.append("]]></column-value></column>");
325                    sb.append(
326                            "<column><column-name>enabled</column-name><column-value><![CDATA[");
327                    sb.append(getEnabled());
328                    sb.append("]]></column-value></column>");
329    
330                    sb.append("</model>");
331    
332                    return sb.toString();
333            }
334    
335            private long _equityGroupSettingId;
336            private long _groupId;
337            private long _originalGroupId;
338            private boolean _setOriginalGroupId;
339            private long _companyId;
340            private long _classNameId;
341            private long _originalClassNameId;
342            private boolean _setOriginalClassNameId;
343            private int _type;
344            private int _originalType;
345            private boolean _setOriginalType;
346            private boolean _enabled;
347            private transient ExpandoBridge _expandoBridge;
348    }