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.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  
24  import java.io.Serializable;
25  
26  import java.lang.reflect.Proxy;
27  
28  import java.sql.Types;
29  
30  import java.util.ArrayList;
31  import java.util.List;
32  
33  /**
34   * <a href="PluginSettingModelImpl.java.html"><b><i>View Source</i></b></a>
35   *
36   * <p>
37   * ServiceBuilder generated this class. Modifications in this class will be
38   * overwritten the next time is generated.
39   * </p>
40   *
41   * <p>
42   * This interface is a model that represents the PluginSetting table in the
43   * database.
44   * </p>
45   *
46   * @author    Brian Wing Shun Chan
47   * @see       PluginSettingImpl
48   * @see       com.liferay.portal.model.PluginSetting
49   * @see       com.liferay.portal.model.PluginSettingModel
50   * @generated
51   */
52  public class PluginSettingModelImpl extends BaseModelImpl<PluginSetting> {
53      public static final String TABLE_NAME = "PluginSetting";
54      public static final Object[][] TABLE_COLUMNS = {
55              { "pluginSettingId", new Integer(Types.BIGINT) },
56              { "companyId", new Integer(Types.BIGINT) },
57              { "pluginId", new Integer(Types.VARCHAR) },
58              { "pluginType", new Integer(Types.VARCHAR) },
59              { "roles", new Integer(Types.VARCHAR) },
60              { "active_", new Integer(Types.BOOLEAN) }
61          };
62      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)";
63      public static final String TABLE_SQL_DROP = "drop table PluginSetting";
64      public static final String DATA_SOURCE = "liferayDataSource";
65      public static final String SESSION_FACTORY = "liferaySessionFactory";
66      public static final String TX_MANAGER = "liferayTransactionManager";
67      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
68                  "value.object.entity.cache.enabled.com.liferay.portal.model.PluginSetting"),
69              true);
70      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
71                  "value.object.finder.cache.enabled.com.liferay.portal.model.PluginSetting"),
72              true);
73  
74      public static PluginSetting toModel(PluginSettingSoap soapModel) {
75          PluginSetting model = new PluginSettingImpl();
76  
77          model.setPluginSettingId(soapModel.getPluginSettingId());
78          model.setCompanyId(soapModel.getCompanyId());
79          model.setPluginId(soapModel.getPluginId());
80          model.setPluginType(soapModel.getPluginType());
81          model.setRoles(soapModel.getRoles());
82          model.setActive(soapModel.getActive());
83  
84          return model;
85      }
86  
87      public static List<PluginSetting> toModels(PluginSettingSoap[] soapModels) {
88          List<PluginSetting> models = new ArrayList<PluginSetting>(soapModels.length);
89  
90          for (PluginSettingSoap soapModel : soapModels) {
91              models.add(toModel(soapModel));
92          }
93  
94          return models;
95      }
96  
97      public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
98                  "lock.expiration.time.com.liferay.portal.model.PluginSetting"));
99  
100     public PluginSettingModelImpl() {
101     }
102 
103     public long getPrimaryKey() {
104         return _pluginSettingId;
105     }
106 
107     public void setPrimaryKey(long pk) {
108         setPluginSettingId(pk);
109     }
110 
111     public Serializable getPrimaryKeyObj() {
112         return new Long(_pluginSettingId);
113     }
114 
115     public long getPluginSettingId() {
116         return _pluginSettingId;
117     }
118 
119     public void setPluginSettingId(long pluginSettingId) {
120         _pluginSettingId = pluginSettingId;
121     }
122 
123     public long getCompanyId() {
124         return _companyId;
125     }
126 
127     public void setCompanyId(long companyId) {
128         _companyId = companyId;
129 
130         if (!_setOriginalCompanyId) {
131             _setOriginalCompanyId = true;
132 
133             _originalCompanyId = companyId;
134         }
135     }
136 
137     public long getOriginalCompanyId() {
138         return _originalCompanyId;
139     }
140 
141     public String getPluginId() {
142         return GetterUtil.getString(_pluginId);
143     }
144 
145     public void setPluginId(String pluginId) {
146         _pluginId = pluginId;
147 
148         if (_originalPluginId == null) {
149             _originalPluginId = pluginId;
150         }
151     }
152 
153     public String getOriginalPluginId() {
154         return GetterUtil.getString(_originalPluginId);
155     }
156 
157     public String getPluginType() {
158         return GetterUtil.getString(_pluginType);
159     }
160 
161     public void setPluginType(String pluginType) {
162         _pluginType = pluginType;
163 
164         if (_originalPluginType == null) {
165             _originalPluginType = pluginType;
166         }
167     }
168 
169     public String getOriginalPluginType() {
170         return GetterUtil.getString(_originalPluginType);
171     }
172 
173     public String getRoles() {
174         return GetterUtil.getString(_roles);
175     }
176 
177     public void setRoles(String roles) {
178         _roles = roles;
179     }
180 
181     public boolean getActive() {
182         return _active;
183     }
184 
185     public boolean isActive() {
186         return _active;
187     }
188 
189     public void setActive(boolean active) {
190         _active = active;
191     }
192 
193     public PluginSetting toEscapedModel() {
194         if (isEscapedModel()) {
195             return (PluginSetting)this;
196         }
197         else {
198             PluginSetting model = new PluginSettingImpl();
199 
200             model.setNew(isNew());
201             model.setEscapedModel(true);
202 
203             model.setPluginSettingId(getPluginSettingId());
204             model.setCompanyId(getCompanyId());
205             model.setPluginId(HtmlUtil.escape(getPluginId()));
206             model.setPluginType(HtmlUtil.escape(getPluginType()));
207             model.setRoles(HtmlUtil.escape(getRoles()));
208             model.setActive(getActive());
209 
210             model = (PluginSetting)Proxy.newProxyInstance(PluginSetting.class.getClassLoader(),
211                     new Class[] { PluginSetting.class },
212                     new ReadOnlyBeanHandler(model));
213 
214             return model;
215         }
216     }
217 
218     public Object clone() {
219         PluginSettingImpl clone = new PluginSettingImpl();
220 
221         clone.setPluginSettingId(getPluginSettingId());
222         clone.setCompanyId(getCompanyId());
223         clone.setPluginId(getPluginId());
224         clone.setPluginType(getPluginType());
225         clone.setRoles(getRoles());
226         clone.setActive(getActive());
227 
228         return clone;
229     }
230 
231     public int compareTo(PluginSetting pluginSetting) {
232         long pk = pluginSetting.getPrimaryKey();
233 
234         if (getPrimaryKey() < pk) {
235             return -1;
236         }
237         else if (getPrimaryKey() > pk) {
238             return 1;
239         }
240         else {
241             return 0;
242         }
243     }
244 
245     public boolean equals(Object obj) {
246         if (obj == null) {
247             return false;
248         }
249 
250         PluginSetting pluginSetting = null;
251 
252         try {
253             pluginSetting = (PluginSetting)obj;
254         }
255         catch (ClassCastException cce) {
256             return false;
257         }
258 
259         long pk = pluginSetting.getPrimaryKey();
260 
261         if (getPrimaryKey() == pk) {
262             return true;
263         }
264         else {
265             return false;
266         }
267     }
268 
269     public int hashCode() {
270         return (int)getPrimaryKey();
271     }
272 
273     public String toString() {
274         StringBundler sb = new StringBundler(13);
275 
276         sb.append("{pluginSettingId=");
277         sb.append(getPluginSettingId());
278         sb.append(", companyId=");
279         sb.append(getCompanyId());
280         sb.append(", pluginId=");
281         sb.append(getPluginId());
282         sb.append(", pluginType=");
283         sb.append(getPluginType());
284         sb.append(", roles=");
285         sb.append(getRoles());
286         sb.append(", active=");
287         sb.append(getActive());
288         sb.append("}");
289 
290         return sb.toString();
291     }
292 
293     public String toXmlString() {
294         StringBundler sb = new StringBundler(22);
295 
296         sb.append("<model><model-name>");
297         sb.append("com.liferay.portal.model.PluginSetting");
298         sb.append("</model-name>");
299 
300         sb.append(
301             "<column><column-name>pluginSettingId</column-name><column-value><![CDATA[");
302         sb.append(getPluginSettingId());
303         sb.append("]]></column-value></column>");
304         sb.append(
305             "<column><column-name>companyId</column-name><column-value><![CDATA[");
306         sb.append(getCompanyId());
307         sb.append("]]></column-value></column>");
308         sb.append(
309             "<column><column-name>pluginId</column-name><column-value><![CDATA[");
310         sb.append(getPluginId());
311         sb.append("]]></column-value></column>");
312         sb.append(
313             "<column><column-name>pluginType</column-name><column-value><![CDATA[");
314         sb.append(getPluginType());
315         sb.append("]]></column-value></column>");
316         sb.append(
317             "<column><column-name>roles</column-name><column-value><![CDATA[");
318         sb.append(getRoles());
319         sb.append("]]></column-value></column>");
320         sb.append(
321             "<column><column-name>active</column-name><column-value><![CDATA[");
322         sb.append(getActive());
323         sb.append("]]></column-value></column>");
324 
325         sb.append("</model>");
326 
327         return sb.toString();
328     }
329 
330     private long _pluginSettingId;
331     private long _companyId;
332     private long _originalCompanyId;
333     private boolean _setOriginalCompanyId;
334     private String _pluginId;
335     private String _originalPluginId;
336     private String _pluginType;
337     private String _originalPluginType;
338     private String _roles;
339     private boolean _active;
340 }