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