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.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                    _companyId = companyId;
145    
146                    if (!_setOriginalCompanyId) {
147                            _setOriginalCompanyId = true;
148    
149                            _originalCompanyId = companyId;
150                    }
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                    _pluginId = pluginId;
168    
169                    if (_originalPluginId == null) {
170                            _originalPluginId = pluginId;
171                    }
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                    _pluginType = pluginType;
189    
190                    if (_originalPluginType == null) {
191                            _originalPluginType = pluginType;
192                    }
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 clone = new PluginSettingImpl();
250    
251                    clone.setPluginSettingId(getPluginSettingId());
252                    clone.setCompanyId(getCompanyId());
253                    clone.setPluginId(getPluginId());
254                    clone.setPluginType(getPluginType());
255                    clone.setRoles(getRoles());
256                    clone.setActive(getActive());
257    
258                    return clone;
259            }
260    
261            public int compareTo(PluginSetting pluginSetting) {
262                    long pk = pluginSetting.getPrimaryKey();
263    
264                    if (getPrimaryKey() < pk) {
265                            return -1;
266                    }
267                    else if (getPrimaryKey() > pk) {
268                            return 1;
269                    }
270                    else {
271                            return 0;
272                    }
273            }
274    
275            public boolean equals(Object obj) {
276                    if (obj == null) {
277                            return false;
278                    }
279    
280                    PluginSetting pluginSetting = null;
281    
282                    try {
283                            pluginSetting = (PluginSetting)obj;
284                    }
285                    catch (ClassCastException cce) {
286                            return false;
287                    }
288    
289                    long pk = pluginSetting.getPrimaryKey();
290    
291                    if (getPrimaryKey() == pk) {
292                            return true;
293                    }
294                    else {
295                            return false;
296                    }
297            }
298    
299            public int hashCode() {
300                    return (int)getPrimaryKey();
301            }
302    
303            public String toString() {
304                    StringBundler sb = new StringBundler(13);
305    
306                    sb.append("{pluginSettingId=");
307                    sb.append(getPluginSettingId());
308                    sb.append(", companyId=");
309                    sb.append(getCompanyId());
310                    sb.append(", pluginId=");
311                    sb.append(getPluginId());
312                    sb.append(", pluginType=");
313                    sb.append(getPluginType());
314                    sb.append(", roles=");
315                    sb.append(getRoles());
316                    sb.append(", active=");
317                    sb.append(getActive());
318                    sb.append("}");
319    
320                    return sb.toString();
321            }
322    
323            public String toXmlString() {
324                    StringBundler sb = new StringBundler(22);
325    
326                    sb.append("<model><model-name>");
327                    sb.append("com.liferay.portal.model.PluginSetting");
328                    sb.append("</model-name>");
329    
330                    sb.append(
331                            "<column><column-name>pluginSettingId</column-name><column-value><![CDATA[");
332                    sb.append(getPluginSettingId());
333                    sb.append("]]></column-value></column>");
334                    sb.append(
335                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
336                    sb.append(getCompanyId());
337                    sb.append("]]></column-value></column>");
338                    sb.append(
339                            "<column><column-name>pluginId</column-name><column-value><![CDATA[");
340                    sb.append(getPluginId());
341                    sb.append("]]></column-value></column>");
342                    sb.append(
343                            "<column><column-name>pluginType</column-name><column-value><![CDATA[");
344                    sb.append(getPluginType());
345                    sb.append("]]></column-value></column>");
346                    sb.append(
347                            "<column><column-name>roles</column-name><column-value><![CDATA[");
348                    sb.append(getRoles());
349                    sb.append("]]></column-value></column>");
350                    sb.append(
351                            "<column><column-name>active</column-name><column-value><![CDATA[");
352                    sb.append(getActive());
353                    sb.append("]]></column-value></column>");
354    
355                    sb.append("</model>");
356    
357                    return sb.toString();
358            }
359    
360            private long _pluginSettingId;
361            private long _companyId;
362            private long _originalCompanyId;
363            private boolean _setOriginalCompanyId;
364            private String _pluginId;
365            private String _originalPluginId;
366            private String _pluginType;
367            private String _originalPluginType;
368            private String _roles;
369            private boolean _active;
370            private transient ExpandoBridge _expandoBridge;
371    }