1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.model.impl;
16  
17  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
18  import com.liferay.portal.kernel.util.GetterUtil;
19  import com.liferay.portal.kernel.util.HtmlUtil;
20  import com.liferay.portal.kernel.util.StringBundler;
21  import com.liferay.portal.model.PluginSetting;
22  import com.liferay.portal.model.PluginSettingSoap;
23  import com.liferay.portal.service.ServiceContext;
24  
25  import com.liferay.portlet.expando.model.ExpandoBridge;
26  import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
27  
28  import java.io.Serializable;
29  
30  import java.lang.reflect.Proxy;
31  
32  import java.sql.Types;
33  
34  import java.util.ArrayList;
35  import java.util.List;
36  
37  /**
38   * <a href="PluginSettingModelImpl.java.html"><b><i>View Source</i></b></a>
39   *
40   * <p>
41   * ServiceBuilder generated this class. Modifications in this class will be
42   * overwritten the next time is generated.
43   * </p>
44   *
45   * <p>
46   * This interface is a model that represents the PluginSetting table in the
47   * database.
48   * </p>
49   *
50   * @author    Brian Wing Shun Chan
51   * @see       PluginSettingImpl
52   * @see       com.liferay.portal.model.PluginSetting
53   * @see       com.liferay.portal.model.PluginSettingModel
54   * @generated
55   */
56  public class PluginSettingModelImpl extends BaseModelImpl<PluginSetting> {
57      public static final String TABLE_NAME = "PluginSetting";
58      public static final Object[][] TABLE_COLUMNS = {
59              { "pluginSettingId", new Integer(Types.BIGINT) },
60              { "companyId", new Integer(Types.BIGINT) },
61              { "pluginId", new Integer(Types.VARCHAR) },
62              { "pluginType", new Integer(Types.VARCHAR) },
63              { "roles", new Integer(Types.VARCHAR) },
64              { "active_", new Integer(Types.BOOLEAN) }
65          };
66      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)";
67      public static final String TABLE_SQL_DROP = "drop table PluginSetting";
68      public static final String DATA_SOURCE = "liferayDataSource";
69      public static final String SESSION_FACTORY = "liferaySessionFactory";
70      public static final String TX_MANAGER = "liferayTransactionManager";
71      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
72                  "value.object.entity.cache.enabled.com.liferay.portal.model.PluginSetting"),
73              true);
74      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
75                  "value.object.finder.cache.enabled.com.liferay.portal.model.PluginSetting"),
76              true);
77  
78      public static PluginSetting toModel(PluginSettingSoap soapModel) {
79          PluginSetting model = new PluginSettingImpl();
80  
81          model.setPluginSettingId(soapModel.getPluginSettingId());
82          model.setCompanyId(soapModel.getCompanyId());
83          model.setPluginId(soapModel.getPluginId());
84          model.setPluginType(soapModel.getPluginType());
85          model.setRoles(soapModel.getRoles());
86          model.setActive(soapModel.getActive());
87  
88          return model;
89      }
90  
91      public static List<PluginSetting> toModels(PluginSettingSoap[] soapModels) {
92          List<PluginSetting> models = new ArrayList<PluginSetting>(soapModels.length);
93  
94          for (PluginSettingSoap soapModel : soapModels) {
95              models.add(toModel(soapModel));
96          }
97  
98          return models;
99      }
100 
101     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
102                 "lock.expiration.time.com.liferay.portal.model.PluginSetting"));
103 
104     public PluginSettingModelImpl() {
105     }
106 
107     public long getPrimaryKey() {
108         return _pluginSettingId;
109     }
110 
111     public void setPrimaryKey(long pk) {
112         setPluginSettingId(pk);
113     }
114 
115     public Serializable getPrimaryKeyObj() {
116         return new Long(_pluginSettingId);
117     }
118 
119     public long getPluginSettingId() {
120         return _pluginSettingId;
121     }
122 
123     public void setPluginSettingId(long pluginSettingId) {
124         _pluginSettingId = pluginSettingId;
125     }
126 
127     public long getCompanyId() {
128         return _companyId;
129     }
130 
131     public void setCompanyId(long companyId) {
132         _companyId = companyId;
133 
134         if (!_setOriginalCompanyId) {
135             _setOriginalCompanyId = true;
136 
137             _originalCompanyId = companyId;
138         }
139     }
140 
141     public long getOriginalCompanyId() {
142         return _originalCompanyId;
143     }
144 
145     public String getPluginId() {
146         return GetterUtil.getString(_pluginId);
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         return GetterUtil.getString(_pluginType);
163     }
164 
165     public void setPluginType(String pluginType) {
166         _pluginType = pluginType;
167 
168         if (_originalPluginType == null) {
169             _originalPluginType = pluginType;
170         }
171     }
172 
173     public String getOriginalPluginType() {
174         return GetterUtil.getString(_originalPluginType);
175     }
176 
177     public String getRoles() {
178         return GetterUtil.getString(_roles);
179     }
180 
181     public void setRoles(String roles) {
182         _roles = roles;
183     }
184 
185     public boolean getActive() {
186         return _active;
187     }
188 
189     public boolean isActive() {
190         return _active;
191     }
192 
193     public void setActive(boolean active) {
194         _active = active;
195     }
196 
197     public PluginSetting toEscapedModel() {
198         if (isEscapedModel()) {
199             return (PluginSetting)this;
200         }
201         else {
202             PluginSetting model = new PluginSettingImpl();
203 
204             model.setNew(isNew());
205             model.setEscapedModel(true);
206 
207             model.setPluginSettingId(getPluginSettingId());
208             model.setCompanyId(getCompanyId());
209             model.setPluginId(HtmlUtil.escape(getPluginId()));
210             model.setPluginType(HtmlUtil.escape(getPluginType()));
211             model.setRoles(HtmlUtil.escape(getRoles()));
212             model.setActive(getActive());
213 
214             model = (PluginSetting)Proxy.newProxyInstance(PluginSetting.class.getClassLoader(),
215                     new Class[] { PluginSetting.class },
216                     new ReadOnlyBeanHandler(model));
217 
218             return model;
219         }
220     }
221 
222     public ExpandoBridge getExpandoBridge() {
223         if (_expandoBridge == null) {
224             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
225                     PluginSetting.class.getName(), getPrimaryKey());
226         }
227 
228         return _expandoBridge;
229     }
230 
231     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
232         getExpandoBridge().setAttributes(serviceContext);
233     }
234 
235     public Object clone() {
236         PluginSettingImpl clone = new PluginSettingImpl();
237 
238         clone.setPluginSettingId(getPluginSettingId());
239         clone.setCompanyId(getCompanyId());
240         clone.setPluginId(getPluginId());
241         clone.setPluginType(getPluginType());
242         clone.setRoles(getRoles());
243         clone.setActive(getActive());
244 
245         return clone;
246     }
247 
248     public int compareTo(PluginSetting pluginSetting) {
249         long pk = pluginSetting.getPrimaryKey();
250 
251         if (getPrimaryKey() < pk) {
252             return -1;
253         }
254         else if (getPrimaryKey() > pk) {
255             return 1;
256         }
257         else {
258             return 0;
259         }
260     }
261 
262     public boolean equals(Object obj) {
263         if (obj == null) {
264             return false;
265         }
266 
267         PluginSetting pluginSetting = null;
268 
269         try {
270             pluginSetting = (PluginSetting)obj;
271         }
272         catch (ClassCastException cce) {
273             return false;
274         }
275 
276         long pk = pluginSetting.getPrimaryKey();
277 
278         if (getPrimaryKey() == pk) {
279             return true;
280         }
281         else {
282             return false;
283         }
284     }
285 
286     public int hashCode() {
287         return (int)getPrimaryKey();
288     }
289 
290     public String toString() {
291         StringBundler sb = new StringBundler(13);
292 
293         sb.append("{pluginSettingId=");
294         sb.append(getPluginSettingId());
295         sb.append(", companyId=");
296         sb.append(getCompanyId());
297         sb.append(", pluginId=");
298         sb.append(getPluginId());
299         sb.append(", pluginType=");
300         sb.append(getPluginType());
301         sb.append(", roles=");
302         sb.append(getRoles());
303         sb.append(", active=");
304         sb.append(getActive());
305         sb.append("}");
306 
307         return sb.toString();
308     }
309 
310     public String toXmlString() {
311         StringBundler sb = new StringBundler(22);
312 
313         sb.append("<model><model-name>");
314         sb.append("com.liferay.portal.model.PluginSetting");
315         sb.append("</model-name>");
316 
317         sb.append(
318             "<column><column-name>pluginSettingId</column-name><column-value><![CDATA[");
319         sb.append(getPluginSettingId());
320         sb.append("]]></column-value></column>");
321         sb.append(
322             "<column><column-name>companyId</column-name><column-value><![CDATA[");
323         sb.append(getCompanyId());
324         sb.append("]]></column-value></column>");
325         sb.append(
326             "<column><column-name>pluginId</column-name><column-value><![CDATA[");
327         sb.append(getPluginId());
328         sb.append("]]></column-value></column>");
329         sb.append(
330             "<column><column-name>pluginType</column-name><column-value><![CDATA[");
331         sb.append(getPluginType());
332         sb.append("]]></column-value></column>");
333         sb.append(
334             "<column><column-name>roles</column-name><column-value><![CDATA[");
335         sb.append(getRoles());
336         sb.append("]]></column-value></column>");
337         sb.append(
338             "<column><column-name>active</column-name><column-value><![CDATA[");
339         sb.append(getActive());
340         sb.append("]]></column-value></column>");
341 
342         sb.append("</model>");
343 
344         return sb.toString();
345     }
346 
347     private long _pluginSettingId;
348     private long _companyId;
349     private long _originalCompanyId;
350     private boolean _setOriginalCompanyId;
351     private String _pluginId;
352     private String _originalPluginId;
353     private String _pluginType;
354     private String _originalPluginType;
355     private String _roles;
356     private boolean _active;
357     private transient ExpandoBridge _expandoBridge;
358 }