1   /**
2    * Copyright (c) 2000-2008 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.bean.ReadOnlyBeanHandler;
26  import com.liferay.portal.kernel.util.GetterUtil;
27  import com.liferay.portal.kernel.util.HtmlUtil;
28  import com.liferay.portal.model.impl.BaseModelImpl;
29  
30  import com.liferay.portlet.journal.model.JournalArticleImage;
31  import com.liferay.portlet.journal.model.JournalArticleImageSoap;
32  
33  import java.io.Serializable;
34  
35  import java.lang.reflect.Proxy;
36  
37  import java.sql.Types;
38  
39  import java.util.ArrayList;
40  import java.util.List;
41  
42  /**
43   * <a href="JournalArticleImageModelImpl.java.html"><b><i>View Source</i></b></a>
44   *
45   * <p>
46   * ServiceBuilder generated this class. Modifications in this class will be
47   * overwritten the next time is generated.
48   * </p>
49   *
50   * <p>
51   * This class is a model that represents the <code>JournalArticleImage</code> table
52   * in the database.
53   * </p>
54   *
55   * @author Brian Wing Shun Chan
56   *
57   * @see com.liferay.portlet.journal.service.model.JournalArticleImage
58   * @see com.liferay.portlet.journal.service.model.JournalArticleImageModel
59   * @see com.liferay.portlet.journal.service.model.impl.JournalArticleImageImpl
60   *
61   */
62  public class JournalArticleImageModelImpl extends BaseModelImpl {
63      public static final String TABLE_NAME = "JournalArticleImage";
64      public static final Object[][] TABLE_COLUMNS = {
65              { "articleImageId", new Integer(Types.BIGINT) },
66              
67  
68              { "groupId", new Integer(Types.BIGINT) },
69              
70  
71              { "articleId", new Integer(Types.VARCHAR) },
72              
73  
74              { "version", new Integer(Types.DOUBLE) },
75              
76  
77              { "elName", new Integer(Types.VARCHAR) },
78              
79  
80              { "languageId", new Integer(Types.VARCHAR) },
81              
82  
83              { "tempImage", new Integer(Types.BOOLEAN) }
84          };
85      public static final 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)";
86      public static final String TABLE_SQL_DROP = "drop table JournalArticleImage";
87      public static final String DATA_SOURCE = "liferayDataSource";
88      public static final String SESSION_FACTORY = "liferaySessionFactory";
89      public static final String TX_MANAGER = "liferayTransactionManager";
90      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
91                  "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalArticleImage"),
92              true);
93  
94      public static JournalArticleImage toModel(JournalArticleImageSoap soapModel) {
95          JournalArticleImage model = new JournalArticleImageImpl();
96  
97          model.setArticleImageId(soapModel.getArticleImageId());
98          model.setGroupId(soapModel.getGroupId());
99          model.setArticleId(soapModel.getArticleId());
100         model.setVersion(soapModel.getVersion());
101         model.setElName(soapModel.getElName());
102         model.setLanguageId(soapModel.getLanguageId());
103         model.setTempImage(soapModel.getTempImage());
104 
105         return model;
106     }
107 
108     public static List<JournalArticleImage> toModels(
109         JournalArticleImageSoap[] soapModels) {
110         List<JournalArticleImage> models = new ArrayList<JournalArticleImage>(soapModels.length);
111 
112         for (JournalArticleImageSoap soapModel : soapModels) {
113             models.add(toModel(soapModel));
114         }
115 
116         return models;
117     }
118 
119     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
120                 "lock.expiration.time.com.liferay.portlet.journal.model.JournalArticleImage"));
121 
122     public JournalArticleImageModelImpl() {
123     }
124 
125     public long getPrimaryKey() {
126         return _articleImageId;
127     }
128 
129     public void setPrimaryKey(long pk) {
130         setArticleImageId(pk);
131     }
132 
133     public Serializable getPrimaryKeyObj() {
134         return new Long(_articleImageId);
135     }
136 
137     public long getArticleImageId() {
138         return _articleImageId;
139     }
140 
141     public void setArticleImageId(long articleImageId) {
142         if (articleImageId != _articleImageId) {
143             _articleImageId = articleImageId;
144         }
145     }
146 
147     public long getGroupId() {
148         return _groupId;
149     }
150 
151     public void setGroupId(long groupId) {
152         if (groupId != _groupId) {
153             _groupId = groupId;
154         }
155     }
156 
157     public String getArticleId() {
158         return GetterUtil.getString(_articleId);
159     }
160 
161     public void setArticleId(String articleId) {
162         if (((articleId == null) && (_articleId != null)) ||
163                 ((articleId != null) && (_articleId == null)) ||
164                 ((articleId != null) && (_articleId != null) &&
165                 !articleId.equals(_articleId))) {
166             _articleId = articleId;
167         }
168     }
169 
170     public double getVersion() {
171         return _version;
172     }
173 
174     public void setVersion(double version) {
175         if (version != _version) {
176             _version = version;
177         }
178     }
179 
180     public String getElName() {
181         return GetterUtil.getString(_elName);
182     }
183 
184     public void setElName(String elName) {
185         if (((elName == null) && (_elName != null)) ||
186                 ((elName != null) && (_elName == null)) ||
187                 ((elName != null) && (_elName != null) &&
188                 !elName.equals(_elName))) {
189             _elName = elName;
190         }
191     }
192 
193     public String getLanguageId() {
194         return GetterUtil.getString(_languageId);
195     }
196 
197     public void setLanguageId(String languageId) {
198         if (((languageId == null) && (_languageId != null)) ||
199                 ((languageId != null) && (_languageId == null)) ||
200                 ((languageId != null) && (_languageId != null) &&
201                 !languageId.equals(_languageId))) {
202             _languageId = languageId;
203         }
204     }
205 
206     public boolean getTempImage() {
207         return _tempImage;
208     }
209 
210     public boolean isTempImage() {
211         return _tempImage;
212     }
213 
214     public void setTempImage(boolean tempImage) {
215         if (tempImage != _tempImage) {
216             _tempImage = tempImage;
217         }
218     }
219 
220     public JournalArticleImage toEscapedModel() {
221         if (isEscapedModel()) {
222             return (JournalArticleImage)this;
223         }
224         else {
225             JournalArticleImage model = new JournalArticleImageImpl();
226 
227             model.setEscapedModel(true);
228 
229             model.setArticleImageId(getArticleImageId());
230             model.setGroupId(getGroupId());
231             model.setArticleId(HtmlUtil.escape(getArticleId()));
232             model.setVersion(getVersion());
233             model.setElName(HtmlUtil.escape(getElName()));
234             model.setLanguageId(HtmlUtil.escape(getLanguageId()));
235             model.setTempImage(getTempImage());
236 
237             model = (JournalArticleImage)Proxy.newProxyInstance(JournalArticleImage.class.getClassLoader(),
238                     new Class[] { JournalArticleImage.class },
239                     new ReadOnlyBeanHandler(model));
240 
241             return model;
242         }
243     }
244 
245     public Object clone() {
246         JournalArticleImageImpl clone = new JournalArticleImageImpl();
247 
248         clone.setArticleImageId(getArticleImageId());
249         clone.setGroupId(getGroupId());
250         clone.setArticleId(getArticleId());
251         clone.setVersion(getVersion());
252         clone.setElName(getElName());
253         clone.setLanguageId(getLanguageId());
254         clone.setTempImage(getTempImage());
255 
256         return clone;
257     }
258 
259     public int compareTo(Object obj) {
260         if (obj == null) {
261             return -1;
262         }
263 
264         JournalArticleImageImpl journalArticleImage = (JournalArticleImageImpl)obj;
265 
266         long pk = journalArticleImage.getPrimaryKey();
267 
268         if (getPrimaryKey() < pk) {
269             return -1;
270         }
271         else if (getPrimaryKey() > pk) {
272             return 1;
273         }
274         else {
275             return 0;
276         }
277     }
278 
279     public boolean equals(Object obj) {
280         if (obj == null) {
281             return false;
282         }
283 
284         JournalArticleImageImpl journalArticleImage = null;
285 
286         try {
287             journalArticleImage = (JournalArticleImageImpl)obj;
288         }
289         catch (ClassCastException cce) {
290             return false;
291         }
292 
293         long pk = journalArticleImage.getPrimaryKey();
294 
295         if (getPrimaryKey() == pk) {
296             return true;
297         }
298         else {
299             return false;
300         }
301     }
302 
303     public int hashCode() {
304         return (int)getPrimaryKey();
305     }
306 
307     private long _articleImageId;
308     private long _groupId;
309     private String _articleId;
310     private double _version;
311     private String _elName;
312     private String _languageId;
313     private boolean _tempImage;
314 }