1
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
58 public class SCProductVersionModelImpl extends BaseModelImpl {
59 public static String TABLE_NAME = "SCProductVersion";
60 public static Object[][] TABLE_COLUMNS = {
61 { "productVersionId", 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 { "productEntryId", new Integer(Types.BIGINT) },
68 { "version", new Integer(Types.VARCHAR) },
69 { "changeLog", new Integer(Types.VARCHAR) },
70 { "downloadPageURL", new Integer(Types.VARCHAR) },
71 { "directDownloadURL", new Integer(Types.VARCHAR) },
72 { "repoStoreArtifact", new Integer(Types.BOOLEAN) }
73 };
74 public static String TABLE_SQL_CREATE = "create table SCProductVersion (productVersionId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,productEntryId LONG,version VARCHAR(75) null,changeLog STRING null,downloadPageURL STRING null,directDownloadURL STRING null,repoStoreArtifact BOOLEAN)";
75 public static String TABLE_SQL_DROP = "drop table SCProductVersion";
76 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
77 "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductVersion"),
78 XSS_ALLOW);
79 public static boolean XSS_ALLOW_USERNAME = GetterUtil.getBoolean(PropsUtil.get(
80 "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductVersion.userName"),
81 XSS_ALLOW_BY_MODEL);
82 public static boolean XSS_ALLOW_VERSION = GetterUtil.getBoolean(PropsUtil.get(
83 "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductVersion.version"),
84 XSS_ALLOW_BY_MODEL);
85 public static boolean XSS_ALLOW_CHANGELOG = GetterUtil.getBoolean(PropsUtil.get(
86 "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductVersion.changeLog"),
87 XSS_ALLOW_BY_MODEL);
88 public static boolean XSS_ALLOW_DOWNLOADPAGEURL = GetterUtil.getBoolean(PropsUtil.get(
89 "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductVersion.downloadPageURL"),
90 XSS_ALLOW_BY_MODEL);
91 public static boolean XSS_ALLOW_DIRECTDOWNLOADURL = GetterUtil.getBoolean(PropsUtil.get(
92 "xss.allow.com.liferay.portlet.softwarecatalog.model.SCProductVersion.directDownloadURL"),
93 XSS_ALLOW_BY_MODEL);
94 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
95 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductVersionModel"));
96
97 public SCProductVersionModelImpl() {
98 }
99
100 public long getPrimaryKey() {
101 return _productVersionId;
102 }
103
104 public void setPrimaryKey(long pk) {
105 setProductVersionId(pk);
106 }
107
108 public Serializable getPrimaryKeyObj() {
109 return new Long(_productVersionId);
110 }
111
112 public long getProductVersionId() {
113 return _productVersionId;
114 }
115
116 public void setProductVersionId(long productVersionId) {
117 if (productVersionId != _productVersionId) {
118 _productVersionId = productVersionId;
119 }
120 }
121
122 public long getCompanyId() {
123 return _companyId;
124 }
125
126 public void setCompanyId(long companyId) {
127 if (companyId != _companyId) {
128 _companyId = companyId;
129 }
130 }
131
132 public long getUserId() {
133 return _userId;
134 }
135
136 public void setUserId(long userId) {
137 if (userId != _userId) {
138 _userId = userId;
139 }
140 }
141
142 public String getUserName() {
143 return GetterUtil.getString(_userName);
144 }
145
146 public void setUserName(String userName) {
147 if (((userName == null) && (_userName != null)) ||
148 ((userName != null) && (_userName == null)) ||
149 ((userName != null) && (_userName != null) &&
150 !userName.equals(_userName))) {
151 if (!XSS_ALLOW_USERNAME) {
152 userName = XSSUtil.strip(userName);
153 }
154
155 _userName = userName;
156 }
157 }
158
159 public Date getCreateDate() {
160 return _createDate;
161 }
162
163 public void setCreateDate(Date createDate) {
164 if (((createDate == null) && (_createDate != null)) ||
165 ((createDate != null) && (_createDate == null)) ||
166 ((createDate != null) && (_createDate != null) &&
167 !createDate.equals(_createDate))) {
168 _createDate = createDate;
169 }
170 }
171
172 public Date getModifiedDate() {
173 return _modifiedDate;
174 }
175
176 public void setModifiedDate(Date modifiedDate) {
177 if (((modifiedDate == null) && (_modifiedDate != null)) ||
178 ((modifiedDate != null) && (_modifiedDate == null)) ||
179 ((modifiedDate != null) && (_modifiedDate != null) &&
180 !modifiedDate.equals(_modifiedDate))) {
181 _modifiedDate = modifiedDate;
182 }
183 }
184
185 public long getProductEntryId() {
186 return _productEntryId;
187 }
188
189 public void setProductEntryId(long productEntryId) {
190 if (productEntryId != _productEntryId) {
191 _productEntryId = productEntryId;
192 }
193 }
194
195 public String getVersion() {
196 return GetterUtil.getString(_version);
197 }
198
199 public void setVersion(String version) {
200 if (((version == null) && (_version != null)) ||
201 ((version != null) && (_version == null)) ||
202 ((version != null) && (_version != null) &&
203 !version.equals(_version))) {
204 if (!XSS_ALLOW_VERSION) {
205 version = XSSUtil.strip(version);
206 }
207
208 _version = version;
209 }
210 }
211
212 public String getChangeLog() {
213 return GetterUtil.getString(_changeLog);
214 }
215
216 public void setChangeLog(String changeLog) {
217 if (((changeLog == null) && (_changeLog != null)) ||
218 ((changeLog != null) && (_changeLog == null)) ||
219 ((changeLog != null) && (_changeLog != null) &&
220 !changeLog.equals(_changeLog))) {
221 if (!XSS_ALLOW_CHANGELOG) {
222 changeLog = XSSUtil.strip(changeLog);
223 }
224
225 _changeLog = changeLog;
226 }
227 }
228
229 public String getDownloadPageURL() {
230 return GetterUtil.getString(_downloadPageURL);
231 }
232
233 public void setDownloadPageURL(String downloadPageURL) {
234 if (((downloadPageURL == null) && (_downloadPageURL != null)) ||
235 ((downloadPageURL != null) && (_downloadPageURL == null)) ||
236 ((downloadPageURL != null) && (_downloadPageURL != null) &&
237 !downloadPageURL.equals(_downloadPageURL))) {
238 if (!XSS_ALLOW_DOWNLOADPAGEURL) {
239 downloadPageURL = XSSUtil.strip(downloadPageURL);
240 }
241
242 _downloadPageURL = downloadPageURL;
243 }
244 }
245
246 public String getDirectDownloadURL() {
247 return GetterUtil.getString(_directDownloadURL);
248 }
249
250 public void setDirectDownloadURL(String directDownloadURL) {
251 if (((directDownloadURL == null) && (_directDownloadURL != null)) ||
252 ((directDownloadURL != null) && (_directDownloadURL == null)) ||
253 ((directDownloadURL != null) && (_directDownloadURL != null) &&
254 !directDownloadURL.equals(_directDownloadURL))) {
255 if (!XSS_ALLOW_DIRECTDOWNLOADURL) {
256 directDownloadURL = XSSUtil.strip(directDownloadURL);
257 }
258
259 _directDownloadURL = directDownloadURL;
260 }
261 }
262
263 public boolean getRepoStoreArtifact() {
264 return _repoStoreArtifact;
265 }
266
267 public boolean isRepoStoreArtifact() {
268 return _repoStoreArtifact;
269 }
270
271 public void setRepoStoreArtifact(boolean repoStoreArtifact) {
272 if (repoStoreArtifact != _repoStoreArtifact) {
273 _repoStoreArtifact = repoStoreArtifact;
274 }
275 }
276
277 public Object clone() {
278 SCProductVersionImpl clone = new SCProductVersionImpl();
279 clone.setProductVersionId(getProductVersionId());
280 clone.setCompanyId(getCompanyId());
281 clone.setUserId(getUserId());
282 clone.setUserName(getUserName());
283 clone.setCreateDate(getCreateDate());
284 clone.setModifiedDate(getModifiedDate());
285 clone.setProductEntryId(getProductEntryId());
286 clone.setVersion(getVersion());
287 clone.setChangeLog(getChangeLog());
288 clone.setDownloadPageURL(getDownloadPageURL());
289 clone.setDirectDownloadURL(getDirectDownloadURL());
290 clone.setRepoStoreArtifact(getRepoStoreArtifact());
291
292 return clone;
293 }
294
295 public int compareTo(Object obj) {
296 if (obj == null) {
297 return -1;
298 }
299
300 SCProductVersionImpl scProductVersion = (SCProductVersionImpl)obj;
301 int value = 0;
302 value = DateUtil.compareTo(getCreateDate(),
303 scProductVersion.getCreateDate());
304 value = value * -1;
305
306 if (value != 0) {
307 return value;
308 }
309
310 return 0;
311 }
312
313 public boolean equals(Object obj) {
314 if (obj == null) {
315 return false;
316 }
317
318 SCProductVersionImpl scProductVersion = null;
319
320 try {
321 scProductVersion = (SCProductVersionImpl)obj;
322 }
323 catch (ClassCastException cce) {
324 return false;
325 }
326
327 long pk = scProductVersion.getPrimaryKey();
328
329 if (getPrimaryKey() == pk) {
330 return true;
331 }
332 else {
333 return false;
334 }
335 }
336
337 public int hashCode() {
338 return (int)getPrimaryKey();
339 }
340
341 private long _productVersionId;
342 private long _companyId;
343 private long _userId;
344 private String _userName;
345 private Date _createDate;
346 private Date _modifiedDate;
347 private long _productEntryId;
348 private String _version;
349 private String _changeLog;
350 private String _downloadPageURL;
351 private String _directDownloadURL;
352 private boolean _repoStoreArtifact;
353 }