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