1   /**
2    * Copyright (c) 2000-2008 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.service.model.PluginSetting
56   * @see com.liferay.portal.service.model.PluginSettingModel
57   * @see com.liferay.portal.service.model.impl.PluginSettingImpl
58   *
59   */
60  public class PluginSettingModelImpl extends BaseModelImpl {
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 CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
86                  "value.object.finder.cache.enabled.com.liferay.portal.model.PluginSetting"),
87              true);
88  
89      public static PluginSetting toModel(PluginSettingSoap soapModel) {
90          PluginSetting model = new PluginSettingImpl();
91  
92          model.setPluginSettingId(soapModel.getPluginSettingId());
93          model.setCompanyId(soapModel.getCompanyId());
94          model.setPluginId(soapModel.getPluginId());
95          model.setPluginType(soapModel.getPluginType());
96          model.setRoles(soapModel.getRoles());
97          model.setActive(soapModel.getActive());
98  
99          return model;
100     }
101 
102     public static List<PluginSetting> toModels(PluginSettingSoap[] soapModels) {
103         List<PluginSetting> models = new ArrayList<PluginSetting>(soapModels.length);
104 
105         for (PluginSettingSoap soapModel : soapModels) {
106             models.add(toModel(soapModel));
107         }
108 
109         return models;
110     }
111 
112     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
113                 "lock.expiration.time.com.liferay.portal.model.PluginSetting"));
114 
115     public PluginSettingModelImpl() {
116     }
117 
118     public long getPrimaryKey() {
119         return _pluginSettingId;
120     }
121 
122     public void setPrimaryKey(long pk) {
123         setPluginSettingId(pk);
124     }
125 
126     public Serializable getPrimaryKeyObj() {
127         return new Long(_pluginSettingId);
128     }
129 
130     public long getPluginSettingId() {
131         return _pluginSettingId;
132     }
133 
134     public void setPluginSettingId(long pluginSettingId) {
135         if (pluginSettingId != _pluginSettingId) {
136             _pluginSettingId = pluginSettingId;
137         }
138     }
139 
140     public long getCompanyId() {
141         return _companyId;
142     }
143 
144     public void setCompanyId(long companyId) {
145         if (companyId != _companyId) {
146             _companyId = companyId;
147         }
148     }
149 
150     public String getPluginId() {
151         return GetterUtil.getString(_pluginId);
152     }
153 
154     public void setPluginId(String pluginId) {
155         if (((pluginId == null) && (_pluginId != null)) ||
156                 ((pluginId != null) && (_pluginId == null)) ||
157                 ((pluginId != null) && (_pluginId != null) &&
158                 !pluginId.equals(_pluginId))) {
159             _pluginId = pluginId;
160         }
161     }
162 
163     public String getPluginType() {
164         return GetterUtil.getString(_pluginType);
165     }
166 
167     public void setPluginType(String pluginType) {
168         if (((pluginType == null) && (_pluginType != null)) ||
169                 ((pluginType != null) && (_pluginType == null)) ||
170                 ((pluginType != null) && (_pluginType != null) &&
171                 !pluginType.equals(_pluginType))) {
172             _pluginType = pluginType;
173         }
174     }
175 
176     public String getRoles() {
177         return GetterUtil.getString(_roles);
178     }
179 
180     public void setRoles(String roles) {
181         if (((roles == null) && (_roles != null)) ||
182                 ((roles != null) && (_roles == null)) ||
183                 ((roles != null) && (_roles != null) && !roles.equals(_roles))) {
184             _roles = roles;
185         }
186     }
187 
188     public boolean getActive() {
189         return _active;
190     }
191 
192     public boolean isActive() {
193         return _active;
194     }
195 
196     public void setActive(boolean active) {
197         if (active != _active) {
198             _active = active;
199         }
200     }
201 
202     public PluginSetting toEscapedModel() {
203         if (isEscapedModel()) {
204             return (PluginSetting)this;
205         }
206         else {
207             PluginSetting model = new PluginSettingImpl();
208 
209             model.setEscapedModel(true);
210 
211             model.setPluginSettingId(getPluginSettingId());
212             model.setCompanyId(getCompanyId());
213             model.setPluginId(HtmlUtil.escape(getPluginId()));
214             model.setPluginType(HtmlUtil.escape(getPluginType()));
215             model.setRoles(HtmlUtil.escape(getRoles()));
216             model.setActive(getActive());
217 
218             model = (PluginSetting)Proxy.newProxyInstance(PluginSetting.class.getClassLoader(),
219                     new Class[] { PluginSetting.class },
220                     new ReadOnlyBeanHandler(model));
221 
222             return model;
223         }
224     }
225 
226     public Object clone() {
227         PluginSettingImpl clone = new PluginSettingImpl();
228 
229         clone.setPluginSettingId(getPluginSettingId());
230         clone.setCompanyId(getCompanyId());
231         clone.setPluginId(getPluginId());
232         clone.setPluginType(getPluginType());
233         clone.setRoles(getRoles());
234         clone.setActive(getActive());
235 
236         return clone;
237     }
238 
239     public int compareTo(Object obj) {
240         if (obj == null) {
241             return -1;
242         }
243 
244         PluginSettingImpl pluginSetting = (PluginSettingImpl)obj;
245 
246         long pk = pluginSetting.getPrimaryKey();
247 
248         if (getPrimaryKey() < pk) {
249             return -1;
250         }
251         else if (getPrimaryKey() > pk) {
252             return 1;
253         }
254         else {
255             return 0;
256         }
257     }
258 
259     public boolean equals(Object obj) {
260         if (obj == null) {
261             return false;
262         }
263 
264         PluginSettingImpl pluginSetting = null;
265 
266         try {
267             pluginSetting = (PluginSettingImpl)obj;
268         }
269         catch (ClassCastException cce) {
270             return false;
271         }
272 
273         long pk = pluginSetting.getPrimaryKey();
274 
275         if (getPrimaryKey() == pk) {
276             return true;
277         }
278         else {
279             return false;
280         }
281     }
282 
283     public int hashCode() {
284         return (int)getPrimaryKey();
285     }
286 
287     private long _pluginSettingId;
288     private long _companyId;
289     private String _pluginId;
290     private String _pluginType;
291     private String _roles;
292     private boolean _active;
293 }