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.DateUtil;
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.util.XSSUtil;
31  
32  import java.io.Serializable;
33  
34  import java.sql.Types;
35  
36  import java.util.Date;
37  
38  /**
39   * <a href="SCProductEntryModelImpl.java.html"><b><i>View Source</i></b></a>
40   *
41   * <p>
42   * ServiceBuilder generated this class. Modifications in this class will be overwritten
43   * the next time is generated.
44   * </p>
45   *
46   * <p>
47   * This class is a model that represents the <code>SCProductEntry</code> table in
48   * the database.
49   * </p>
50   *
51   * @author Brian Wing Shun Chan
52   *
53   * @see com.liferay.portlet.softwarecatalog.service.model.SCProductEntry
54   * @see com.liferay.portlet.softwarecatalog.service.model.SCProductEntryModel
55   * @see com.liferay.portlet.softwarecatalog.service.model.impl.SCProductEntryImpl
56   *
57   */
58  public class SCProductEntryModelImpl extends BaseModelImpl {
59      public static String TABLE_NAME = "SCProductEntry";
60      public static Object[][] TABLE_COLUMNS = {
61              { "productEntryId", new Integer(Types.BIGINT) },
62              { "groupId", new Integer(Types.BIGINT) },
63              { "companyId", new Integer(Types.BIGINT) },
64              { "userId", new Integer(Types.BIGINT) },
65              { "userName", new Integer(Types.VARCHAR) },
66              { "createDate", new Integer(Types.TIMESTAMP) },
67              { "modifiedDate", new Integer(Types.TIMESTAMP) },
68              { "name", new Integer(Types.VARCHAR) },
69              { "type_", new Integer(Types.VARCHAR) },
70              { "tags", new Integer(Types.VARCHAR) },
71              { "shortDescription", new Integer(Types.VARCHAR) },
72              { "longDescription", new Integer(Types.VARCHAR) },
73              { "pageURL", new Integer(Types.VARCHAR) },
74              { "author", new Integer(Types.VARCHAR) },
75              { "repoGroupId", new Integer(Types.VARCHAR) },
76              { "repoArtifactId", new Integer(Types.VARCHAR) }
77          };
78      public static String TABLE_SQL_CREATE = "create table SCProductEntry (productEntryId 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,type_ VARCHAR(75) null,tags VARCHAR(300) null,shortDescription STRING null,longDescription STRING null,pageURL STRING null,author VARCHAR(75) null,repoGroupId VARCHAR(75) null,repoArtifactId VARCHAR(75) null)";
79      public static String TABLE_SQL_DROP = "drop table SCProductEntry";
80      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
81                  "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductEntry"),
82              XSS_ALLOW);
83      public static boolean XSS_ALLOW_USERNAME = GetterUtil.getBoolean(PropsUtil.get(
84                  "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductEntry.userName"),
85              XSS_ALLOW_BY_MODEL);
86      public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
87                  "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductEntry.name"),
88              XSS_ALLOW_BY_MODEL);
89      public static boolean XSS_ALLOW_TYPE = GetterUtil.getBoolean(PropsUtil.get(
90                  "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductEntry.type"),
91              XSS_ALLOW_BY_MODEL);
92      public static boolean XSS_ALLOW_TAGS = GetterUtil.getBoolean(PropsUtil.get(
93                  "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductEntry.tags"),
94              XSS_ALLOW_BY_MODEL);
95      public static boolean XSS_ALLOW_SHORTDESCRIPTION = GetterUtil.getBoolean(PropsUtil.get(
96                  "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductEntry.shortDescription"),
97              XSS_ALLOW_BY_MODEL);
98      public static boolean XSS_ALLOW_LONGDESCRIPTION = GetterUtil.getBoolean(PropsUtil.get(
99                  "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductEntry.longDescription"),
100             XSS_ALLOW_BY_MODEL);
101     public static boolean XSS_ALLOW_PAGEURL = GetterUtil.getBoolean(PropsUtil.get(
102                 "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductEntry.pageURL"),
103             XSS_ALLOW_BY_MODEL);
104     public static boolean XSS_ALLOW_AUTHOR = GetterUtil.getBoolean(PropsUtil.get(
105                 "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductEntry.author"),
106             XSS_ALLOW_BY_MODEL);
107     public static boolean XSS_ALLOW_REPOGROUPID = GetterUtil.getBoolean(PropsUtil.get(
108                 "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductEntry.repoGroupId"),
109             XSS_ALLOW_BY_MODEL);
110     public static boolean XSS_ALLOW_REPOARTIFACTID = GetterUtil.getBoolean(PropsUtil.get(
111                 "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductEntry.repoArtifactId"),
112             XSS_ALLOW_BY_MODEL);
113     public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
114                 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductEntryModel"));
115 
116     public SCProductEntryModelImpl() {
117     }
118 
119     public long getPrimaryKey() {
120         return _productEntryId;
121     }
122 
123     public void setPrimaryKey(long pk) {
124         setProductEntryId(pk);
125     }
126 
127     public Serializable getPrimaryKeyObj() {
128         return new Long(_productEntryId);
129     }
130 
131     public long getProductEntryId() {
132         return _productEntryId;
133     }
134 
135     public void setProductEntryId(long productEntryId) {
136         if (productEntryId != _productEntryId) {
137             _productEntryId = productEntryId;
138         }
139     }
140 
141     public long getGroupId() {
142         return _groupId;
143     }
144 
145     public void setGroupId(long groupId) {
146         if (groupId != _groupId) {
147             _groupId = groupId;
148         }
149     }
150 
151     public long getCompanyId() {
152         return _companyId;
153     }
154 
155     public void setCompanyId(long companyId) {
156         if (companyId != _companyId) {
157             _companyId = companyId;
158         }
159     }
160 
161     public long getUserId() {
162         return _userId;
163     }
164 
165     public void setUserId(long userId) {
166         if (userId != _userId) {
167             _userId = userId;
168         }
169     }
170 
171     public String getUserName() {
172         return GetterUtil.getString(_userName);
173     }
174 
175     public void setUserName(String userName) {
176         if (((userName == null) && (_userName != null)) ||
177                 ((userName != null) && (_userName == null)) ||
178                 ((userName != null) && (_userName != null) &&
179                 !userName.equals(_userName))) {
180             if (!XSS_ALLOW_USERNAME) {
181                 userName = XSSUtil.strip(userName);
182             }
183 
184             _userName = userName;
185         }
186     }
187 
188     public Date getCreateDate() {
189         return _createDate;
190     }
191 
192     public void setCreateDate(Date createDate) {
193         if (((createDate == null) && (_createDate != null)) ||
194                 ((createDate != null) && (_createDate == null)) ||
195                 ((createDate != null) && (_createDate != null) &&
196                 !createDate.equals(_createDate))) {
197             _createDate = createDate;
198         }
199     }
200 
201     public Date getModifiedDate() {
202         return _modifiedDate;
203     }
204 
205     public void setModifiedDate(Date modifiedDate) {
206         if (((modifiedDate == null) && (_modifiedDate != null)) ||
207                 ((modifiedDate != null) && (_modifiedDate == null)) ||
208                 ((modifiedDate != null) && (_modifiedDate != null) &&
209                 !modifiedDate.equals(_modifiedDate))) {
210             _modifiedDate = modifiedDate;
211         }
212     }
213 
214     public String getName() {
215         return GetterUtil.getString(_name);
216     }
217 
218     public void setName(String name) {
219         if (((name == null) && (_name != null)) ||
220                 ((name != null) && (_name == null)) ||
221                 ((name != null) && (_name != null) && !name.equals(_name))) {
222             if (!XSS_ALLOW_NAME) {
223                 name = XSSUtil.strip(name);
224             }
225 
226             _name = name;
227         }
228     }
229 
230     public String getType() {
231         return GetterUtil.getString(_type);
232     }
233 
234     public void setType(String type) {
235         if (((type == null) && (_type != null)) ||
236                 ((type != null) && (_type == null)) ||
237                 ((type != null) && (_type != null) && !type.equals(_type))) {
238             if (!XSS_ALLOW_TYPE) {
239                 type = XSSUtil.strip(type);
240             }
241 
242             _type = type;
243         }
244     }
245 
246     public String getTags() {
247         return GetterUtil.getString(_tags);
248     }
249 
250     public void setTags(String tags) {
251         if (((tags == null) && (_tags != null)) ||
252                 ((tags != null) && (_tags == null)) ||
253                 ((tags != null) && (_tags != null) && !tags.equals(_tags))) {
254             if (!XSS_ALLOW_TAGS) {
255                 tags = XSSUtil.strip(tags);
256             }
257 
258             _tags = tags;
259         }
260     }
261 
262     public String getShortDescription() {
263         return GetterUtil.getString(_shortDescription);
264     }
265 
266     public void setShortDescription(String shortDescription) {
267         if (((shortDescription == null) && (_shortDescription != null)) ||
268                 ((shortDescription != null) && (_shortDescription == null)) ||
269                 ((shortDescription != null) && (_shortDescription != null) &&
270                 !shortDescription.equals(_shortDescription))) {
271             if (!XSS_ALLOW_SHORTDESCRIPTION) {
272                 shortDescription = XSSUtil.strip(shortDescription);
273             }
274 
275             _shortDescription = shortDescription;
276         }
277     }
278 
279     public String getLongDescription() {
280         return GetterUtil.getString(_longDescription);
281     }
282 
283     public void setLongDescription(String longDescription) {
284         if (((longDescription == null) && (_longDescription != null)) ||
285                 ((longDescription != null) && (_longDescription == null)) ||
286                 ((longDescription != null) && (_longDescription != null) &&
287                 !longDescription.equals(_longDescription))) {
288             if (!XSS_ALLOW_LONGDESCRIPTION) {
289                 longDescription = XSSUtil.strip(longDescription);
290             }
291 
292             _longDescription = longDescription;
293         }
294     }
295 
296     public String getPageURL() {
297         return GetterUtil.getString(_pageURL);
298     }
299 
300     public void setPageURL(String pageURL) {
301         if (((pageURL == null) && (_pageURL != null)) ||
302                 ((pageURL != null) && (_pageURL == null)) ||
303                 ((pageURL != null) && (_pageURL != null) &&
304                 !pageURL.equals(_pageURL))) {
305             if (!XSS_ALLOW_PAGEURL) {
306                 pageURL = XSSUtil.strip(pageURL);
307             }
308 
309             _pageURL = pageURL;
310         }
311     }
312 
313     public String getAuthor() {
314         return GetterUtil.getString(_author);
315     }
316 
317     public void setAuthor(String author) {
318         if (((author == null) && (_author != null)) ||
319                 ((author != null) && (_author == null)) ||
320                 ((author != null) && (_author != null) &&
321                 !author.equals(_author))) {
322             if (!XSS_ALLOW_AUTHOR) {
323                 author = XSSUtil.strip(author);
324             }
325 
326             _author = author;
327         }
328     }
329 
330     public String getRepoGroupId() {
331         return GetterUtil.getString(_repoGroupId);
332     }
333 
334     public void setRepoGroupId(String repoGroupId) {
335         if (((repoGroupId == null) && (_repoGroupId != null)) ||
336                 ((repoGroupId != null) && (_repoGroupId == null)) ||
337                 ((repoGroupId != null) && (_repoGroupId != null) &&
338                 !repoGroupId.equals(_repoGroupId))) {
339             if (!XSS_ALLOW_REPOGROUPID) {
340                 repoGroupId = XSSUtil.strip(repoGroupId);
341             }
342 
343             _repoGroupId = repoGroupId;
344         }
345     }
346 
347     public String getRepoArtifactId() {
348         return GetterUtil.getString(_repoArtifactId);
349     }
350 
351     public void setRepoArtifactId(String repoArtifactId) {
352         if (((repoArtifactId == null) && (_repoArtifactId != null)) ||
353                 ((repoArtifactId != null) && (_repoArtifactId == null)) ||
354                 ((repoArtifactId != null) && (_repoArtifactId != null) &&
355                 !repoArtifactId.equals(_repoArtifactId))) {
356             if (!XSS_ALLOW_REPOARTIFACTID) {
357                 repoArtifactId = XSSUtil.strip(repoArtifactId);
358             }
359 
360             _repoArtifactId = repoArtifactId;
361         }
362     }
363 
364     public Object clone() {
365         SCProductEntryImpl clone = new SCProductEntryImpl();
366         clone.setProductEntryId(getProductEntryId());
367         clone.setGroupId(getGroupId());
368         clone.setCompanyId(getCompanyId());
369         clone.setUserId(getUserId());
370         clone.setUserName(getUserName());
371         clone.setCreateDate(getCreateDate());
372         clone.setModifiedDate(getModifiedDate());
373         clone.setName(getName());
374         clone.setType(getType());
375         clone.setTags(getTags());
376         clone.setShortDescription(getShortDescription());
377         clone.setLongDescription(getLongDescription());
378         clone.setPageURL(getPageURL());
379         clone.setAuthor(getAuthor());
380         clone.setRepoGroupId(getRepoGroupId());
381         clone.setRepoArtifactId(getRepoArtifactId());
382 
383         return clone;
384     }
385 
386     public int compareTo(Object obj) {
387         if (obj == null) {
388             return -1;
389         }
390 
391         SCProductEntryImpl scProductEntry = (SCProductEntryImpl)obj;
392         int value = 0;
393         value = DateUtil.compareTo(getModifiedDate(),
394                 scProductEntry.getModifiedDate());
395         value = value * -1;
396 
397         if (value != 0) {
398             return value;
399         }
400 
401         value = getName().compareTo(scProductEntry.getName());
402         value = value * -1;
403 
404         if (value != 0) {
405             return value;
406         }
407 
408         return 0;
409     }
410 
411     public boolean equals(Object obj) {
412         if (obj == null) {
413             return false;
414         }
415 
416         SCProductEntryImpl scProductEntry = null;
417 
418         try {
419             scProductEntry = (SCProductEntryImpl)obj;
420         }
421         catch (ClassCastException cce) {
422             return false;
423         }
424 
425         long pk = scProductEntry.getPrimaryKey();
426 
427         if (getPrimaryKey() == pk) {
428             return true;
429         }
430         else {
431             return false;
432         }
433     }
434 
435     public int hashCode() {
436         return (int)getPrimaryKey();
437     }
438 
439     private long _productEntryId;
440     private long _groupId;
441     private long _companyId;
442     private long _userId;
443     private String _userName;
444     private Date _createDate;
445     private Date _modifiedDate;
446     private String _name;
447     private String _type;
448     private String _tags;
449     private String _shortDescription;
450     private String _longDescription;
451     private String _pageURL;
452     private String _author;
453     private String _repoGroupId;
454     private String _repoArtifactId;
455 }