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