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 {
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 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         if (pluginSettingId != _pluginSettingId) {
139             _pluginSettingId = pluginSettingId;
140         }
141     }
142 
143     public long getCompanyId() {
144         return _companyId;
145     }
146 
147     public void setCompanyId(long companyId) {
148         if (companyId != _companyId) {
149             _companyId = companyId;
150         }
151     }
152 
153     public String getPluginId() {
154         return GetterUtil.getString(_pluginId);
155     }
156 
157     public void setPluginId(String pluginId) {
158         if (((pluginId == null) && (_pluginId != null)) ||
159                 ((pluginId != null) && (_pluginId == null)) ||
160                 ((pluginId != null) && (_pluginId != null) &&
161                 !pluginId.equals(_pluginId))) {
162             _pluginId = pluginId;
163         }
164     }
165 
166     public String getPluginType() {
167         return GetterUtil.getString(_pluginType);
168     }
169 
170     public void setPluginType(String pluginType) {
171         if (((pluginType == null) && (_pluginType != null)) ||
172                 ((pluginType != null) && (_pluginType == null)) ||
173                 ((pluginType != null) && (_pluginType != null) &&
174                 !pluginType.equals(_pluginType))) {
175             _pluginType = pluginType;
176         }
177     }
178 
179     public String getRoles() {
180         return GetterUtil.getString(_roles);
181     }
182 
183     public void setRoles(String roles) {
184         if (((roles == null) && (_roles != null)) ||
185                 ((roles != null) && (_roles == null)) ||
186                 ((roles != null) && (_roles != null) && !roles.equals(_roles))) {
187             _roles = roles;
188         }
189     }
190 
191     public boolean getActive() {
192         return _active;
193     }
194 
195     public boolean isActive() {
196         return _active;
197     }
198 
199     public void setActive(boolean active) {
200         if (active != _active) {
201             _active = active;
202         }
203     }
204 
205     public PluginSetting toEscapedModel() {
206         if (isEscapedModel()) {
207             return (PluginSetting)this;
208         }
209         else {
210             PluginSetting model = new PluginSettingImpl();
211 
212             model.setNew(isNew());
213             model.setEscapedModel(true);
214 
215             model.setPluginSettingId(getPluginSettingId());
216             model.setCompanyId(getCompanyId());
217             model.setPluginId(HtmlUtil.escape(getPluginId()));
218             model.setPluginType(HtmlUtil.escape(getPluginType()));
219             model.setRoles(HtmlUtil.escape(getRoles()));
220             model.setActive(getActive());
221 
222             model = (PluginSetting)Proxy.newProxyInstance(PluginSetting.class.getClassLoader(),
223                     new Class[] { PluginSetting.class },
224                     new ReadOnlyBeanHandler(model));
225 
226             return model;
227         }
228     }
229 
230     public ExpandoBridge getExpandoBridge() {
231         if (_expandoBridge == null) {
232             _expandoBridge = new ExpandoBridgeImpl(PluginSetting.class.getName(),
233                     getPrimaryKey());
234         }
235 
236         return _expandoBridge;
237     }
238 
239     public Object clone() {
240         PluginSettingImpl clone = new PluginSettingImpl();
241 
242         clone.setPluginSettingId(getPluginSettingId());
243         clone.setCompanyId(getCompanyId());
244         clone.setPluginId(getPluginId());
245         clone.setPluginType(getPluginType());
246         clone.setRoles(getRoles());
247         clone.setActive(getActive());
248 
249         return clone;
250     }
251 
252     public int compareTo(Object obj) {
253         if (obj == null) {
254             return -1;
255         }
256 
257         PluginSettingImpl pluginSetting = (PluginSettingImpl)obj;
258 
259         long pk = pluginSetting.getPrimaryKey();
260 
261         if (getPrimaryKey() < pk) {
262             return -1;
263         }
264         else if (getPrimaryKey() > pk) {
265             return 1;
266         }
267         else {
268             return 0;
269         }
270     }
271 
272     public boolean equals(Object obj) {
273         if (obj == null) {
274             return false;
275         }
276 
277         PluginSettingImpl pluginSetting = null;
278 
279         try {
280             pluginSetting = (PluginSettingImpl)obj;
281         }
282         catch (ClassCastException cce) {
283             return false;
284         }
285 
286         long pk = pluginSetting.getPrimaryKey();
287 
288         if (getPrimaryKey() == pk) {
289             return true;
290         }
291         else {
292             return false;
293         }
294     }
295 
296     public int hashCode() {
297         return (int)getPrimaryKey();
298     }
299 
300     private long _pluginSettingId;
301     private long _companyId;
302     private String _pluginId;
303     private String _pluginType;
304     private String _roles;
305     private boolean _active;
306     private transient ExpandoBridge _expandoBridge;
307 }