1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.model.impl;
21  
22  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23  import com.liferay.portal.kernel.util.GetterUtil;
24  import com.liferay.portal.kernel.util.HtmlUtil;
25  import com.liferay.portal.model.PluginSetting;
26  import com.liferay.portal.model.PluginSettingSoap;
27  
28  import com.liferay.portlet.expando.model.ExpandoBridge;
29  import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
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 ExpandoBridge getExpandoBridge() {
237         if (_expandoBridge == null) {
238             _expandoBridge = new ExpandoBridgeImpl(PluginSetting.class.getName(),
239                     getPrimaryKey());
240         }
241 
242         return _expandoBridge;
243     }
244 
245     public Object clone() {
246         PluginSettingImpl clone = new PluginSettingImpl();
247 
248         clone.setPluginSettingId(getPluginSettingId());
249         clone.setCompanyId(getCompanyId());
250         clone.setPluginId(getPluginId());
251         clone.setPluginType(getPluginType());
252         clone.setRoles(getRoles());
253         clone.setActive(getActive());
254 
255         return clone;
256     }
257 
258     public int compareTo(PluginSetting pluginSetting) {
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         PluginSetting pluginSetting = null;
278 
279         try {
280             pluginSetting = (PluginSetting)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     public String toString() {
301         StringBuilder sb = new StringBuilder();
302 
303         sb.append("{pluginSettingId=");
304         sb.append(getPluginSettingId());
305         sb.append(", companyId=");
306         sb.append(getCompanyId());
307         sb.append(", pluginId=");
308         sb.append(getPluginId());
309         sb.append(", pluginType=");
310         sb.append(getPluginType());
311         sb.append(", roles=");
312         sb.append(getRoles());
313         sb.append(", active=");
314         sb.append(getActive());
315         sb.append("}");
316 
317         return sb.toString();
318     }
319 
320     public String toXmlString() {
321         StringBuilder sb = new StringBuilder();
322 
323         sb.append("<model><model-name>");
324         sb.append("com.liferay.portal.model.PluginSetting");
325         sb.append("</model-name>");
326 
327         sb.append(
328             "<column><column-name>pluginSettingId</column-name><column-value><![CDATA[");
329         sb.append(getPluginSettingId());
330         sb.append("]]></column-value></column>");
331         sb.append(
332             "<column><column-name>companyId</column-name><column-value><![CDATA[");
333         sb.append(getCompanyId());
334         sb.append("]]></column-value></column>");
335         sb.append(
336             "<column><column-name>pluginId</column-name><column-value><![CDATA[");
337         sb.append(getPluginId());
338         sb.append("]]></column-value></column>");
339         sb.append(
340             "<column><column-name>pluginType</column-name><column-value><![CDATA[");
341         sb.append(getPluginType());
342         sb.append("]]></column-value></column>");
343         sb.append(
344             "<column><column-name>roles</column-name><column-value><![CDATA[");
345         sb.append(getRoles());
346         sb.append("]]></column-value></column>");
347         sb.append(
348             "<column><column-name>active</column-name><column-value><![CDATA[");
349         sb.append(getActive());
350         sb.append("]]></column-value></column>");
351 
352         sb.append("</model>");
353 
354         return sb.toString();
355     }
356 
357     private long _pluginSettingId;
358     private long _companyId;
359     private long _originalCompanyId;
360     private boolean _setOriginalCompanyId;
361     private String _pluginId;
362     private String _originalPluginId;
363     private String _pluginType;
364     private String _originalPluginType;
365     private String _roles;
366     private boolean _active;
367     private transient ExpandoBridge _expandoBridge;
368 }