1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.journal.model.impl;
21  
22  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23  import com.liferay.portal.kernel.util.GetterUtil;
24  import com.liferay.portal.kernel.util.HtmlUtil;
25  import com.liferay.portal.model.impl.BaseModelImpl;
26  
27  import com.liferay.portlet.journal.model.JournalArticleImage;
28  import com.liferay.portlet.journal.model.JournalArticleImageSoap;
29  
30  import java.io.Serializable;
31  
32  import java.lang.reflect.Proxy;
33  
34  import java.sql.Types;
35  
36  import java.util.ArrayList;
37  import java.util.List;
38  
39  /**
40   * <a href="JournalArticleImageModelImpl.java.html"><b><i>View Source</i></b></a>
41   *
42   * <p>
43   * ServiceBuilder generated this class. Modifications in this class will be
44   * overwritten the next time is generated.
45   * </p>
46   *
47   * <p>
48   * This class is a model that represents the <code>JournalArticleImage</code> table
49   * in the database.
50   * </p>
51   *
52   * @author Brian Wing Shun Chan
53   *
54   * @see com.liferay.portlet.journal.model.JournalArticleImage
55   * @see com.liferay.portlet.journal.model.JournalArticleImageModel
56   * @see com.liferay.portlet.journal.model.impl.JournalArticleImageImpl
57   *
58   */
59  public class JournalArticleImageModelImpl extends BaseModelImpl {
60      public static final String TABLE_NAME = "JournalArticleImage";
61      public static final Object[][] TABLE_COLUMNS = {
62              { "articleImageId", new Integer(Types.BIGINT) },
63              
64  
65              { "groupId", new Integer(Types.BIGINT) },
66              
67  
68              { "articleId", new Integer(Types.VARCHAR) },
69              
70  
71              { "version", new Integer(Types.DOUBLE) },
72              
73  
74              { "elName", new Integer(Types.VARCHAR) },
75              
76  
77              { "languageId", new Integer(Types.VARCHAR) },
78              
79  
80              { "tempImage", new Integer(Types.BOOLEAN) }
81          };
82      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)";
83      public static final String TABLE_SQL_DROP = "drop table JournalArticleImage";
84      public static final String DATA_SOURCE = "liferayDataSource";
85      public static final String SESSION_FACTORY = "liferaySessionFactory";
86      public static final String TX_MANAGER = "liferayTransactionManager";
87      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
88                  "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalArticleImage"),
89              true);
90  
91      public static JournalArticleImage toModel(JournalArticleImageSoap soapModel) {
92          JournalArticleImage model = new JournalArticleImageImpl();
93  
94          model.setArticleImageId(soapModel.getArticleImageId());
95          model.setGroupId(soapModel.getGroupId());
96          model.setArticleId(soapModel.getArticleId());
97          model.setVersion(soapModel.getVersion());
98          model.setElName(soapModel.getElName());
99          model.setLanguageId(soapModel.getLanguageId());
100         model.setTempImage(soapModel.getTempImage());
101 
102         return model;
103     }
104 
105     public static List<JournalArticleImage> toModels(
106         JournalArticleImageSoap[] soapModels) {
107         List<JournalArticleImage> models = new ArrayList<JournalArticleImage>(soapModels.length);
108 
109         for (JournalArticleImageSoap soapModel : soapModels) {
110             models.add(toModel(soapModel));
111         }
112 
113         return models;
114     }
115 
116     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
117                 "lock.expiration.time.com.liferay.portlet.journal.model.JournalArticleImage"));
118 
119     public JournalArticleImageModelImpl() {
120     }
121 
122     public long getPrimaryKey() {
123         return _articleImageId;
124     }
125 
126     public void setPrimaryKey(long pk) {
127         setArticleImageId(pk);
128     }
129 
130     public Serializable getPrimaryKeyObj() {
131         return new Long(_articleImageId);
132     }
133 
134     public long getArticleImageId() {
135         return _articleImageId;
136     }
137 
138     public void setArticleImageId(long articleImageId) {
139         if (articleImageId != _articleImageId) {
140             _articleImageId = articleImageId;
141         }
142     }
143 
144     public long getGroupId() {
145         return _groupId;
146     }
147 
148     public void setGroupId(long groupId) {
149         if (groupId != _groupId) {
150             _groupId = groupId;
151         }
152     }
153 
154     public String getArticleId() {
155         return GetterUtil.getString(_articleId);
156     }
157 
158     public void setArticleId(String articleId) {
159         if (((articleId == null) && (_articleId != null)) ||
160                 ((articleId != null) && (_articleId == null)) ||
161                 ((articleId != null) && (_articleId != null) &&
162                 !articleId.equals(_articleId))) {
163             _articleId = articleId;
164         }
165     }
166 
167     public double getVersion() {
168         return _version;
169     }
170 
171     public void setVersion(double version) {
172         if (version != _version) {
173             _version = version;
174         }
175     }
176 
177     public String getElName() {
178         return GetterUtil.getString(_elName);
179     }
180 
181     public void setElName(String elName) {
182         if (((elName == null) && (_elName != null)) ||
183                 ((elName != null) && (_elName == null)) ||
184                 ((elName != null) && (_elName != null) &&
185                 !elName.equals(_elName))) {
186             _elName = elName;
187         }
188     }
189 
190     public String getLanguageId() {
191         return GetterUtil.getString(_languageId);
192     }
193 
194     public void setLanguageId(String languageId) {
195         if (((languageId == null) && (_languageId != null)) ||
196                 ((languageId != null) && (_languageId == null)) ||
197                 ((languageId != null) && (_languageId != null) &&
198                 !languageId.equals(_languageId))) {
199             _languageId = languageId;
200         }
201     }
202 
203     public boolean getTempImage() {
204         return _tempImage;
205     }
206 
207     public boolean isTempImage() {
208         return _tempImage;
209     }
210 
211     public void setTempImage(boolean tempImage) {
212         if (tempImage != _tempImage) {
213             _tempImage = tempImage;
214         }
215     }
216 
217     public JournalArticleImage toEscapedModel() {
218         if (isEscapedModel()) {
219             return (JournalArticleImage)this;
220         }
221         else {
222             JournalArticleImage model = new JournalArticleImageImpl();
223 
224             model.setNew(isNew());
225             model.setEscapedModel(true);
226 
227             model.setArticleImageId(getArticleImageId());
228             model.setGroupId(getGroupId());
229             model.setArticleId(HtmlUtil.escape(getArticleId()));
230             model.setVersion(getVersion());
231             model.setElName(HtmlUtil.escape(getElName()));
232             model.setLanguageId(HtmlUtil.escape(getLanguageId()));
233             model.setTempImage(getTempImage());
234 
235             model = (JournalArticleImage)Proxy.newProxyInstance(JournalArticleImage.class.getClassLoader(),
236                     new Class[] { JournalArticleImage.class },
237                     new ReadOnlyBeanHandler(model));
238 
239             return model;
240         }
241     }
242 
243     public Object clone() {
244         JournalArticleImageImpl clone = new JournalArticleImageImpl();
245 
246         clone.setArticleImageId(getArticleImageId());
247         clone.setGroupId(getGroupId());
248         clone.setArticleId(getArticleId());
249         clone.setVersion(getVersion());
250         clone.setElName(getElName());
251         clone.setLanguageId(getLanguageId());
252         clone.setTempImage(getTempImage());
253 
254         return clone;
255     }
256 
257     public int compareTo(Object obj) {
258         if (obj == null) {
259             return -1;
260         }
261 
262         JournalArticleImageImpl journalArticleImage = (JournalArticleImageImpl)obj;
263 
264         long pk = journalArticleImage.getPrimaryKey();
265 
266         if (getPrimaryKey() < pk) {
267             return -1;
268         }
269         else if (getPrimaryKey() > pk) {
270             return 1;
271         }
272         else {
273             return 0;
274         }
275     }
276 
277     public boolean equals(Object obj) {
278         if (obj == null) {
279             return false;
280         }
281 
282         JournalArticleImageImpl journalArticleImage = null;
283 
284         try {
285             journalArticleImage = (JournalArticleImageImpl)obj;
286         }
287         catch (ClassCastException cce) {
288             return false;
289         }
290 
291         long pk = journalArticleImage.getPrimaryKey();
292 
293         if (getPrimaryKey() == pk) {
294             return true;
295         }
296         else {
297             return false;
298         }
299     }
300 
301     public int hashCode() {
302         return (int)getPrimaryKey();
303     }
304 
305     private long _articleImageId;
306     private long _groupId;
307     private String _articleId;
308     private double _version;
309     private String _elName;
310     private String _languageId;
311     private boolean _tempImage;
312 }