1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.model.impl;
16  
17  import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
18  import com.liferay.portal.kernel.util.GetterUtil;
19  import com.liferay.portal.kernel.util.StringBundler;
20  import com.liferay.portal.kernel.util.StringPool;
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         if (_pluginId == null) {
147             return StringPool.BLANK;
148         }
149         else {
150             return _pluginId;
151         }
152     }
153 
154     public void setPluginId(String pluginId) {
155         _pluginId = pluginId;
156 
157         if (_originalPluginId == null) {
158             _originalPluginId = pluginId;
159         }
160     }
161 
162     public String getOriginalPluginId() {
163         return GetterUtil.getString(_originalPluginId);
164     }
165 
166     public String getPluginType() {
167         if (_pluginType == null) {
168             return StringPool.BLANK;
169         }
170         else {
171             return _pluginType;
172         }
173     }
174 
175     public void setPluginType(String pluginType) {
176         _pluginType = pluginType;
177 
178         if (_originalPluginType == null) {
179             _originalPluginType = pluginType;
180         }
181     }
182 
183     public String getOriginalPluginType() {
184         return GetterUtil.getString(_originalPluginType);
185     }
186 
187     public String getRoles() {
188         if (_roles == null) {
189             return StringPool.BLANK;
190         }
191         else {
192             return _roles;
193         }
194     }
195 
196     public void setRoles(String roles) {
197         _roles = roles;
198     }
199 
200     public boolean getActive() {
201         return _active;
202     }
203 
204     public boolean isActive() {
205         return _active;
206     }
207 
208     public void setActive(boolean active) {
209         _active = active;
210     }
211 
212     public PluginSetting toEscapedModel() {
213         if (isEscapedModel()) {
214             return (PluginSetting)this;
215         }
216         else {
217             return (PluginSetting)Proxy.newProxyInstance(PluginSetting.class.getClassLoader(),
218                 new Class[] { PluginSetting.class },
219                 new AutoEscapeBeanHandler(this));
220         }
221     }
222 
223     public ExpandoBridge getExpandoBridge() {
224         if (_expandoBridge == null) {
225             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(PluginSetting.class.getName(),
226                     getPrimaryKey());
227         }
228 
229         return _expandoBridge;
230     }
231 
232     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
233         getExpandoBridge().setAttributes(serviceContext);
234     }
235 
236     public Object clone() {
237         PluginSettingImpl clone = new PluginSettingImpl();
238 
239         clone.setPluginSettingId(getPluginSettingId());
240         clone.setCompanyId(getCompanyId());
241         clone.setPluginId(getPluginId());
242         clone.setPluginType(getPluginType());
243         clone.setRoles(getRoles());
244         clone.setActive(getActive());
245 
246         return clone;
247     }
248 
249     public int compareTo(PluginSetting pluginSetting) {
250         long pk = pluginSetting.getPrimaryKey();
251 
252         if (getPrimaryKey() < pk) {
253             return -1;
254         }
255         else if (getPrimaryKey() > pk) {
256             return 1;
257         }
258         else {
259             return 0;
260         }
261     }
262 
263     public boolean equals(Object obj) {
264         if (obj == null) {
265             return false;
266         }
267 
268         PluginSetting pluginSetting = null;
269 
270         try {
271             pluginSetting = (PluginSetting)obj;
272         }
273         catch (ClassCastException cce) {
274             return false;
275         }
276 
277         long pk = pluginSetting.getPrimaryKey();
278 
279         if (getPrimaryKey() == pk) {
280             return true;
281         }
282         else {
283             return false;
284         }
285     }
286 
287     public int hashCode() {
288         return (int)getPrimaryKey();
289     }
290 
291     public String toString() {
292         StringBundler sb = new StringBundler(13);
293 
294         sb.append("{pluginSettingId=");
295         sb.append(getPluginSettingId());
296         sb.append(", companyId=");
297         sb.append(getCompanyId());
298         sb.append(", pluginId=");
299         sb.append(getPluginId());
300         sb.append(", pluginType=");
301         sb.append(getPluginType());
302         sb.append(", roles=");
303         sb.append(getRoles());
304         sb.append(", active=");
305         sb.append(getActive());
306         sb.append("}");
307 
308         return sb.toString();
309     }
310 
311     public String toXmlString() {
312         StringBundler sb = new StringBundler(22);
313 
314         sb.append("<model><model-name>");
315         sb.append("com.liferay.portal.model.PluginSetting");
316         sb.append("</model-name>");
317 
318         sb.append(
319             "<column><column-name>pluginSettingId</column-name><column-value><![CDATA[");
320         sb.append(getPluginSettingId());
321         sb.append("]]></column-value></column>");
322         sb.append(
323             "<column><column-name>companyId</column-name><column-value><![CDATA[");
324         sb.append(getCompanyId());
325         sb.append("]]></column-value></column>");
326         sb.append(
327             "<column><column-name>pluginId</column-name><column-value><![CDATA[");
328         sb.append(getPluginId());
329         sb.append("]]></column-value></column>");
330         sb.append(
331             "<column><column-name>pluginType</column-name><column-value><![CDATA[");
332         sb.append(getPluginType());
333         sb.append("]]></column-value></column>");
334         sb.append(
335             "<column><column-name>roles</column-name><column-value><![CDATA[");
336         sb.append(getRoles());
337         sb.append("]]></column-value></column>");
338         sb.append(
339             "<column><column-name>active</column-name><column-value><![CDATA[");
340         sb.append(getActive());
341         sb.append("]]></column-value></column>");
342 
343         sb.append("</model>");
344 
345         return sb.toString();
346     }
347 
348     private long _pluginSettingId;
349     private long _companyId;
350     private long _originalCompanyId;
351     private boolean _setOriginalCompanyId;
352     private String _pluginId;
353     private String _originalPluginId;
354     private String _pluginType;
355     private String _originalPluginType;
356     private String _roles;
357     private boolean _active;
358     private transient ExpandoBridge _expandoBridge;
359 }