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