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