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.journal.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  /**
36   * <a href="JournalArticleImageModelImpl.java.html"><b><i>View Source</i></b></a>
37   *
38   * <p>
39   * ServiceBuilder generated this class. Modifications in this class will be overwritten
40   * the next time is generated.
41   * </p>
42   *
43   * <p>
44   * This class is a model that represents the <code>JournalArticleImage</code> table
45   * in the database.
46   * </p>
47   *
48   * @author Brian Wing Shun Chan
49   *
50   * @see com.liferay.portlet.journal.service.model.JournalArticleImage
51   * @see com.liferay.portlet.journal.service.model.JournalArticleImageModel
52   * @see com.liferay.portlet.journal.service.model.impl.JournalArticleImageImpl
53   *
54   */
55  public class JournalArticleImageModelImpl extends BaseModelImpl {
56      public static String TABLE_NAME = "JournalArticleImage";
57      public static Object[][] TABLE_COLUMNS = {
58              { "articleImageId", new Integer(Types.BIGINT) },
59              { "groupId", new Integer(Types.BIGINT) },
60              { "articleId", new Integer(Types.VARCHAR) },
61              { "version", new Integer(Types.DOUBLE) },
62              { "elName", new Integer(Types.VARCHAR) },
63              { "languageId", new Integer(Types.VARCHAR) },
64              { "tempImage", new Integer(Types.BOOLEAN) }
65          };
66      public static String TABLE_SQL_CREATE = "create table JournalArticleImage (articleImageId LONG not null primary key,groupId LONG,articleId VARCHAR(75) null,version DOUBLE,elName VARCHAR(75) null,languageId VARCHAR(75) null,tempImage BOOLEAN)";
67      public static String TABLE_SQL_DROP = "drop table JournalArticleImage";
68      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
69                  "xss.allow.com.liferay.portlet.journal.model.JournalArticleImage"),
70              XSS_ALLOW);
71      public static boolean XSS_ALLOW_ARTICLEID = GetterUtil.getBoolean(PropsUtil.get(
72                  "xss.allow.com.liferay.portlet.journal.model.JournalArticleImage.articleId"),
73              XSS_ALLOW_BY_MODEL);
74      public static boolean XSS_ALLOW_ELNAME = GetterUtil.getBoolean(PropsUtil.get(
75                  "xss.allow.com.liferay.portlet.journal.model.JournalArticleImage.elName"),
76              XSS_ALLOW_BY_MODEL);
77      public static boolean XSS_ALLOW_LANGUAGEID = GetterUtil.getBoolean(PropsUtil.get(
78                  "xss.allow.com.liferay.portlet.journal.model.JournalArticleImage.languageId"),
79              XSS_ALLOW_BY_MODEL);
80      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
81                  "lock.expiration.time.com.liferay.portlet.journal.model.JournalArticleImageModel"));
82  
83      public JournalArticleImageModelImpl() {
84      }
85  
86      public long getPrimaryKey() {
87          return _articleImageId;
88      }
89  
90      public void setPrimaryKey(long pk) {
91          setArticleImageId(pk);
92      }
93  
94      public Serializable getPrimaryKeyObj() {
95          return new Long(_articleImageId);
96      }
97  
98      public long getArticleImageId() {
99          return _articleImageId;
100     }
101 
102     public void setArticleImageId(long articleImageId) {
103         if (articleImageId != _articleImageId) {
104             _articleImageId = articleImageId;
105         }
106     }
107 
108     public long getGroupId() {
109         return _groupId;
110     }
111 
112     public void setGroupId(long groupId) {
113         if (groupId != _groupId) {
114             _groupId = groupId;
115         }
116     }
117 
118     public String getArticleId() {
119         return GetterUtil.getString(_articleId);
120     }
121 
122     public void setArticleId(String articleId) {
123         if (((articleId == null) && (_articleId != null)) ||
124                 ((articleId != null) && (_articleId == null)) ||
125                 ((articleId != null) && (_articleId != null) &&
126                 !articleId.equals(_articleId))) {
127             if (!XSS_ALLOW_ARTICLEID) {
128                 articleId = XSSUtil.strip(articleId);
129             }
130 
131             _articleId = articleId;
132         }
133     }
134 
135     public double getVersion() {
136         return _version;
137     }
138 
139     public void setVersion(double version) {
140         if (version != _version) {
141             _version = version;
142         }
143     }
144 
145     public String getElName() {
146         return GetterUtil.getString(_elName);
147     }
148 
149     public void setElName(String elName) {
150         if (((elName == null) && (_elName != null)) ||
151                 ((elName != null) && (_elName == null)) ||
152                 ((elName != null) && (_elName != null) &&
153                 !elName.equals(_elName))) {
154             if (!XSS_ALLOW_ELNAME) {
155                 elName = XSSUtil.strip(elName);
156             }
157 
158             _elName = elName;
159         }
160     }
161 
162     public String getLanguageId() {
163         return GetterUtil.getString(_languageId);
164     }
165 
166     public void setLanguageId(String languageId) {
167         if (((languageId == null) && (_languageId != null)) ||
168                 ((languageId != null) && (_languageId == null)) ||
169                 ((languageId != null) && (_languageId != null) &&
170                 !languageId.equals(_languageId))) {
171             if (!XSS_ALLOW_LANGUAGEID) {
172                 languageId = XSSUtil.strip(languageId);
173             }
174 
175             _languageId = languageId;
176         }
177     }
178 
179     public boolean getTempImage() {
180         return _tempImage;
181     }
182 
183     public boolean isTempImage() {
184         return _tempImage;
185     }
186 
187     public void setTempImage(boolean tempImage) {
188         if (tempImage != _tempImage) {
189             _tempImage = tempImage;
190         }
191     }
192 
193     public Object clone() {
194         JournalArticleImageImpl clone = new JournalArticleImageImpl();
195         clone.setArticleImageId(getArticleImageId());
196         clone.setGroupId(getGroupId());
197         clone.setArticleId(getArticleId());
198         clone.setVersion(getVersion());
199         clone.setElName(getElName());
200         clone.setLanguageId(getLanguageId());
201         clone.setTempImage(getTempImage());
202 
203         return clone;
204     }
205 
206     public int compareTo(Object obj) {
207         if (obj == null) {
208             return -1;
209         }
210 
211         JournalArticleImageImpl journalArticleImage = (JournalArticleImageImpl)obj;
212         long pk = journalArticleImage.getPrimaryKey();
213 
214         if (getPrimaryKey() < pk) {
215             return -1;
216         }
217         else if (getPrimaryKey() > pk) {
218             return 1;
219         }
220         else {
221             return 0;
222         }
223     }
224 
225     public boolean equals(Object obj) {
226         if (obj == null) {
227             return false;
228         }
229 
230         JournalArticleImageImpl journalArticleImage = null;
231 
232         try {
233             journalArticleImage = (JournalArticleImageImpl)obj;
234         }
235         catch (ClassCastException cce) {
236             return false;
237         }
238 
239         long pk = journalArticleImage.getPrimaryKey();
240 
241         if (getPrimaryKey() == pk) {
242             return true;
243         }
244         else {
245             return false;
246         }
247     }
248 
249     public int hashCode() {
250         return (int)getPrimaryKey();
251     }
252 
253     private long _articleImageId;
254     private long _groupId;
255     private String _articleId;
256     private double _version;
257     private String _elName;
258     private String _languageId;
259     private boolean _tempImage;
260 }