1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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 interface is a model that represents the PluginSetting table in the
50   * database.
51   * </p>
52   *
53   * @author    Brian Wing Shun Chan
54   * @see       PluginSettingImpl
55   * @see       com.liferay.portal.model.PluginSetting
56   * @see       com.liferay.portal.model.PluginSettingModel
57   * @generated
58   */
59  public class PluginSettingModelImpl extends BaseModelImpl<PluginSetting> {
60      public static final String TABLE_NAME = "PluginSetting";
61      public static final Object[][] TABLE_COLUMNS = {
62              { "pluginSettingId", new Integer(Types.BIGINT) },
63              { "companyId", new Integer(Types.BIGINT) },
64              { "pluginId", new Integer(Types.VARCHAR) },
65              { "pluginType", new Integer(Types.VARCHAR) },
66              { "roles", new Integer(Types.VARCHAR) },
67              { "active_", new Integer(Types.BOOLEAN) }
68          };
69      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)";
70      public static final String TABLE_SQL_DROP = "drop table PluginSetting";
71      public static final String DATA_SOURCE = "liferayDataSource";
72      public static final String SESSION_FACTORY = "liferaySessionFactory";
73      public static final String TX_MANAGER = "liferayTransactionManager";
74      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
75                  "value.object.entity.cache.enabled.com.liferay.portal.model.PluginSetting"),
76              true);
77      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
78                  "value.object.finder.cache.enabled.com.liferay.portal.model.PluginSetting"),
79              true);
80  
81      public static PluginSetting toModel(PluginSettingSoap soapModel) {
82          PluginSetting model = new PluginSettingImpl();
83  
84          model.setPluginSettingId(soapModel.getPluginSettingId());
85          model.setCompanyId(soapModel.getCompanyId());
86          model.setPluginId(soapModel.getPluginId());
87          model.setPluginType(soapModel.getPluginType());
88          model.setRoles(soapModel.getRoles());
89          model.setActive(soapModel.getActive());
90  
91          return model;
92      }
93  
94      public static List<PluginSetting> toModels(PluginSettingSoap[] soapModels) {
95          List<PluginSetting> models = new ArrayList<PluginSetting>(soapModels.length);
96  
97          for (PluginSettingSoap soapModel : soapModels) {
98              models.add(toModel(soapModel));
99          }
100 
101         return models;
102     }
103 
104     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
105                 "lock.expiration.time.com.liferay.portal.model.PluginSetting"));
106 
107     public PluginSettingModelImpl() {
108     }
109 
110     public long getPrimaryKey() {
111         return _pluginSettingId;
112     }
113 
114     public void setPrimaryKey(long pk) {
115         setPluginSettingId(pk);
116     }
117 
118     public Serializable getPrimaryKeyObj() {
119         return new Long(_pluginSettingId);
120     }
121 
122     public long getPluginSettingId() {
123         return _pluginSettingId;
124     }
125 
126     public void setPluginSettingId(long pluginSettingId) {
127         _pluginSettingId = pluginSettingId;
128     }
129 
130     public long getCompanyId() {
131         return _companyId;
132     }
133 
134     public void setCompanyId(long companyId) {
135         _companyId = companyId;
136 
137         if (!_setOriginalCompanyId) {
138             _setOriginalCompanyId = true;
139 
140             _originalCompanyId = companyId;
141         }
142     }
143 
144     public long getOriginalCompanyId() {
145         return _originalCompanyId;
146     }
147 
148     public String getPluginId() {
149         return GetterUtil.getString(_pluginId);
150     }
151 
152     public void setPluginId(String pluginId) {
153         _pluginId = pluginId;
154 
155         if (_originalPluginId == null) {
156             _originalPluginId = pluginId;
157         }
158     }
159 
160     public String getOriginalPluginId() {
161         return GetterUtil.getString(_originalPluginId);
162     }
163 
164     public String getPluginType() {
165         return GetterUtil.getString(_pluginType);
166     }
167 
168     public void setPluginType(String pluginType) {
169         _pluginType = pluginType;
170 
171         if (_originalPluginType == null) {
172             _originalPluginType = pluginType;
173         }
174     }
175 
176     public String getOriginalPluginType() {
177         return GetterUtil.getString(_originalPluginType);
178     }
179 
180     public String getRoles() {
181         return GetterUtil.getString(_roles);
182     }
183 
184     public void setRoles(String roles) {
185         _roles = roles;
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         _active = active;
198     }
199 
200     public PluginSetting toEscapedModel() {
201         if (isEscapedModel()) {
202             return (PluginSetting)this;
203         }
204         else {
205             PluginSetting model = new PluginSettingImpl();
206 
207             model.setNew(isNew());
208             model.setEscapedModel(true);
209 
210             model.setPluginSettingId(getPluginSettingId());
211             model.setCompanyId(getCompanyId());
212             model.setPluginId(HtmlUtil.escape(getPluginId()));
213             model.setPluginType(HtmlUtil.escape(getPluginType()));
214             model.setRoles(HtmlUtil.escape(getRoles()));
215             model.setActive(getActive());
216 
217             model = (PluginSetting)Proxy.newProxyInstance(PluginSetting.class.getClassLoader(),
218                     new Class[] { PluginSetting.class },
219                     new ReadOnlyBeanHandler(model));
220 
221             return model;
222         }
223     }
224 
225     public Object clone() {
226         PluginSettingImpl clone = new PluginSettingImpl();
227 
228         clone.setPluginSettingId(getPluginSettingId());
229         clone.setCompanyId(getCompanyId());
230         clone.setPluginId(getPluginId());
231         clone.setPluginType(getPluginType());
232         clone.setRoles(getRoles());
233         clone.setActive(getActive());
234 
235         return clone;
236     }
237 
238     public int compareTo(PluginSetting pluginSetting) {
239         long pk = pluginSetting.getPrimaryKey();
240 
241         if (getPrimaryKey() < pk) {
242             return -1;
243         }
244         else if (getPrimaryKey() > pk) {
245             return 1;
246         }
247         else {
248             return 0;
249         }
250     }
251 
252     public boolean equals(Object obj) {
253         if (obj == null) {
254             return false;
255         }
256 
257         PluginSetting pluginSetting = null;
258 
259         try {
260             pluginSetting = (PluginSetting)obj;
261         }
262         catch (ClassCastException cce) {
263             return false;
264         }
265 
266         long pk = pluginSetting.getPrimaryKey();
267 
268         if (getPrimaryKey() == pk) {
269             return true;
270         }
271         else {
272             return false;
273         }
274     }
275 
276     public int hashCode() {
277         return (int)getPrimaryKey();
278     }
279 
280     public String toString() {
281         StringBuilder sb = new StringBuilder();
282 
283         sb.append("{pluginSettingId=");
284         sb.append(getPluginSettingId());
285         sb.append(", companyId=");
286         sb.append(getCompanyId());
287         sb.append(", pluginId=");
288         sb.append(getPluginId());
289         sb.append(", pluginType=");
290         sb.append(getPluginType());
291         sb.append(", roles=");
292         sb.append(getRoles());
293         sb.append(", active=");
294         sb.append(getActive());
295         sb.append("}");
296 
297         return sb.toString();
298     }
299 
300     public String toXmlString() {
301         StringBuilder sb = new StringBuilder();
302 
303         sb.append("<model><model-name>");
304         sb.append("com.liferay.portal.model.PluginSetting");
305         sb.append("</model-name>");
306 
307         sb.append(
308             "<column><column-name>pluginSettingId</column-name><column-value><![CDATA[");
309         sb.append(getPluginSettingId());
310         sb.append("]]></column-value></column>");
311         sb.append(
312             "<column><column-name>companyId</column-name><column-value><![CDATA[");
313         sb.append(getCompanyId());
314         sb.append("]]></column-value></column>");
315         sb.append(
316             "<column><column-name>pluginId</column-name><column-value><![CDATA[");
317         sb.append(getPluginId());
318         sb.append("]]></column-value></column>");
319         sb.append(
320             "<column><column-name>pluginType</column-name><column-value><![CDATA[");
321         sb.append(getPluginType());
322         sb.append("]]></column-value></column>");
323         sb.append(
324             "<column><column-name>roles</column-name><column-value><![CDATA[");
325         sb.append(getRoles());
326         sb.append("]]></column-value></column>");
327         sb.append(
328             "<column><column-name>active</column-name><column-value><![CDATA[");
329         sb.append(getActive());
330         sb.append("]]></column-value></column>");
331 
332         sb.append("</model>");
333 
334         return sb.toString();
335     }
336 
337     private long _pluginSettingId;
338     private long _companyId;
339     private long _originalCompanyId;
340     private boolean _setOriginalCompanyId;
341     private String _pluginId;
342     private String _originalPluginId;
343     private String _pluginType;
344     private String _originalPluginType;
345     private String _roles;
346     private boolean _active;
347 }