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.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.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.PluginSetting;
022    import com.liferay.portal.model.PluginSettingModel;
023    import com.liferay.portal.model.PluginSettingSoap;
024    import com.liferay.portal.service.ServiceContext;
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    import java.util.ArrayList;
036    import java.util.List;
037    
038    /**
039     * The base model implementation for the PluginSetting service. Represents a row in the "PluginSetting" 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.PluginSettingModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link PluginSettingImpl}.
043     * </p>
044     *
045     * <p>
046     * Never modify or reference this class directly. All methods that expect a plugin setting model instance should use the {@link com.liferay.portal.model.PluginSetting} interface instead.
047     * </p>
048     *
049     * @author Brian Wing Shun Chan
050     * @see PluginSettingImpl
051     * @see com.liferay.portal.model.PluginSetting
052     * @see com.liferay.portal.model.PluginSettingModel
053     * @generated
054     */
055    public class PluginSettingModelImpl extends BaseModelImpl<PluginSetting>
056            implements PluginSettingModel {
057            public static final String TABLE_NAME = "PluginSetting";
058            public static final Object[][] TABLE_COLUMNS = {
059                            { "pluginSettingId", new Integer(Types.BIGINT) },
060                            { "companyId", new Integer(Types.BIGINT) },
061                            { "pluginId", new Integer(Types.VARCHAR) },
062                            { "pluginType", new Integer(Types.VARCHAR) },
063                            { "roles", new Integer(Types.VARCHAR) },
064                            { "active_", new Integer(Types.BOOLEAN) }
065                    };
066            public static final String TABLE_SQL_CREATE = "create table PluginSetting (pluginSettingId LONG not null primary key,companyId LONG,pluginId VARCHAR(75) null,pluginType VARCHAR(75) null,roles STRING null,active_ BOOLEAN)";
067            public static final String TABLE_SQL_DROP = "drop table PluginSetting";
068            public static final String DATA_SOURCE = "liferayDataSource";
069            public static final String SESSION_FACTORY = "liferaySessionFactory";
070            public static final String TX_MANAGER = "liferayTransactionManager";
071            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
072                                    "value.object.entity.cache.enabled.com.liferay.portal.model.PluginSetting"),
073                            true);
074            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
075                                    "value.object.finder.cache.enabled.com.liferay.portal.model.PluginSetting"),
076                            true);
077    
078            /**
079             * Converts the soap model instance into a normal model instance.
080             *
081             * @param soapModel the soap model instance to convert
082             * @return the normal model instance
083             */
084            public static PluginSetting toModel(PluginSettingSoap soapModel) {
085                    PluginSetting model = new PluginSettingImpl();
086    
087                    model.setPluginSettingId(soapModel.getPluginSettingId());
088                    model.setCompanyId(soapModel.getCompanyId());
089                    model.setPluginId(soapModel.getPluginId());
090                    model.setPluginType(soapModel.getPluginType());
091                    model.setRoles(soapModel.getRoles());
092                    model.setActive(soapModel.getActive());
093    
094                    return model;
095            }
096    
097            /**
098             * Converts the soap model instances into normal model instances.
099             *
100             * @param soapModels the soap model instances to convert
101             * @return the normal model instances
102             */
103            public static List<PluginSetting> toModels(PluginSettingSoap[] soapModels) {
104                    List<PluginSetting> models = new ArrayList<PluginSetting>(soapModels.length);
105    
106                    for (PluginSettingSoap soapModel : soapModels) {
107                            models.add(toModel(soapModel));
108                    }
109    
110                    return models;
111            }
112    
113            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
114                                    "lock.expiration.time.com.liferay.portal.model.PluginSetting"));
115    
116            public PluginSettingModelImpl() {
117            }
118    
119            public long getPrimaryKey() {
120                    return _pluginSettingId;
121            }
122    
123            public void setPrimaryKey(long pk) {
124                    setPluginSettingId(pk);
125            }
126    
127            public Serializable getPrimaryKeyObj() {
128                    return new Long(_pluginSettingId);
129            }
130    
131            public long getPluginSettingId() {
132                    return _pluginSettingId;
133            }
134    
135            public void setPluginSettingId(long pluginSettingId) {
136                    _pluginSettingId = pluginSettingId;
137            }
138    
139            public long getCompanyId() {
140                    return _companyId;
141            }
142    
143            public void setCompanyId(long companyId) {
144                    if (!_setOriginalCompanyId) {
145                            _setOriginalCompanyId = true;
146    
147                            _originalCompanyId = _companyId;
148                    }
149    
150                    _companyId = companyId;
151            }
152    
153            public long getOriginalCompanyId() {
154                    return _originalCompanyId;
155            }
156    
157            public String getPluginId() {
158                    if (_pluginId == null) {
159                            return StringPool.BLANK;
160                    }
161                    else {
162                            return _pluginId;
163                    }
164            }
165    
166            public void setPluginId(String pluginId) {
167                    if (_originalPluginId == null) {
168                            _originalPluginId = _pluginId;
169                    }
170    
171                    _pluginId = pluginId;
172            }
173    
174            public String getOriginalPluginId() {
175                    return GetterUtil.getString(_originalPluginId);
176            }
177    
178            public String getPluginType() {
179                    if (_pluginType == null) {
180                            return StringPool.BLANK;
181                    }
182                    else {
183                            return _pluginType;
184                    }
185            }
186    
187            public void setPluginType(String pluginType) {
188                    if (_originalPluginType == null) {
189                            _originalPluginType = _pluginType;
190                    }
191    
192                    _pluginType = pluginType;
193            }
194    
195            public String getOriginalPluginType() {
196                    return GetterUtil.getString(_originalPluginType);
197            }
198    
199            public String getRoles() {
200                    if (_roles == null) {
201                            return StringPool.BLANK;
202                    }
203                    else {
204                            return _roles;
205                    }
206            }
207    
208            public void setRoles(String roles) {
209                    _roles = roles;
210            }
211    
212            public boolean getActive() {
213                    return _active;
214            }
215    
216            public boolean isActive() {
217                    return _active;
218            }
219    
220            public void setActive(boolean active) {
221                    _active = active;
222            }
223    
224            public PluginSetting toEscapedModel() {
225                    if (isEscapedModel()) {
226                            return (PluginSetting)this;
227                    }
228                    else {
229                            return (PluginSetting)Proxy.newProxyInstance(PluginSetting.class.getClassLoader(),
230                                    new Class[] { PluginSetting.class },
231                                    new AutoEscapeBeanHandler(this));
232                    }
233            }
234    
235            public ExpandoBridge getExpandoBridge() {
236                    if (_expandoBridge == null) {
237                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
238                                            PluginSetting.class.getName(), getPrimaryKey());
239                    }
240    
241                    return _expandoBridge;
242            }
243    
244            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
245                    getExpandoBridge().setAttributes(serviceContext);
246            }
247    
248            public Object clone() {
249                    PluginSettingImpl pluginSettingImpl = new PluginSettingImpl();
250    
251                    pluginSettingImpl.setPluginSettingId(getPluginSettingId());
252    
253                    pluginSettingImpl.setCompanyId(getCompanyId());
254    
255                    PluginSettingModelImpl pluginSettingModelImpl = pluginSettingImpl;
256    
257                    pluginSettingModelImpl._originalCompanyId = pluginSettingModelImpl._companyId;
258    
259                    pluginSettingModelImpl._setOriginalCompanyId = false;
260                    pluginSettingImpl.setPluginId(getPluginId());
261    
262                    pluginSettingModelImpl._originalPluginId = pluginSettingModelImpl._pluginId;
263    
264                    pluginSettingImpl.setPluginType(getPluginType());
265    
266                    pluginSettingModelImpl._originalPluginType = pluginSettingModelImpl._pluginType;
267    
268                    pluginSettingImpl.setRoles(getRoles());
269    
270                    pluginSettingImpl.setActive(getActive());
271    
272                    return pluginSettingImpl;
273            }
274    
275            public int compareTo(PluginSetting pluginSetting) {
276                    long pk = pluginSetting.getPrimaryKey();
277    
278                    if (getPrimaryKey() < pk) {
279                            return -1;
280                    }
281                    else if (getPrimaryKey() > pk) {
282                            return 1;
283                    }
284                    else {
285                            return 0;
286                    }
287            }
288    
289            public boolean equals(Object obj) {
290                    if (obj == null) {
291                            return false;
292                    }
293    
294                    PluginSetting pluginSetting = null;
295    
296                    try {
297                            pluginSetting = (PluginSetting)obj;
298                    }
299                    catch (ClassCastException cce) {
300                            return false;
301                    }
302    
303                    long pk = pluginSetting.getPrimaryKey();
304    
305                    if (getPrimaryKey() == pk) {
306                            return true;
307                    }
308                    else {
309                            return false;
310                    }
311            }
312    
313            public int hashCode() {
314                    return (int)getPrimaryKey();
315            }
316    
317            public String toString() {
318                    StringBundler sb = new StringBundler(13);
319    
320                    sb.append("{pluginSettingId=");
321                    sb.append(getPluginSettingId());
322                    sb.append(", companyId=");
323                    sb.append(getCompanyId());
324                    sb.append(", pluginId=");
325                    sb.append(getPluginId());
326                    sb.append(", pluginType=");
327                    sb.append(getPluginType());
328                    sb.append(", roles=");
329                    sb.append(getRoles());
330                    sb.append(", active=");
331                    sb.append(getActive());
332                    sb.append("}");
333    
334                    return sb.toString();
335            }
336    
337            public String toXmlString() {
338                    StringBundler sb = new StringBundler(22);
339    
340                    sb.append("<model><model-name>");
341                    sb.append("com.liferay.portal.model.PluginSetting");
342                    sb.append("</model-name>");
343    
344                    sb.append(
345                            "<column><column-name>pluginSettingId</column-name><column-value><![CDATA[");
346                    sb.append(getPluginSettingId());
347                    sb.append("]]></column-value></column>");
348                    sb.append(
349                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
350                    sb.append(getCompanyId());
351                    sb.append("]]></column-value></column>");
352                    sb.append(
353                            "<column><column-name>pluginId</column-name><column-value><![CDATA[");
354                    sb.append(getPluginId());
355                    sb.append("]]></column-value></column>");
356                    sb.append(
357                            "<column><column-name>pluginType</column-name><column-value><![CDATA[");
358                    sb.append(getPluginType());
359                    sb.append("]]></column-value></column>");
360                    sb.append(
361                            "<column><column-name>roles</column-name><column-value><![CDATA[");
362                    sb.append(getRoles());
363                    sb.append("]]></column-value></column>");
364                    sb.append(
365                            "<column><column-name>active</column-name><column-value><![CDATA[");
366                    sb.append(getActive());
367                    sb.append("]]></column-value></column>");
368    
369                    sb.append("</model>");
370    
371                    return sb.toString();
372            }
373    
374            private long _pluginSettingId;
375            private long _companyId;
376            private long _originalCompanyId;
377            private boolean _setOriginalCompanyId;
378            private String _pluginId;
379            private String _originalPluginId;
380            private String _pluginType;
381            private String _originalPluginType;
382            private String _roles;
383            private boolean _active;
384            private transient ExpandoBridge _expandoBridge;
385    }