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