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