1   /**
2    * Copyright (c) 2000-2009 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.portlet.softwarecatalog.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.impl.BaseModelImpl;
29  
30  import com.liferay.portlet.softwarecatalog.model.SCLicense;
31  import com.liferay.portlet.softwarecatalog.model.SCLicenseSoap;
32  
33  import java.io.Serializable;
34  
35  import java.lang.reflect.Proxy;
36  
37  import java.sql.Types;
38  
39  import java.util.ArrayList;
40  import java.util.List;
41  
42  /**
43   * <a href="SCLicenseModelImpl.java.html"><b><i>View Source</i></b></a>
44   *
45   * <p>
46   * ServiceBuilder generated this class. Modifications in this class will be
47   * overwritten the next time is generated.
48   * </p>
49   *
50   * <p>
51   * This interface is a model that represents the SCLicense table in the
52   * database.
53   * </p>
54   *
55   * @author    Brian Wing Shun Chan
56   * @see       SCLicenseImpl
57   * @see       com.liferay.portlet.softwarecatalog.model.SCLicense
58   * @see       com.liferay.portlet.softwarecatalog.model.SCLicenseModel
59   * @generated
60   */
61  public class SCLicenseModelImpl extends BaseModelImpl<SCLicense> {
62      public static final String TABLE_NAME = "SCLicense";
63      public static final Object[][] TABLE_COLUMNS = {
64              { "licenseId", new Integer(Types.BIGINT) },
65              { "name", new Integer(Types.VARCHAR) },
66              { "url", new Integer(Types.VARCHAR) },
67              { "openSource", new Integer(Types.BOOLEAN) },
68              { "active_", new Integer(Types.BOOLEAN) },
69              { "recommended", new Integer(Types.BOOLEAN) }
70          };
71      public static final String TABLE_SQL_CREATE = "create table SCLicense (licenseId LONG not null primary key,name VARCHAR(75) null,url STRING null,openSource BOOLEAN,active_ BOOLEAN,recommended BOOLEAN)";
72      public static final String TABLE_SQL_DROP = "drop table SCLicense";
73      public static final String DATA_SOURCE = "liferayDataSource";
74      public static final String SESSION_FACTORY = "liferaySessionFactory";
75      public static final String TX_MANAGER = "liferayTransactionManager";
76      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
77                  "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCLicense"),
78              true);
79      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
80                  "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCLicense"),
81              true);
82  
83      public static SCLicense toModel(SCLicenseSoap soapModel) {
84          SCLicense model = new SCLicenseImpl();
85  
86          model.setLicenseId(soapModel.getLicenseId());
87          model.setName(soapModel.getName());
88          model.setUrl(soapModel.getUrl());
89          model.setOpenSource(soapModel.getOpenSource());
90          model.setActive(soapModel.getActive());
91          model.setRecommended(soapModel.getRecommended());
92  
93          return model;
94      }
95  
96      public static List<SCLicense> toModels(SCLicenseSoap[] soapModels) {
97          List<SCLicense> models = new ArrayList<SCLicense>(soapModels.length);
98  
99          for (SCLicenseSoap soapModel : soapModels) {
100             models.add(toModel(soapModel));
101         }
102 
103         return models;
104     }
105 
106     public static final boolean FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES =
107         GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
108                 "value.object.finder.cache.enabled.SCLicenses_SCProductEntries"),
109             true);
110     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
111                 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCLicense"));
112 
113     public SCLicenseModelImpl() {
114     }
115 
116     public long getPrimaryKey() {
117         return _licenseId;
118     }
119 
120     public void setPrimaryKey(long pk) {
121         setLicenseId(pk);
122     }
123 
124     public Serializable getPrimaryKeyObj() {
125         return new Long(_licenseId);
126     }
127 
128     public long getLicenseId() {
129         return _licenseId;
130     }
131 
132     public void setLicenseId(long licenseId) {
133         _licenseId = licenseId;
134     }
135 
136     public String getName() {
137         return GetterUtil.getString(_name);
138     }
139 
140     public void setName(String name) {
141         _name = name;
142     }
143 
144     public String getUrl() {
145         return GetterUtil.getString(_url);
146     }
147 
148     public void setUrl(String url) {
149         _url = url;
150     }
151 
152     public boolean getOpenSource() {
153         return _openSource;
154     }
155 
156     public boolean isOpenSource() {
157         return _openSource;
158     }
159 
160     public void setOpenSource(boolean openSource) {
161         _openSource = openSource;
162     }
163 
164     public boolean getActive() {
165         return _active;
166     }
167 
168     public boolean isActive() {
169         return _active;
170     }
171 
172     public void setActive(boolean active) {
173         _active = active;
174     }
175 
176     public boolean getRecommended() {
177         return _recommended;
178     }
179 
180     public boolean isRecommended() {
181         return _recommended;
182     }
183 
184     public void setRecommended(boolean recommended) {
185         _recommended = recommended;
186     }
187 
188     public SCLicense toEscapedModel() {
189         if (isEscapedModel()) {
190             return (SCLicense)this;
191         }
192         else {
193             SCLicense model = new SCLicenseImpl();
194 
195             model.setNew(isNew());
196             model.setEscapedModel(true);
197 
198             model.setLicenseId(getLicenseId());
199             model.setName(HtmlUtil.escape(getName()));
200             model.setUrl(HtmlUtil.escape(getUrl()));
201             model.setOpenSource(getOpenSource());
202             model.setActive(getActive());
203             model.setRecommended(getRecommended());
204 
205             model = (SCLicense)Proxy.newProxyInstance(SCLicense.class.getClassLoader(),
206                     new Class[] { SCLicense.class },
207                     new ReadOnlyBeanHandler(model));
208 
209             return model;
210         }
211     }
212 
213     public Object clone() {
214         SCLicenseImpl clone = new SCLicenseImpl();
215 
216         clone.setLicenseId(getLicenseId());
217         clone.setName(getName());
218         clone.setUrl(getUrl());
219         clone.setOpenSource(getOpenSource());
220         clone.setActive(getActive());
221         clone.setRecommended(getRecommended());
222 
223         return clone;
224     }
225 
226     public int compareTo(SCLicense scLicense) {
227         int value = 0;
228 
229         value = getName().compareTo(scLicense.getName());
230 
231         if (value != 0) {
232             return value;
233         }
234 
235         return 0;
236     }
237 
238     public boolean equals(Object obj) {
239         if (obj == null) {
240             return false;
241         }
242 
243         SCLicense scLicense = null;
244 
245         try {
246             scLicense = (SCLicense)obj;
247         }
248         catch (ClassCastException cce) {
249             return false;
250         }
251 
252         long pk = scLicense.getPrimaryKey();
253 
254         if (getPrimaryKey() == pk) {
255             return true;
256         }
257         else {
258             return false;
259         }
260     }
261 
262     public int hashCode() {
263         return (int)getPrimaryKey();
264     }
265 
266     public String toString() {
267         StringBuilder sb = new StringBuilder();
268 
269         sb.append("{licenseId=");
270         sb.append(getLicenseId());
271         sb.append(", name=");
272         sb.append(getName());
273         sb.append(", url=");
274         sb.append(getUrl());
275         sb.append(", openSource=");
276         sb.append(getOpenSource());
277         sb.append(", active=");
278         sb.append(getActive());
279         sb.append(", recommended=");
280         sb.append(getRecommended());
281         sb.append("}");
282 
283         return sb.toString();
284     }
285 
286     public String toXmlString() {
287         StringBuilder sb = new StringBuilder();
288 
289         sb.append("<model><model-name>");
290         sb.append("com.liferay.portlet.softwarecatalog.model.SCLicense");
291         sb.append("</model-name>");
292 
293         sb.append(
294             "<column><column-name>licenseId</column-name><column-value><![CDATA[");
295         sb.append(getLicenseId());
296         sb.append("]]></column-value></column>");
297         sb.append(
298             "<column><column-name>name</column-name><column-value><![CDATA[");
299         sb.append(getName());
300         sb.append("]]></column-value></column>");
301         sb.append(
302             "<column><column-name>url</column-name><column-value><![CDATA[");
303         sb.append(getUrl());
304         sb.append("]]></column-value></column>");
305         sb.append(
306             "<column><column-name>openSource</column-name><column-value><![CDATA[");
307         sb.append(getOpenSource());
308         sb.append("]]></column-value></column>");
309         sb.append(
310             "<column><column-name>active</column-name><column-value><![CDATA[");
311         sb.append(getActive());
312         sb.append("]]></column-value></column>");
313         sb.append(
314             "<column><column-name>recommended</column-name><column-value><![CDATA[");
315         sb.append(getRecommended());
316         sb.append("]]></column-value></column>");
317 
318         sb.append("</model>");
319 
320         return sb.toString();
321     }
322 
323     private long _licenseId;
324     private String _name;
325     private String _url;
326     private boolean _openSource;
327     private boolean _active;
328     private boolean _recommended;
329 }