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