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.model.PluginSetting;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.util.Html;
31  
32  import java.io.Serializable;
33  
34  import java.lang.reflect.Proxy;
35  
36  import java.sql.Types;
37  
38  /**
39   * <a href="PluginSettingModelImpl.java.html"><b><i>View Source</i></b></a>
40   *
41   * <p>
42   * ServiceBuilder generated this class. Modifications in this class will be
43   * overwritten the next time is generated.
44   * </p>
45   *
46   * <p>
47   * This class is a model that represents the <code>PluginSetting</code> table
48   * in the database.
49   * </p>
50   *
51   * @author Brian Wing Shun Chan
52   *
53   * @see com.liferay.portal.service.model.PluginSetting
54   * @see com.liferay.portal.service.model.PluginSettingModel
55   * @see com.liferay.portal.service.model.impl.PluginSettingImpl
56   *
57   */
58  public class PluginSettingModelImpl extends BaseModelImpl {
59      public static final String TABLE_NAME = "PluginSetting";
60      public static final Object[][] TABLE_COLUMNS = {
61              { "pluginSettingId", new Integer(Types.BIGINT) },
62              
63  
64              { "companyId", new Integer(Types.BIGINT) },
65              
66  
67              { "pluginId", new Integer(Types.VARCHAR) },
68              
69  
70              { "pluginType", new Integer(Types.VARCHAR) },
71              
72  
73              { "roles", new Integer(Types.VARCHAR) },
74              
75  
76              { "active_", new Integer(Types.BOOLEAN) }
77          };
78      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)";
79      public static final String TABLE_SQL_DROP = "drop table PluginSetting";
80      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
81                  "value.object.finder.cache.enabled.com.liferay.portal.model.PluginSetting"),
82              true);
83      public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
84                  "lock.expiration.time.com.liferay.portal.model.PluginSetting"));
85  
86      public PluginSettingModelImpl() {
87      }
88  
89      public long getPrimaryKey() {
90          return _pluginSettingId;
91      }
92  
93      public void setPrimaryKey(long pk) {
94          setPluginSettingId(pk);
95      }
96  
97      public Serializable getPrimaryKeyObj() {
98          return new Long(_pluginSettingId);
99      }
100 
101     public long getPluginSettingId() {
102         return _pluginSettingId;
103     }
104 
105     public void setPluginSettingId(long pluginSettingId) {
106         if (pluginSettingId != _pluginSettingId) {
107             _pluginSettingId = pluginSettingId;
108         }
109     }
110 
111     public long getCompanyId() {
112         return _companyId;
113     }
114 
115     public void setCompanyId(long companyId) {
116         if (companyId != _companyId) {
117             _companyId = companyId;
118         }
119     }
120 
121     public String getPluginId() {
122         return GetterUtil.getString(_pluginId);
123     }
124 
125     public void setPluginId(String pluginId) {
126         if (((pluginId == null) && (_pluginId != null)) ||
127                 ((pluginId != null) && (_pluginId == null)) ||
128                 ((pluginId != null) && (_pluginId != null) &&
129                 !pluginId.equals(_pluginId))) {
130             _pluginId = pluginId;
131         }
132     }
133 
134     public String getPluginType() {
135         return GetterUtil.getString(_pluginType);
136     }
137 
138     public void setPluginType(String pluginType) {
139         if (((pluginType == null) && (_pluginType != null)) ||
140                 ((pluginType != null) && (_pluginType == null)) ||
141                 ((pluginType != null) && (_pluginType != null) &&
142                 !pluginType.equals(_pluginType))) {
143             _pluginType = pluginType;
144         }
145     }
146 
147     public String getRoles() {
148         return GetterUtil.getString(_roles);
149     }
150 
151     public void setRoles(String roles) {
152         if (((roles == null) && (_roles != null)) ||
153                 ((roles != null) && (_roles == null)) ||
154                 ((roles != null) && (_roles != null) && !roles.equals(_roles))) {
155             _roles = roles;
156         }
157     }
158 
159     public boolean getActive() {
160         return _active;
161     }
162 
163     public boolean isActive() {
164         return _active;
165     }
166 
167     public void setActive(boolean active) {
168         if (active != _active) {
169             _active = active;
170         }
171     }
172 
173     public PluginSetting toEscapedModel() {
174         if (isEscapedModel()) {
175             return (PluginSetting)this;
176         }
177         else {
178             PluginSetting model = new PluginSettingImpl();
179 
180             model.setEscapedModel(true);
181 
182             model.setPluginSettingId(getPluginSettingId());
183             model.setCompanyId(getCompanyId());
184             model.setPluginId(Html.escape(getPluginId()));
185             model.setPluginType(Html.escape(getPluginType()));
186             model.setRoles(Html.escape(getRoles()));
187             model.setActive(getActive());
188 
189             model = (PluginSetting)Proxy.newProxyInstance(PluginSetting.class.getClassLoader(),
190                     new Class[] { PluginSetting.class },
191                     new ReadOnlyBeanHandler(model));
192 
193             return model;
194         }
195     }
196 
197     public Object clone() {
198         PluginSettingImpl clone = new PluginSettingImpl();
199 
200         clone.setPluginSettingId(getPluginSettingId());
201         clone.setCompanyId(getCompanyId());
202         clone.setPluginId(getPluginId());
203         clone.setPluginType(getPluginType());
204         clone.setRoles(getRoles());
205         clone.setActive(getActive());
206 
207         return clone;
208     }
209 
210     public int compareTo(Object obj) {
211         if (obj == null) {
212             return -1;
213         }
214 
215         PluginSettingImpl pluginSetting = (PluginSettingImpl)obj;
216 
217         long pk = pluginSetting.getPrimaryKey();
218 
219         if (getPrimaryKey() < pk) {
220             return -1;
221         }
222         else if (getPrimaryKey() > pk) {
223             return 1;
224         }
225         else {
226             return 0;
227         }
228     }
229 
230     public boolean equals(Object obj) {
231         if (obj == null) {
232             return false;
233         }
234 
235         PluginSettingImpl pluginSetting = null;
236 
237         try {
238             pluginSetting = (PluginSettingImpl)obj;
239         }
240         catch (ClassCastException cce) {
241             return false;
242         }
243 
244         long pk = pluginSetting.getPrimaryKey();
245 
246         if (getPrimaryKey() == pk) {
247             return true;
248         }
249         else {
250             return false;
251         }
252     }
253 
254     public int hashCode() {
255         return (int)getPrimaryKey();
256     }
257 
258     private long _pluginSettingId;
259     private long _companyId;
260     private String _pluginId;
261     private String _pluginType;
262     private String _roles;
263     private boolean _active;
264 }