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.imagegallery.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="IGImageModelImpl.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>IGImage</code> table in the database.
47   * </p>
48   *
49   * @author Brian Wing Shun Chan
50   *
51   * @see com.liferay.portlet.imagegallery.service.model.IGImage
52   * @see com.liferay.portlet.imagegallery.service.model.IGImageModel
53   * @see com.liferay.portlet.imagegallery.service.model.impl.IGImageImpl
54   *
55   */
56  public class IGImageModelImpl extends BaseModelImpl {
57      public static String TABLE_NAME = "IGImage";
58      public static Object[][] TABLE_COLUMNS = {
59              { "imageId", new Integer(Types.BIGINT) },
60              { "companyId", new Integer(Types.BIGINT) },
61              { "userId", new Integer(Types.BIGINT) },
62              { "createDate", new Integer(Types.TIMESTAMP) },
63              { "modifiedDate", new Integer(Types.TIMESTAMP) },
64              { "folderId", new Integer(Types.BIGINT) },
65              { "description", new Integer(Types.VARCHAR) },
66              { "smallImageId", new Integer(Types.BIGINT) },
67              { "largeImageId", new Integer(Types.BIGINT) }
68          };
69      public static String TABLE_SQL_CREATE = "create table IGImage (imageId LONG not null primary key,companyId LONG,userId LONG,createDate DATE null,modifiedDate DATE null,folderId LONG,description STRING null,smallImageId LONG,largeImageId LONG)";
70      public static String TABLE_SQL_DROP = "drop table IGImage";
71      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
72                  "xss.allow.com.liferay.portlet.imagegallery.model.IGImage"),
73              XSS_ALLOW);
74      public static boolean XSS_ALLOW_DESCRIPTION = GetterUtil.getBoolean(PropsUtil.get(
75                  "xss.allow.com.liferay.portlet.imagegallery.model.IGImage.description"),
76              XSS_ALLOW_BY_MODEL);
77      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
78                  "lock.expiration.time.com.liferay.portlet.imagegallery.model.IGImageModel"));
79  
80      public IGImageModelImpl() {
81      }
82  
83      public long getPrimaryKey() {
84          return _imageId;
85      }
86  
87      public void setPrimaryKey(long pk) {
88          setImageId(pk);
89      }
90  
91      public Serializable getPrimaryKeyObj() {
92          return new Long(_imageId);
93      }
94  
95      public long getImageId() {
96          return _imageId;
97      }
98  
99      public void setImageId(long imageId) {
100         if (imageId != _imageId) {
101             _imageId = imageId;
102         }
103     }
104 
105     public long getCompanyId() {
106         return _companyId;
107     }
108 
109     public void setCompanyId(long companyId) {
110         if (companyId != _companyId) {
111             _companyId = companyId;
112         }
113     }
114 
115     public long getUserId() {
116         return _userId;
117     }
118 
119     public void setUserId(long userId) {
120         if (userId != _userId) {
121             _userId = userId;
122         }
123     }
124 
125     public Date getCreateDate() {
126         return _createDate;
127     }
128 
129     public void setCreateDate(Date createDate) {
130         if (((createDate == null) && (_createDate != null)) ||
131                 ((createDate != null) && (_createDate == null)) ||
132                 ((createDate != null) && (_createDate != null) &&
133                 !createDate.equals(_createDate))) {
134             _createDate = createDate;
135         }
136     }
137 
138     public Date getModifiedDate() {
139         return _modifiedDate;
140     }
141 
142     public void setModifiedDate(Date modifiedDate) {
143         if (((modifiedDate == null) && (_modifiedDate != null)) ||
144                 ((modifiedDate != null) && (_modifiedDate == null)) ||
145                 ((modifiedDate != null) && (_modifiedDate != null) &&
146                 !modifiedDate.equals(_modifiedDate))) {
147             _modifiedDate = modifiedDate;
148         }
149     }
150 
151     public long getFolderId() {
152         return _folderId;
153     }
154 
155     public void setFolderId(long folderId) {
156         if (folderId != _folderId) {
157             _folderId = folderId;
158         }
159     }
160 
161     public String getDescription() {
162         return GetterUtil.getString(_description);
163     }
164 
165     public void setDescription(String description) {
166         if (((description == null) && (_description != null)) ||
167                 ((description != null) && (_description == null)) ||
168                 ((description != null) && (_description != null) &&
169                 !description.equals(_description))) {
170             if (!XSS_ALLOW_DESCRIPTION) {
171                 description = XSSUtil.strip(description);
172             }
173 
174             _description = description;
175         }
176     }
177 
178     public long getSmallImageId() {
179         return _smallImageId;
180     }
181 
182     public void setSmallImageId(long smallImageId) {
183         if (smallImageId != _smallImageId) {
184             _smallImageId = smallImageId;
185         }
186     }
187 
188     public long getLargeImageId() {
189         return _largeImageId;
190     }
191 
192     public void setLargeImageId(long largeImageId) {
193         if (largeImageId != _largeImageId) {
194             _largeImageId = largeImageId;
195         }
196     }
197 
198     public Object clone() {
199         IGImageImpl clone = new IGImageImpl();
200         clone.setImageId(getImageId());
201         clone.setCompanyId(getCompanyId());
202         clone.setUserId(getUserId());
203         clone.setCreateDate(getCreateDate());
204         clone.setModifiedDate(getModifiedDate());
205         clone.setFolderId(getFolderId());
206         clone.setDescription(getDescription());
207         clone.setSmallImageId(getSmallImageId());
208         clone.setLargeImageId(getLargeImageId());
209 
210         return clone;
211     }
212 
213     public int compareTo(Object obj) {
214         if (obj == null) {
215             return -1;
216         }
217 
218         IGImageImpl igImage = (IGImageImpl)obj;
219         int value = 0;
220 
221         if (getImageId() < igImage.getImageId()) {
222             value = -1;
223         }
224         else if (getImageId() > igImage.getImageId()) {
225             value = 1;
226         }
227         else {
228             value = 0;
229         }
230 
231         if (value != 0) {
232             return value;
233         }
234 
235         return 0;
236     }
237 
238     public boolean equals(Object obj) {
239         if (obj == null) {
240             return false;
241         }
242 
243         IGImageImpl igImage = null;
244 
245         try {
246             igImage = (IGImageImpl)obj;
247         }
248         catch (ClassCastException cce) {
249             return false;
250         }
251 
252         long pk = igImage.getPrimaryKey();
253 
254         if (getPrimaryKey() == pk) {
255             return true;
256         }
257         else {
258             return false;
259         }
260     }
261 
262     public int hashCode() {
263         return (int)getPrimaryKey();
264     }
265 
266     private long _imageId;
267     private long _companyId;
268     private long _userId;
269     private Date _createDate;
270     private Date _modifiedDate;
271     private long _folderId;
272     private String _description;
273     private long _smallImageId;
274     private long _largeImageId;
275 }