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.kernel.util.HtmlUtil;
28  import com.liferay.portal.model.impl.BaseModelImpl;
29  import com.liferay.portal.util.PropsUtil;
30  
31  import com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion;
32  import com.liferay.portlet.softwarecatalog.model.SCFrameworkVersionSoap;
33  
34  import java.io.Serializable;
35  
36  import java.lang.reflect.Proxy;
37  
38  import java.sql.Types;
39  
40  import java.util.ArrayList;
41  import java.util.Date;
42  import java.util.List;
43  
44  /**
45   * <a href="SCFrameworkVersionModelImpl.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 class is a model that represents the <code>SCFrameworkVersion</code> table
54   * in the database.
55   * </p>
56   *
57   * @author Brian Wing Shun Chan
58   *
59   * @see com.liferay.portlet.softwarecatalog.service.model.SCFrameworkVersion
60   * @see com.liferay.portlet.softwarecatalog.service.model.SCFrameworkVersionModel
61   * @see com.liferay.portlet.softwarecatalog.service.model.impl.SCFrameworkVersionImpl
62   *
63   */
64  public class SCFrameworkVersionModelImpl extends BaseModelImpl {
65      public static final String TABLE_NAME = "SCFrameworkVersion";
66      public static final Object[][] TABLE_COLUMNS = {
67              { "frameworkVersionId", new Integer(Types.BIGINT) },
68              
69  
70              { "groupId", new Integer(Types.BIGINT) },
71              
72  
73              { "companyId", new Integer(Types.BIGINT) },
74              
75  
76              { "userId", new Integer(Types.BIGINT) },
77              
78  
79              { "userName", new Integer(Types.VARCHAR) },
80              
81  
82              { "createDate", new Integer(Types.TIMESTAMP) },
83              
84  
85              { "modifiedDate", new Integer(Types.TIMESTAMP) },
86              
87  
88              { "name", new Integer(Types.VARCHAR) },
89              
90  
91              { "url", new Integer(Types.VARCHAR) },
92              
93  
94              { "active_", new Integer(Types.BOOLEAN) },
95              
96  
97              { "priority", new Integer(Types.INTEGER) }
98          };
99      public static final String TABLE_SQL_CREATE = "create table SCFrameworkVersion (frameworkVersionId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,name VARCHAR(75) null,url STRING null,active_ BOOLEAN,priority INTEGER)";
100     public static final String TABLE_SQL_DROP = "drop table SCFrameworkVersion";
101     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
102                 "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion"),
103             true);
104 
105     public static SCFrameworkVersion toModel(SCFrameworkVersionSoap soapModel) {
106         SCFrameworkVersion model = new SCFrameworkVersionImpl();
107 
108         model.setFrameworkVersionId(soapModel.getFrameworkVersionId());
109         model.setGroupId(soapModel.getGroupId());
110         model.setCompanyId(soapModel.getCompanyId());
111         model.setUserId(soapModel.getUserId());
112         model.setUserName(soapModel.getUserName());
113         model.setCreateDate(soapModel.getCreateDate());
114         model.setModifiedDate(soapModel.getModifiedDate());
115         model.setName(soapModel.getName());
116         model.setUrl(soapModel.getUrl());
117         model.setActive(soapModel.getActive());
118         model.setPriority(soapModel.getPriority());
119 
120         return model;
121     }
122 
123     public static List<SCFrameworkVersion> toModels(
124         SCFrameworkVersionSoap[] soapModels) {
125         List<SCFrameworkVersion> models = new ArrayList<SCFrameworkVersion>(soapModels.length);
126 
127         for (SCFrameworkVersionSoap soapModel : soapModels) {
128             models.add(toModel(soapModel));
129         }
130 
131         return models;
132     }
133 
134     public static final boolean CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS = GetterUtil.getBoolean(PropsUtil.get(
135                 "value.object.finder.cache.enabled.SCFrameworkVersi_SCProductVers"),
136             true);
137     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
138                 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion"));
139 
140     public SCFrameworkVersionModelImpl() {
141     }
142 
143     public long getPrimaryKey() {
144         return _frameworkVersionId;
145     }
146 
147     public void setPrimaryKey(long pk) {
148         setFrameworkVersionId(pk);
149     }
150 
151     public Serializable getPrimaryKeyObj() {
152         return new Long(_frameworkVersionId);
153     }
154 
155     public long getFrameworkVersionId() {
156         return _frameworkVersionId;
157     }
158 
159     public void setFrameworkVersionId(long frameworkVersionId) {
160         if (frameworkVersionId != _frameworkVersionId) {
161             _frameworkVersionId = frameworkVersionId;
162         }
163     }
164 
165     public long getGroupId() {
166         return _groupId;
167     }
168 
169     public void setGroupId(long groupId) {
170         if (groupId != _groupId) {
171             _groupId = groupId;
172         }
173     }
174 
175     public long getCompanyId() {
176         return _companyId;
177     }
178 
179     public void setCompanyId(long companyId) {
180         if (companyId != _companyId) {
181             _companyId = companyId;
182         }
183     }
184 
185     public long getUserId() {
186         return _userId;
187     }
188 
189     public void setUserId(long userId) {
190         if (userId != _userId) {
191             _userId = userId;
192         }
193     }
194 
195     public String getUserName() {
196         return GetterUtil.getString(_userName);
197     }
198 
199     public void setUserName(String userName) {
200         if (((userName == null) && (_userName != null)) ||
201                 ((userName != null) && (_userName == null)) ||
202                 ((userName != null) && (_userName != null) &&
203                 !userName.equals(_userName))) {
204             _userName = userName;
205         }
206     }
207 
208     public Date getCreateDate() {
209         return _createDate;
210     }
211 
212     public void setCreateDate(Date createDate) {
213         if (((createDate == null) && (_createDate != null)) ||
214                 ((createDate != null) && (_createDate == null)) ||
215                 ((createDate != null) && (_createDate != null) &&
216                 !createDate.equals(_createDate))) {
217             _createDate = createDate;
218         }
219     }
220 
221     public Date getModifiedDate() {
222         return _modifiedDate;
223     }
224 
225     public void setModifiedDate(Date modifiedDate) {
226         if (((modifiedDate == null) && (_modifiedDate != null)) ||
227                 ((modifiedDate != null) && (_modifiedDate == null)) ||
228                 ((modifiedDate != null) && (_modifiedDate != null) &&
229                 !modifiedDate.equals(_modifiedDate))) {
230             _modifiedDate = modifiedDate;
231         }
232     }
233 
234     public String getName() {
235         return GetterUtil.getString(_name);
236     }
237 
238     public void setName(String name) {
239         if (((name == null) && (_name != null)) ||
240                 ((name != null) && (_name == null)) ||
241                 ((name != null) && (_name != null) && !name.equals(_name))) {
242             _name = name;
243         }
244     }
245 
246     public String getUrl() {
247         return GetterUtil.getString(_url);
248     }
249 
250     public void setUrl(String url) {
251         if (((url == null) && (_url != null)) ||
252                 ((url != null) && (_url == null)) ||
253                 ((url != null) && (_url != null) && !url.equals(_url))) {
254             _url = url;
255         }
256     }
257 
258     public boolean getActive() {
259         return _active;
260     }
261 
262     public boolean isActive() {
263         return _active;
264     }
265 
266     public void setActive(boolean active) {
267         if (active != _active) {
268             _active = active;
269         }
270     }
271 
272     public int getPriority() {
273         return _priority;
274     }
275 
276     public void setPriority(int priority) {
277         if (priority != _priority) {
278             _priority = priority;
279         }
280     }
281 
282     public SCFrameworkVersion toEscapedModel() {
283         if (isEscapedModel()) {
284             return (SCFrameworkVersion)this;
285         }
286         else {
287             SCFrameworkVersion model = new SCFrameworkVersionImpl();
288 
289             model.setEscapedModel(true);
290 
291             model.setFrameworkVersionId(getFrameworkVersionId());
292             model.setGroupId(getGroupId());
293             model.setCompanyId(getCompanyId());
294             model.setUserId(getUserId());
295             model.setUserName(HtmlUtil.escape(getUserName()));
296             model.setCreateDate(getCreateDate());
297             model.setModifiedDate(getModifiedDate());
298             model.setName(HtmlUtil.escape(getName()));
299             model.setUrl(HtmlUtil.escape(getUrl()));
300             model.setActive(getActive());
301             model.setPriority(getPriority());
302 
303             model = (SCFrameworkVersion)Proxy.newProxyInstance(SCFrameworkVersion.class.getClassLoader(),
304                     new Class[] { SCFrameworkVersion.class },
305                     new ReadOnlyBeanHandler(model));
306 
307             return model;
308         }
309     }
310 
311     public Object clone() {
312         SCFrameworkVersionImpl clone = new SCFrameworkVersionImpl();
313 
314         clone.setFrameworkVersionId(getFrameworkVersionId());
315         clone.setGroupId(getGroupId());
316         clone.setCompanyId(getCompanyId());
317         clone.setUserId(getUserId());
318         clone.setUserName(getUserName());
319         clone.setCreateDate(getCreateDate());
320         clone.setModifiedDate(getModifiedDate());
321         clone.setName(getName());
322         clone.setUrl(getUrl());
323         clone.setActive(getActive());
324         clone.setPriority(getPriority());
325 
326         return clone;
327     }
328 
329     public int compareTo(Object obj) {
330         if (obj == null) {
331             return -1;
332         }
333 
334         SCFrameworkVersionImpl scFrameworkVersion = (SCFrameworkVersionImpl)obj;
335 
336         int value = 0;
337 
338         if (getPriority() < scFrameworkVersion.getPriority()) {
339             value = -1;
340         }
341         else if (getPriority() > scFrameworkVersion.getPriority()) {
342             value = 1;
343         }
344         else {
345             value = 0;
346         }
347 
348         if (value != 0) {
349             return value;
350         }
351 
352         value = getName().compareTo(scFrameworkVersion.getName());
353 
354         if (value != 0) {
355             return value;
356         }
357 
358         return 0;
359     }
360 
361     public boolean equals(Object obj) {
362         if (obj == null) {
363             return false;
364         }
365 
366         SCFrameworkVersionImpl scFrameworkVersion = null;
367 
368         try {
369             scFrameworkVersion = (SCFrameworkVersionImpl)obj;
370         }
371         catch (ClassCastException cce) {
372             return false;
373         }
374 
375         long pk = scFrameworkVersion.getPrimaryKey();
376 
377         if (getPrimaryKey() == pk) {
378             return true;
379         }
380         else {
381             return false;
382         }
383     }
384 
385     public int hashCode() {
386         return (int)getPrimaryKey();
387     }
388 
389     private long _frameworkVersionId;
390     private long _groupId;
391     private long _companyId;
392     private long _userId;
393     private String _userName;
394     private Date _createDate;
395     private Date _modifiedDate;
396     private String _name;
397     private String _url;
398     private boolean _active;
399     private int _priority;
400 }