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.kernel.util.StringBundler;
29  import com.liferay.portal.model.PluginSetting;
30  import com.liferay.portal.model.PluginSettingSoap;
31  import com.liferay.portal.service.ServiceContext;
32  
33  import com.liferay.portlet.expando.model.ExpandoBridge;
34  import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
35  
36  import java.io.Serializable;
37  
38  import java.lang.reflect.Proxy;
39  
40  import java.sql.Types;
41  
42  import java.util.ArrayList;
43  import java.util.List;
44  
45  /**
46   * <a href="PluginSettingModelImpl.java.html"><b><i>View Source</i></b></a>
47   *
48   * <p>
49   * ServiceBuilder generated this class. Modifications in this class will be
50   * overwritten the next time is generated.
51   * </p>
52   *
53   * <p>
54   * This interface is a model that represents the PluginSetting table in the
55   * database.
56   * </p>
57   *
58   * @author    Brian Wing Shun Chan
59   * @see       PluginSettingImpl
60   * @see       com.liferay.portal.model.PluginSetting
61   * @see       com.liferay.portal.model.PluginSettingModel
62   * @generated
63   */
64  public class PluginSettingModelImpl extends BaseModelImpl<PluginSetting> {
65      public static final String TABLE_NAME = "PluginSetting";
66      public static final Object[][] TABLE_COLUMNS = {
67              { "pluginSettingId", new Integer(Types.BIGINT) },
68              { "companyId", new Integer(Types.BIGINT) },
69              { "pluginId", new Integer(Types.VARCHAR) },
70              { "pluginType", new Integer(Types.VARCHAR) },
71              { "roles", new Integer(Types.VARCHAR) },
72              { "active_", new Integer(Types.BOOLEAN) }
73          };
74      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)";
75      public static final String TABLE_SQL_DROP = "drop table PluginSetting";
76      public static final String DATA_SOURCE = "liferayDataSource";
77      public static final String SESSION_FACTORY = "liferaySessionFactory";
78      public static final String TX_MANAGER = "liferayTransactionManager";
79      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
80                  "value.object.entity.cache.enabled.com.liferay.portal.model.PluginSetting"),
81              true);
82      public static final boolean FINDER_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         _pluginSettingId = pluginSettingId;
133     }
134 
135     public long getCompanyId() {
136         return _companyId;
137     }
138 
139     public void setCompanyId(long companyId) {
140         _companyId = companyId;
141 
142         if (!_setOriginalCompanyId) {
143             _setOriginalCompanyId = true;
144 
145             _originalCompanyId = companyId;
146         }
147     }
148 
149     public long getOriginalCompanyId() {
150         return _originalCompanyId;
151     }
152 
153     public String getPluginId() {
154         return GetterUtil.getString(_pluginId);
155     }
156 
157     public void setPluginId(String pluginId) {
158         _pluginId = pluginId;
159 
160         if (_originalPluginId == null) {
161             _originalPluginId = pluginId;
162         }
163     }
164 
165     public String getOriginalPluginId() {
166         return GetterUtil.getString(_originalPluginId);
167     }
168 
169     public String getPluginType() {
170         return GetterUtil.getString(_pluginType);
171     }
172 
173     public void setPluginType(String pluginType) {
174         _pluginType = pluginType;
175 
176         if (_originalPluginType == null) {
177             _originalPluginType = pluginType;
178         }
179     }
180 
181     public String getOriginalPluginType() {
182         return GetterUtil.getString(_originalPluginType);
183     }
184 
185     public String getRoles() {
186         return GetterUtil.getString(_roles);
187     }
188 
189     public void setRoles(String roles) {
190         _roles = roles;
191     }
192 
193     public boolean getActive() {
194         return _active;
195     }
196 
197     public boolean isActive() {
198         return _active;
199     }
200 
201     public void setActive(boolean active) {
202         _active = active;
203     }
204 
205     public PluginSetting toEscapedModel() {
206         if (isEscapedModel()) {
207             return (PluginSetting)this;
208         }
209         else {
210             PluginSetting model = new PluginSettingImpl();
211 
212             model.setNew(isNew());
213             model.setEscapedModel(true);
214 
215             model.setPluginSettingId(getPluginSettingId());
216             model.setCompanyId(getCompanyId());
217             model.setPluginId(HtmlUtil.escape(getPluginId()));
218             model.setPluginType(HtmlUtil.escape(getPluginType()));
219             model.setRoles(HtmlUtil.escape(getRoles()));
220             model.setActive(getActive());
221 
222             model = (PluginSetting)Proxy.newProxyInstance(PluginSetting.class.getClassLoader(),
223                     new Class[] { PluginSetting.class },
224                     new ReadOnlyBeanHandler(model));
225 
226             return model;
227         }
228     }
229 
230     public ExpandoBridge getExpandoBridge() {
231         if (_expandoBridge == null) {
232             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(PluginSetting.class.getName(),
233                     getPrimaryKey());
234         }
235 
236         return _expandoBridge;
237     }
238 
239     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
240         getExpandoBridge().setAttributes(serviceContext);
241     }
242 
243     public Object clone() {
244         PluginSettingImpl clone = new PluginSettingImpl();
245 
246         clone.setPluginSettingId(getPluginSettingId());
247         clone.setCompanyId(getCompanyId());
248         clone.setPluginId(getPluginId());
249         clone.setPluginType(getPluginType());
250         clone.setRoles(getRoles());
251         clone.setActive(getActive());
252 
253         return clone;
254     }
255 
256     public int compareTo(PluginSetting pluginSetting) {
257         long pk = pluginSetting.getPrimaryKey();
258 
259         if (getPrimaryKey() < pk) {
260             return -1;
261         }
262         else if (getPrimaryKey() > pk) {
263             return 1;
264         }
265         else {
266             return 0;
267         }
268     }
269 
270     public boolean equals(Object obj) {
271         if (obj == null) {
272             return false;
273         }
274 
275         PluginSetting pluginSetting = null;
276 
277         try {
278             pluginSetting = (PluginSetting)obj;
279         }
280         catch (ClassCastException cce) {
281             return false;
282         }
283 
284         long pk = pluginSetting.getPrimaryKey();
285 
286         if (getPrimaryKey() == pk) {
287             return true;
288         }
289         else {
290             return false;
291         }
292     }
293 
294     public int hashCode() {
295         return (int)getPrimaryKey();
296     }
297 
298     public String toString() {
299         StringBundler sb = new StringBundler(13);
300 
301         sb.append("{pluginSettingId=");
302         sb.append(getPluginSettingId());
303         sb.append(", companyId=");
304         sb.append(getCompanyId());
305         sb.append(", pluginId=");
306         sb.append(getPluginId());
307         sb.append(", pluginType=");
308         sb.append(getPluginType());
309         sb.append(", roles=");
310         sb.append(getRoles());
311         sb.append(", active=");
312         sb.append(getActive());
313         sb.append("}");
314 
315         return sb.toString();
316     }
317 
318     public String toXmlString() {
319         StringBundler sb = new StringBundler(22);
320 
321         sb.append("<model><model-name>");
322         sb.append("com.liferay.portal.model.PluginSetting");
323         sb.append("</model-name>");
324 
325         sb.append(
326             "<column><column-name>pluginSettingId</column-name><column-value><![CDATA[");
327         sb.append(getPluginSettingId());
328         sb.append("]]></column-value></column>");
329         sb.append(
330             "<column><column-name>companyId</column-name><column-value><![CDATA[");
331         sb.append(getCompanyId());
332         sb.append("]]></column-value></column>");
333         sb.append(
334             "<column><column-name>pluginId</column-name><column-value><![CDATA[");
335         sb.append(getPluginId());
336         sb.append("]]></column-value></column>");
337         sb.append(
338             "<column><column-name>pluginType</column-name><column-value><![CDATA[");
339         sb.append(getPluginType());
340         sb.append("]]></column-value></column>");
341         sb.append(
342             "<column><column-name>roles</column-name><column-value><![CDATA[");
343         sb.append(getRoles());
344         sb.append("]]></column-value></column>");
345         sb.append(
346             "<column><column-name>active</column-name><column-value><![CDATA[");
347         sb.append(getActive());
348         sb.append("]]></column-value></column>");
349 
350         sb.append("</model>");
351 
352         return sb.toString();
353     }
354 
355     private long _pluginSettingId;
356     private long _companyId;
357     private long _originalCompanyId;
358     private boolean _setOriginalCompanyId;
359     private String _pluginId;
360     private String _originalPluginId;
361     private String _pluginType;
362     private String _originalPluginType;
363     private String _roles;
364     private boolean _active;
365     private transient ExpandoBridge _expandoBridge;
366 }