1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.model.impl;
24  
25  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26  import com.liferay.portal.kernel.util.GetterUtil;
27  import com.liferay.portal.kernel.util.HtmlUtil;
28  import com.liferay.portal.model.PluginSetting;
29  import com.liferay.portal.model.PluginSettingSoap;
30  
31  import java.io.Serializable;
32  
33  import java.lang.reflect.Proxy;
34  
35  import java.sql.Types;
36  
37  import java.util.ArrayList;
38  import java.util.List;
39  
40  /**
41   * <a href="PluginSettingModelImpl.java.html"><b><i>View Source</i></b></a>
42   *
43   * <p>
44   * ServiceBuilder generated this class. Modifications in this class will be
45   * overwritten the next time is generated.
46   * </p>
47   *
48   * <p>
49   * This class is a model that represents the <code>PluginSetting</code> table
50   * in the database.
51   * </p>
52   *
53   * @author Brian Wing Shun Chan
54   *
55   * @see com.liferay.portal.model.PluginSetting
56   * @see com.liferay.portal.model.PluginSettingModel
57   * @see com.liferay.portal.model.impl.PluginSettingImpl
58   *
59   */
60  public class PluginSettingModelImpl extends BaseModelImpl<PluginSetting> {
61      public static final String TABLE_NAME = "PluginSetting";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "pluginSettingId", new Integer(Types.BIGINT) },
64              
65  
66              { "companyId", new Integer(Types.BIGINT) },
67              
68  
69              { "pluginId", new Integer(Types.VARCHAR) },
70              
71  
72              { "pluginType", new Integer(Types.VARCHAR) },
73              
74  
75              { "roles", new Integer(Types.VARCHAR) },
76              
77  
78              { "active_", new Integer(Types.BOOLEAN) }
79          };
80      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)";
81      public static final String TABLE_SQL_DROP = "drop table PluginSetting";
82      public static final String DATA_SOURCE = "liferayDataSource";
83      public static final String SESSION_FACTORY = "liferaySessionFactory";
84      public static final String TX_MANAGER = "liferayTransactionManager";
85      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
86                  "value.object.entity.cache.enabled.com.liferay.portal.model.PluginSetting"),
87              true);
88      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
89                  "value.object.finder.cache.enabled.com.liferay.portal.model.PluginSetting"),
90              true);
91  
92      public static PluginSetting toModel(PluginSettingSoap soapModel) {
93          PluginSetting model = new PluginSettingImpl();
94  
95          model.setPluginSettingId(soapModel.getPluginSettingId());
96          model.setCompanyId(soapModel.getCompanyId());
97          model.setPluginId(soapModel.getPluginId());
98          model.setPluginType(soapModel.getPluginType());
99          model.setRoles(soapModel.getRoles());
100         model.setActive(soapModel.getActive());
101 
102         return model;
103     }
104 
105     public static List<PluginSetting> toModels(PluginSettingSoap[] soapModels) {
106         List<PluginSetting> models = new ArrayList<PluginSetting>(soapModels.length);
107 
108         for (PluginSettingSoap soapModel : soapModels) {
109             models.add(toModel(soapModel));
110         }
111 
112         return models;
113     }
114 
115     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
116                 "lock.expiration.time.com.liferay.portal.model.PluginSetting"));
117 
118     public PluginSettingModelImpl() {
119     }
120 
121     public long getPrimaryKey() {
122         return _pluginSettingId;
123     }
124 
125     public void setPrimaryKey(long pk) {
126         setPluginSettingId(pk);
127     }
128 
129     public Serializable getPrimaryKeyObj() {
130         return new Long(_pluginSettingId);
131     }
132 
133     public long getPluginSettingId() {
134         return _pluginSettingId;
135     }
136 
137     public void setPluginSettingId(long pluginSettingId) {
138         _pluginSettingId = pluginSettingId;
139     }
140 
141     public long getCompanyId() {
142         return _companyId;
143     }
144 
145     public void setCompanyId(long companyId) {
146         _companyId = companyId;
147 
148         if (!_setOriginalCompanyId) {
149             _setOriginalCompanyId = true;
150 
151             _originalCompanyId = companyId;
152         }
153     }
154 
155     public long getOriginalCompanyId() {
156         return _originalCompanyId;
157     }
158 
159     public String getPluginId() {
160         return GetterUtil.getString(_pluginId);
161     }
162 
163     public void setPluginId(String pluginId) {
164         _pluginId = pluginId;
165 
166         if (_originalPluginId == null) {
167             _originalPluginId = pluginId;
168         }
169     }
170 
171     public String getOriginalPluginId() {
172         return GetterUtil.getString(_originalPluginId);
173     }
174 
175     public String getPluginType() {
176         return GetterUtil.getString(_pluginType);
177     }
178 
179     public void setPluginType(String pluginType) {
180         _pluginType = pluginType;
181 
182         if (_originalPluginType == null) {
183             _originalPluginType = pluginType;
184         }
185     }
186 
187     public String getOriginalPluginType() {
188         return GetterUtil.getString(_originalPluginType);
189     }
190 
191     public String getRoles() {
192         return GetterUtil.getString(_roles);
193     }
194 
195     public void setRoles(String roles) {
196         _roles = roles;
197     }
198 
199     public boolean getActive() {
200         return _active;
201     }
202 
203     public boolean isActive() {
204         return _active;
205     }
206 
207     public void setActive(boolean active) {
208         _active = active;
209     }
210 
211     public PluginSetting toEscapedModel() {
212         if (isEscapedModel()) {
213             return (PluginSetting)this;
214         }
215         else {
216             PluginSetting model = new PluginSettingImpl();
217 
218             model.setNew(isNew());
219             model.setEscapedModel(true);
220 
221             model.setPluginSettingId(getPluginSettingId());
222             model.setCompanyId(getCompanyId());
223             model.setPluginId(HtmlUtil.escape(getPluginId()));
224             model.setPluginType(HtmlUtil.escape(getPluginType()));
225             model.setRoles(HtmlUtil.escape(getRoles()));
226             model.setActive(getActive());
227 
228             model = (PluginSetting)Proxy.newProxyInstance(PluginSetting.class.getClassLoader(),
229                     new Class[] { PluginSetting.class },
230                     new ReadOnlyBeanHandler(model));
231 
232             return model;
233         }
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         StringBuilder sb = new StringBuilder();
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         StringBuilder sb = new StringBuilder();
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 }