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