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