1   /**
2    * Copyright (c) 2000-2008 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.model.impl.BaseModelImpl;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.portlet.softwarecatalog.model.SCLicense;
31  
32  import com.liferay.util.Html;
33  
34  import java.io.Serializable;
35  
36  import java.lang.reflect.Proxy;
37  
38  import java.sql.Types;
39  
40  /**
41   * <a href="SCLicenseModelImpl.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 class is a model that represents the <code>SCLicense</code> table
50   * in the database.
51   * </p>
52   *
53   * @author Brian Wing Shun Chan
54   *
55   * @see com.liferay.portlet.softwarecatalog.service.model.SCLicense
56   * @see com.liferay.portlet.softwarecatalog.service.model.SCLicenseModel
57   * @see com.liferay.portlet.softwarecatalog.service.model.impl.SCLicenseImpl
58   *
59   */
60  public class SCLicenseModelImpl extends BaseModelImpl {
61      public static final String TABLE_NAME = "SCLicense";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "licenseId", new Integer(Types.BIGINT) },
64              
65  
66              { "name", new Integer(Types.VARCHAR) },
67              
68  
69              { "url", new Integer(Types.VARCHAR) },
70              
71  
72              { "openSource", new Integer(Types.BOOLEAN) },
73              
74  
75              { "active_", new Integer(Types.BOOLEAN) },
76              
77  
78              { "recommended", new Integer(Types.BOOLEAN) }
79          };
80      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)";
81      public static final String TABLE_SQL_DROP = "drop table SCLicense";
82      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
83                  "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCLicense"),
84              true);
85      public static final boolean CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES = GetterUtil.getBoolean(PropsUtil.get(
86                  "value.object.finder.cache.enabled.SCLicenses_SCProductEntries"),
87              true);
88      public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
89                  "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCLicense"));
90  
91      public SCLicenseModelImpl() {
92      }
93  
94      public long getPrimaryKey() {
95          return _licenseId;
96      }
97  
98      public void setPrimaryKey(long pk) {
99          setLicenseId(pk);
100     }
101 
102     public Serializable getPrimaryKeyObj() {
103         return new Long(_licenseId);
104     }
105 
106     public long getLicenseId() {
107         return _licenseId;
108     }
109 
110     public void setLicenseId(long licenseId) {
111         if (licenseId != _licenseId) {
112             _licenseId = licenseId;
113         }
114     }
115 
116     public String getName() {
117         return GetterUtil.getString(_name);
118     }
119 
120     public void setName(String name) {
121         if (((name == null) && (_name != null)) ||
122                 ((name != null) && (_name == null)) ||
123                 ((name != null) && (_name != null) && !name.equals(_name))) {
124             _name = name;
125         }
126     }
127 
128     public String getUrl() {
129         return GetterUtil.getString(_url);
130     }
131 
132     public void setUrl(String url) {
133         if (((url == null) && (_url != null)) ||
134                 ((url != null) && (_url == null)) ||
135                 ((url != null) && (_url != null) && !url.equals(_url))) {
136             _url = url;
137         }
138     }
139 
140     public boolean getOpenSource() {
141         return _openSource;
142     }
143 
144     public boolean isOpenSource() {
145         return _openSource;
146     }
147 
148     public void setOpenSource(boolean openSource) {
149         if (openSource != _openSource) {
150             _openSource = openSource;
151         }
152     }
153 
154     public boolean getActive() {
155         return _active;
156     }
157 
158     public boolean isActive() {
159         return _active;
160     }
161 
162     public void setActive(boolean active) {
163         if (active != _active) {
164             _active = active;
165         }
166     }
167 
168     public boolean getRecommended() {
169         return _recommended;
170     }
171 
172     public boolean isRecommended() {
173         return _recommended;
174     }
175 
176     public void setRecommended(boolean recommended) {
177         if (recommended != _recommended) {
178             _recommended = recommended;
179         }
180     }
181 
182     public SCLicense toEscapedModel() {
183         if (isEscapedModel()) {
184             return (SCLicense)this;
185         }
186         else {
187             SCLicense model = new SCLicenseImpl();
188 
189             model.setEscapedModel(true);
190 
191             model.setLicenseId(getLicenseId());
192             model.setName(Html.escape(getName()));
193             model.setUrl(Html.escape(getUrl()));
194             model.setOpenSource(getOpenSource());
195             model.setActive(getActive());
196             model.setRecommended(getRecommended());
197 
198             model = (SCLicense)Proxy.newProxyInstance(SCLicense.class.getClassLoader(),
199                     new Class[] { SCLicense.class },
200                     new ReadOnlyBeanHandler(model));
201 
202             return model;
203         }
204     }
205 
206     public Object clone() {
207         SCLicenseImpl clone = new SCLicenseImpl();
208 
209         clone.setLicenseId(getLicenseId());
210         clone.setName(getName());
211         clone.setUrl(getUrl());
212         clone.setOpenSource(getOpenSource());
213         clone.setActive(getActive());
214         clone.setRecommended(getRecommended());
215 
216         return clone;
217     }
218 
219     public int compareTo(Object obj) {
220         if (obj == null) {
221             return -1;
222         }
223 
224         SCLicenseImpl scLicense = (SCLicenseImpl)obj;
225 
226         int value = 0;
227 
228         value = getName().compareTo(scLicense.getName());
229 
230         if (value != 0) {
231             return value;
232         }
233 
234         return 0;
235     }
236 
237     public boolean equals(Object obj) {
238         if (obj == null) {
239             return false;
240         }
241 
242         SCLicenseImpl scLicense = null;
243 
244         try {
245             scLicense = (SCLicenseImpl)obj;
246         }
247         catch (ClassCastException cce) {
248             return false;
249         }
250 
251         long pk = scLicense.getPrimaryKey();
252 
253         if (getPrimaryKey() == pk) {
254             return true;
255         }
256         else {
257             return false;
258         }
259     }
260 
261     public int hashCode() {
262         return (int)getPrimaryKey();
263     }
264 
265     private long _licenseId;
266     private String _name;
267     private String _url;
268     private boolean _openSource;
269     private boolean _active;
270     private boolean _recommended;
271 }