001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.journal.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.kernel.annotation.BeanReference;
019    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderPath;
023    import com.liferay.portal.kernel.dao.orm.Query;
024    import com.liferay.portal.kernel.dao.orm.QueryPos;
025    import com.liferay.portal.kernel.dao.orm.QueryUtil;
026    import com.liferay.portal.kernel.dao.orm.Session;
027    import com.liferay.portal.kernel.exception.SystemException;
028    import com.liferay.portal.kernel.log.Log;
029    import com.liferay.portal.kernel.log.LogFactoryUtil;
030    import com.liferay.portal.kernel.util.GetterUtil;
031    import com.liferay.portal.kernel.util.InstanceFactory;
032    import com.liferay.portal.kernel.util.OrderByComparator;
033    import com.liferay.portal.kernel.util.StringBundler;
034    import com.liferay.portal.kernel.util.StringPool;
035    import com.liferay.portal.kernel.util.StringUtil;
036    import com.liferay.portal.kernel.util.Validator;
037    import com.liferay.portal.model.ModelListener;
038    import com.liferay.portal.service.persistence.BatchSessionUtil;
039    import com.liferay.portal.service.persistence.ImagePersistence;
040    import com.liferay.portal.service.persistence.ResourcePersistence;
041    import com.liferay.portal.service.persistence.UserPersistence;
042    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043    
044    import com.liferay.portlet.journal.NoSuchArticleImageException;
045    import com.liferay.portlet.journal.model.JournalArticleImage;
046    import com.liferay.portlet.journal.model.impl.JournalArticleImageImpl;
047    import com.liferay.portlet.journal.model.impl.JournalArticleImageModelImpl;
048    
049    import java.io.Serializable;
050    
051    import java.util.ArrayList;
052    import java.util.Collections;
053    import java.util.List;
054    
055    /**
056     * The persistence implementation for the journal article image service.
057     *
058     * <p>
059     * Never modify or reference this class directly. Always use {@link JournalArticleImageUtil} to access the journal article image persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
060     * </p>
061     *
062     * <p>
063     * Caching information and settings can be found in <code>portal.properties</code>
064     * </p>
065     *
066     * @author Brian Wing Shun Chan
067     * @see JournalArticleImagePersistence
068     * @see JournalArticleImageUtil
069     * @generated
070     */
071    public class JournalArticleImagePersistenceImpl extends BasePersistenceImpl<JournalArticleImage>
072            implements JournalArticleImagePersistence {
073            public static final String FINDER_CLASS_NAME_ENTITY = JournalArticleImageImpl.class.getName();
074            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
075                    ".List";
076            public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(JournalArticleImageModelImpl.ENTITY_CACHE_ENABLED,
077                            JournalArticleImageModelImpl.FINDER_CACHE_ENABLED,
078                            FINDER_CLASS_NAME_LIST, "findByGroupId",
079                            new String[] {
080                                    Long.class.getName(),
081                                    
082                            "java.lang.Integer", "java.lang.Integer",
083                                    "com.liferay.portal.kernel.util.OrderByComparator"
084                            });
085            public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(JournalArticleImageModelImpl.ENTITY_CACHE_ENABLED,
086                            JournalArticleImageModelImpl.FINDER_CACHE_ENABLED,
087                            FINDER_CLASS_NAME_LIST, "countByGroupId",
088                            new String[] { Long.class.getName() });
089            public static final FinderPath FINDER_PATH_FIND_BY_TEMPIMAGE = new FinderPath(JournalArticleImageModelImpl.ENTITY_CACHE_ENABLED,
090                            JournalArticleImageModelImpl.FINDER_CACHE_ENABLED,
091                            FINDER_CLASS_NAME_LIST, "findByTempImage",
092                            new String[] {
093                                    Boolean.class.getName(),
094                                    
095                            "java.lang.Integer", "java.lang.Integer",
096                                    "com.liferay.portal.kernel.util.OrderByComparator"
097                            });
098            public static final FinderPath FINDER_PATH_COUNT_BY_TEMPIMAGE = new FinderPath(JournalArticleImageModelImpl.ENTITY_CACHE_ENABLED,
099                            JournalArticleImageModelImpl.FINDER_CACHE_ENABLED,
100                            FINDER_CLASS_NAME_LIST, "countByTempImage",
101                            new String[] { Boolean.class.getName() });
102            public static final FinderPath FINDER_PATH_FIND_BY_G_A_V = new FinderPath(JournalArticleImageModelImpl.ENTITY_CACHE_ENABLED,
103                            JournalArticleImageModelImpl.FINDER_CACHE_ENABLED,
104                            FINDER_CLASS_NAME_LIST, "findByG_A_V",
105                            new String[] {
106                                    Long.class.getName(), String.class.getName(),
107                                    Double.class.getName(),
108                                    
109                            "java.lang.Integer", "java.lang.Integer",
110                                    "com.liferay.portal.kernel.util.OrderByComparator"
111                            });
112            public static final FinderPath FINDER_PATH_COUNT_BY_G_A_V = new FinderPath(JournalArticleImageModelImpl.ENTITY_CACHE_ENABLED,
113                            JournalArticleImageModelImpl.FINDER_CACHE_ENABLED,
114                            FINDER_CLASS_NAME_LIST, "countByG_A_V",
115                            new String[] {
116                                    Long.class.getName(), String.class.getName(),
117                                    Double.class.getName()
118                            });
119            public static final FinderPath FINDER_PATH_FETCH_BY_G_A_V_E_E_L = new FinderPath(JournalArticleImageModelImpl.ENTITY_CACHE_ENABLED,
120                            JournalArticleImageModelImpl.FINDER_CACHE_ENABLED,
121                            FINDER_CLASS_NAME_ENTITY, "fetchByG_A_V_E_E_L",
122                            new String[] {
123                                    Long.class.getName(), String.class.getName(),
124                                    Double.class.getName(), String.class.getName(),
125                                    String.class.getName(), String.class.getName()
126                            });
127            public static final FinderPath FINDER_PATH_COUNT_BY_G_A_V_E_E_L = new FinderPath(JournalArticleImageModelImpl.ENTITY_CACHE_ENABLED,
128                            JournalArticleImageModelImpl.FINDER_CACHE_ENABLED,
129                            FINDER_CLASS_NAME_LIST, "countByG_A_V_E_E_L",
130                            new String[] {
131                                    Long.class.getName(), String.class.getName(),
132                                    Double.class.getName(), String.class.getName(),
133                                    String.class.getName(), String.class.getName()
134                            });
135            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(JournalArticleImageModelImpl.ENTITY_CACHE_ENABLED,
136                            JournalArticleImageModelImpl.FINDER_CACHE_ENABLED,
137                            FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
138            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(JournalArticleImageModelImpl.ENTITY_CACHE_ENABLED,
139                            JournalArticleImageModelImpl.FINDER_CACHE_ENABLED,
140                            FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
141    
142            /**
143             * Caches the journal article image in the entity cache if it is enabled.
144             *
145             * @param journalArticleImage the journal article image to cache
146             */
147            public void cacheResult(JournalArticleImage journalArticleImage) {
148                    EntityCacheUtil.putResult(JournalArticleImageModelImpl.ENTITY_CACHE_ENABLED,
149                            JournalArticleImageImpl.class, journalArticleImage.getPrimaryKey(),
150                            journalArticleImage);
151    
152                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_V_E_E_L,
153                            new Object[] {
154                                    new Long(journalArticleImage.getGroupId()),
155                                    
156                            journalArticleImage.getArticleId(),
157                                    new Double(journalArticleImage.getVersion()),
158                                    
159                            journalArticleImage.getElInstanceId(),
160                                    
161                            journalArticleImage.getElName(),
162                                    
163                            journalArticleImage.getLanguageId()
164                            }, journalArticleImage);
165            }
166    
167            /**
168             * Caches the journal article images in the entity cache if it is enabled.
169             *
170             * @param journalArticleImages the journal article images to cache
171             */
172            public void cacheResult(List<JournalArticleImage> journalArticleImages) {
173                    for (JournalArticleImage journalArticleImage : journalArticleImages) {
174                            if (EntityCacheUtil.getResult(
175                                                    JournalArticleImageModelImpl.ENTITY_CACHE_ENABLED,
176                                                    JournalArticleImageImpl.class,
177                                                    journalArticleImage.getPrimaryKey(), this) == null) {
178                                    cacheResult(journalArticleImage);
179                            }
180                    }
181            }
182    
183            /**
184             * Clears the cache for all journal article images.
185             *
186             * <p>
187             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
188             * </p>
189             */
190            public void clearCache() {
191                    CacheRegistryUtil.clear(JournalArticleImageImpl.class.getName());
192                    EntityCacheUtil.clearCache(JournalArticleImageImpl.class.getName());
193                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
194                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
195            }
196    
197            /**
198             * Clears the cache for the journal article image.
199             *
200             * <p>
201             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
202             * </p>
203             */
204            public void clearCache(JournalArticleImage journalArticleImage) {
205                    EntityCacheUtil.removeResult(JournalArticleImageModelImpl.ENTITY_CACHE_ENABLED,
206                            JournalArticleImageImpl.class, journalArticleImage.getPrimaryKey());
207    
208                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_A_V_E_E_L,
209                            new Object[] {
210                                    new Long(journalArticleImage.getGroupId()),
211                                    
212                            journalArticleImage.getArticleId(),
213                                    new Double(journalArticleImage.getVersion()),
214                                    
215                            journalArticleImage.getElInstanceId(),
216                                    
217                            journalArticleImage.getElName(),
218                                    
219                            journalArticleImage.getLanguageId()
220                            });
221            }
222    
223            /**
224             * Creates a new journal article image with the primary key. Does not add the journal article image to the database.
225             *
226             * @param articleImageId the primary key for the new journal article image
227             * @return the new journal article image
228             */
229            public JournalArticleImage create(long articleImageId) {
230                    JournalArticleImage journalArticleImage = new JournalArticleImageImpl();
231    
232                    journalArticleImage.setNew(true);
233                    journalArticleImage.setPrimaryKey(articleImageId);
234    
235                    return journalArticleImage;
236            }
237    
238            /**
239             * Removes the journal article image with the primary key from the database. Also notifies the appropriate model listeners.
240             *
241             * @param primaryKey the primary key of the journal article image to remove
242             * @return the journal article image that was removed
243             * @throws com.liferay.portal.NoSuchModelException if a journal article image with the primary key could not be found
244             * @throws SystemException if a system exception occurred
245             */
246            public JournalArticleImage remove(Serializable primaryKey)
247                    throws NoSuchModelException, SystemException {
248                    return remove(((Long)primaryKey).longValue());
249            }
250    
251            /**
252             * Removes the journal article image with the primary key from the database. Also notifies the appropriate model listeners.
253             *
254             * @param articleImageId the primary key of the journal article image to remove
255             * @return the journal article image that was removed
256             * @throws com.liferay.portlet.journal.NoSuchArticleImageException if a journal article image with the primary key could not be found
257             * @throws SystemException if a system exception occurred
258             */
259            public JournalArticleImage remove(long articleImageId)
260                    throws NoSuchArticleImageException, SystemException {
261                    Session session = null;
262    
263                    try {
264                            session = openSession();
265    
266                            JournalArticleImage journalArticleImage = (JournalArticleImage)session.get(JournalArticleImageImpl.class,
267                                            new Long(articleImageId));
268    
269                            if (journalArticleImage == null) {
270                                    if (_log.isWarnEnabled()) {
271                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
272                                                    articleImageId);
273                                    }
274    
275                                    throw new NoSuchArticleImageException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
276                                            articleImageId);
277                            }
278    
279                            return remove(journalArticleImage);
280                    }
281                    catch (NoSuchArticleImageException nsee) {
282                            throw nsee;
283                    }
284                    catch (Exception e) {
285                            throw processException(e);
286                    }
287                    finally {
288                            closeSession(session);
289                    }
290            }
291    
292            protected JournalArticleImage removeImpl(
293                    JournalArticleImage journalArticleImage) throws SystemException {
294                    journalArticleImage = toUnwrappedModel(journalArticleImage);
295    
296                    Session session = null;
297    
298                    try {
299                            session = openSession();
300    
301                            if (journalArticleImage.isCachedModel() ||
302                                            BatchSessionUtil.isEnabled()) {
303                                    Object staleObject = session.get(JournalArticleImageImpl.class,
304                                                    journalArticleImage.getPrimaryKeyObj());
305    
306                                    if (staleObject != null) {
307                                            session.evict(staleObject);
308                                    }
309                            }
310    
311                            session.delete(journalArticleImage);
312    
313                            session.flush();
314                    }
315                    catch (Exception e) {
316                            throw processException(e);
317                    }
318                    finally {
319                            closeSession(session);
320                    }
321    
322                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
323    
324                    JournalArticleImageModelImpl journalArticleImageModelImpl = (JournalArticleImageModelImpl)journalArticleImage;
325    
326                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_A_V_E_E_L,
327                            new Object[] {
328                                    new Long(journalArticleImageModelImpl.getOriginalGroupId()),
329                                    
330                            journalArticleImageModelImpl.getOriginalArticleId(),
331                                    new Double(journalArticleImageModelImpl.getOriginalVersion()),
332                                    
333                            journalArticleImageModelImpl.getOriginalElInstanceId(),
334                                    
335                            journalArticleImageModelImpl.getOriginalElName(),
336                                    
337                            journalArticleImageModelImpl.getOriginalLanguageId()
338                            });
339    
340                    EntityCacheUtil.removeResult(JournalArticleImageModelImpl.ENTITY_CACHE_ENABLED,
341                            JournalArticleImageImpl.class, journalArticleImage.getPrimaryKey());
342    
343                    return journalArticleImage;
344            }
345    
346            public JournalArticleImage updateImpl(
347                    com.liferay.portlet.journal.model.JournalArticleImage journalArticleImage,
348                    boolean merge) throws SystemException {
349                    journalArticleImage = toUnwrappedModel(journalArticleImage);
350    
351                    boolean isNew = journalArticleImage.isNew();
352    
353                    JournalArticleImageModelImpl journalArticleImageModelImpl = (JournalArticleImageModelImpl)journalArticleImage;
354    
355                    Session session = null;
356    
357                    try {
358                            session = openSession();
359    
360                            BatchSessionUtil.update(session, journalArticleImage, merge);
361    
362                            journalArticleImage.setNew(false);
363                    }
364                    catch (Exception e) {
365                            throw processException(e);
366                    }
367                    finally {
368                            closeSession(session);
369                    }
370    
371                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
372    
373                    EntityCacheUtil.putResult(JournalArticleImageModelImpl.ENTITY_CACHE_ENABLED,
374                            JournalArticleImageImpl.class, journalArticleImage.getPrimaryKey(),
375                            journalArticleImage);
376    
377                    if (!isNew &&
378                                    ((journalArticleImage.getGroupId() != journalArticleImageModelImpl.getOriginalGroupId()) ||
379                                    !Validator.equals(journalArticleImage.getArticleId(),
380                                            journalArticleImageModelImpl.getOriginalArticleId()) ||
381                                    (journalArticleImage.getVersion() != journalArticleImageModelImpl.getOriginalVersion()) ||
382                                    !Validator.equals(journalArticleImage.getElInstanceId(),
383                                            journalArticleImageModelImpl.getOriginalElInstanceId()) ||
384                                    !Validator.equals(journalArticleImage.getElName(),
385                                            journalArticleImageModelImpl.getOriginalElName()) ||
386                                    !Validator.equals(journalArticleImage.getLanguageId(),
387                                            journalArticleImageModelImpl.getOriginalLanguageId()))) {
388                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_A_V_E_E_L,
389                                    new Object[] {
390                                            new Long(journalArticleImageModelImpl.getOriginalGroupId()),
391                                            
392                                    journalArticleImageModelImpl.getOriginalArticleId(),
393                                            new Double(journalArticleImageModelImpl.getOriginalVersion()),
394                                            
395                                    journalArticleImageModelImpl.getOriginalElInstanceId(),
396                                            
397                                    journalArticleImageModelImpl.getOriginalElName(),
398                                            
399                                    journalArticleImageModelImpl.getOriginalLanguageId()
400                                    });
401                    }
402    
403                    if (isNew ||
404                                    ((journalArticleImage.getGroupId() != journalArticleImageModelImpl.getOriginalGroupId()) ||
405                                    !Validator.equals(journalArticleImage.getArticleId(),
406                                            journalArticleImageModelImpl.getOriginalArticleId()) ||
407                                    (journalArticleImage.getVersion() != journalArticleImageModelImpl.getOriginalVersion()) ||
408                                    !Validator.equals(journalArticleImage.getElInstanceId(),
409                                            journalArticleImageModelImpl.getOriginalElInstanceId()) ||
410                                    !Validator.equals(journalArticleImage.getElName(),
411                                            journalArticleImageModelImpl.getOriginalElName()) ||
412                                    !Validator.equals(journalArticleImage.getLanguageId(),
413                                            journalArticleImageModelImpl.getOriginalLanguageId()))) {
414                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_V_E_E_L,
415                                    new Object[] {
416                                            new Long(journalArticleImage.getGroupId()),
417                                            
418                                    journalArticleImage.getArticleId(),
419                                            new Double(journalArticleImage.getVersion()),
420                                            
421                                    journalArticleImage.getElInstanceId(),
422                                            
423                                    journalArticleImage.getElName(),
424                                            
425                                    journalArticleImage.getLanguageId()
426                                    }, journalArticleImage);
427                    }
428    
429                    return journalArticleImage;
430            }
431    
432            protected JournalArticleImage toUnwrappedModel(
433                    JournalArticleImage journalArticleImage) {
434                    if (journalArticleImage instanceof JournalArticleImageImpl) {
435                            return journalArticleImage;
436                    }
437    
438                    JournalArticleImageImpl journalArticleImageImpl = new JournalArticleImageImpl();
439    
440                    journalArticleImageImpl.setNew(journalArticleImage.isNew());
441                    journalArticleImageImpl.setPrimaryKey(journalArticleImage.getPrimaryKey());
442    
443                    journalArticleImageImpl.setArticleImageId(journalArticleImage.getArticleImageId());
444                    journalArticleImageImpl.setGroupId(journalArticleImage.getGroupId());
445                    journalArticleImageImpl.setArticleId(journalArticleImage.getArticleId());
446                    journalArticleImageImpl.setVersion(journalArticleImage.getVersion());
447                    journalArticleImageImpl.setElInstanceId(journalArticleImage.getElInstanceId());
448                    journalArticleImageImpl.setElName(journalArticleImage.getElName());
449                    journalArticleImageImpl.setLanguageId(journalArticleImage.getLanguageId());
450                    journalArticleImageImpl.setTempImage(journalArticleImage.isTempImage());
451    
452                    return journalArticleImageImpl;
453            }
454    
455            /**
456             * Finds the journal article image with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
457             *
458             * @param primaryKey the primary key of the journal article image to find
459             * @return the journal article image
460             * @throws com.liferay.portal.NoSuchModelException if a journal article image with the primary key could not be found
461             * @throws SystemException if a system exception occurred
462             */
463            public JournalArticleImage findByPrimaryKey(Serializable primaryKey)
464                    throws NoSuchModelException, SystemException {
465                    return findByPrimaryKey(((Long)primaryKey).longValue());
466            }
467    
468            /**
469             * Finds the journal article image with the primary key or throws a {@link com.liferay.portlet.journal.NoSuchArticleImageException} if it could not be found.
470             *
471             * @param articleImageId the primary key of the journal article image to find
472             * @return the journal article image
473             * @throws com.liferay.portlet.journal.NoSuchArticleImageException if a journal article image with the primary key could not be found
474             * @throws SystemException if a system exception occurred
475             */
476            public JournalArticleImage findByPrimaryKey(long articleImageId)
477                    throws NoSuchArticleImageException, SystemException {
478                    JournalArticleImage journalArticleImage = fetchByPrimaryKey(articleImageId);
479    
480                    if (journalArticleImage == null) {
481                            if (_log.isWarnEnabled()) {
482                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + articleImageId);
483                            }
484    
485                            throw new NoSuchArticleImageException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
486                                    articleImageId);
487                    }
488    
489                    return journalArticleImage;
490            }
491    
492            /**
493             * Finds the journal article image with the primary key or returns <code>null</code> if it could not be found.
494             *
495             * @param primaryKey the primary key of the journal article image to find
496             * @return the journal article image, or <code>null</code> if a journal article image with the primary key could not be found
497             * @throws SystemException if a system exception occurred
498             */
499            public JournalArticleImage fetchByPrimaryKey(Serializable primaryKey)
500                    throws SystemException {
501                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
502            }
503    
504            /**
505             * Finds the journal article image with the primary key or returns <code>null</code> if it could not be found.
506             *
507             * @param articleImageId the primary key of the journal article image to find
508             * @return the journal article image, or <code>null</code> if a journal article image with the primary key could not be found
509             * @throws SystemException if a system exception occurred
510             */
511            public JournalArticleImage fetchByPrimaryKey(long articleImageId)
512                    throws SystemException {
513                    JournalArticleImage journalArticleImage = (JournalArticleImage)EntityCacheUtil.getResult(JournalArticleImageModelImpl.ENTITY_CACHE_ENABLED,
514                                    JournalArticleImageImpl.class, articleImageId, this);
515    
516                    if (journalArticleImage == null) {
517                            Session session = null;
518    
519                            try {
520                                    session = openSession();
521    
522                                    journalArticleImage = (JournalArticleImage)session.get(JournalArticleImageImpl.class,
523                                                    new Long(articleImageId));
524                            }
525                            catch (Exception e) {
526                                    throw processException(e);
527                            }
528                            finally {
529                                    if (journalArticleImage != null) {
530                                            cacheResult(journalArticleImage);
531                                    }
532    
533                                    closeSession(session);
534                            }
535                    }
536    
537                    return journalArticleImage;
538            }
539    
540            /**
541             * Finds all the journal article images where groupId = &#63;.
542             *
543             * @param groupId the group id to search with
544             * @return the matching journal article images
545             * @throws SystemException if a system exception occurred
546             */
547            public List<JournalArticleImage> findByGroupId(long groupId)
548                    throws SystemException {
549                    return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
550            }
551    
552            /**
553             * Finds a range of all the journal article images where groupId = &#63;.
554             *
555             * <p>
556             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
557             * </p>
558             *
559             * @param groupId the group id to search with
560             * @param start the lower bound of the range of journal article images to return
561             * @param end the upper bound of the range of journal article images to return (not inclusive)
562             * @return the range of matching journal article images
563             * @throws SystemException if a system exception occurred
564             */
565            public List<JournalArticleImage> findByGroupId(long groupId, int start,
566                    int end) throws SystemException {
567                    return findByGroupId(groupId, start, end, null);
568            }
569    
570            /**
571             * Finds an ordered range of all the journal article images where groupId = &#63;.
572             *
573             * <p>
574             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
575             * </p>
576             *
577             * @param groupId the group id to search with
578             * @param start the lower bound of the range of journal article images to return
579             * @param end the upper bound of the range of journal article images to return (not inclusive)
580             * @param orderByComparator the comparator to order the results by
581             * @return the ordered range of matching journal article images
582             * @throws SystemException if a system exception occurred
583             */
584            public List<JournalArticleImage> findByGroupId(long groupId, int start,
585                    int end, OrderByComparator orderByComparator) throws SystemException {
586                    Object[] finderArgs = new Object[] {
587                                    groupId,
588                                    
589                                    String.valueOf(start), String.valueOf(end),
590                                    String.valueOf(orderByComparator)
591                            };
592    
593                    List<JournalArticleImage> list = (List<JournalArticleImage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
594                                    finderArgs, this);
595    
596                    if (list == null) {
597                            Session session = null;
598    
599                            try {
600                                    session = openSession();
601    
602                                    StringBundler query = null;
603    
604                                    if (orderByComparator != null) {
605                                            query = new StringBundler(3 +
606                                                            (orderByComparator.getOrderByFields().length * 3));
607                                    }
608                                    else {
609                                            query = new StringBundler(2);
610                                    }
611    
612                                    query.append(_SQL_SELECT_JOURNALARTICLEIMAGE_WHERE);
613    
614                                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
615    
616                                    if (orderByComparator != null) {
617                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
618                                                    orderByComparator);
619                                    }
620    
621                                    String sql = query.toString();
622    
623                                    Query q = session.createQuery(sql);
624    
625                                    QueryPos qPos = QueryPos.getInstance(q);
626    
627                                    qPos.add(groupId);
628    
629                                    list = (List<JournalArticleImage>)QueryUtil.list(q,
630                                                    getDialect(), start, end);
631                            }
632                            catch (Exception e) {
633                                    throw processException(e);
634                            }
635                            finally {
636                                    if (list == null) {
637                                            list = new ArrayList<JournalArticleImage>();
638                                    }
639    
640                                    cacheResult(list);
641    
642                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
643                                            finderArgs, list);
644    
645                                    closeSession(session);
646                            }
647                    }
648    
649                    return list;
650            }
651    
652            /**
653             * Finds the first journal article image in the ordered set where groupId = &#63;.
654             *
655             * <p>
656             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
657             * </p>
658             *
659             * @param groupId the group id to search with
660             * @param orderByComparator the comparator to order the set by
661             * @return the first matching journal article image
662             * @throws com.liferay.portlet.journal.NoSuchArticleImageException if a matching journal article image could not be found
663             * @throws SystemException if a system exception occurred
664             */
665            public JournalArticleImage findByGroupId_First(long groupId,
666                    OrderByComparator orderByComparator)
667                    throws NoSuchArticleImageException, SystemException {
668                    List<JournalArticleImage> list = findByGroupId(groupId, 0, 1,
669                                    orderByComparator);
670    
671                    if (list.isEmpty()) {
672                            StringBundler msg = new StringBundler(4);
673    
674                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
675    
676                            msg.append("groupId=");
677                            msg.append(groupId);
678    
679                            msg.append(StringPool.CLOSE_CURLY_BRACE);
680    
681                            throw new NoSuchArticleImageException(msg.toString());
682                    }
683                    else {
684                            return list.get(0);
685                    }
686            }
687    
688            /**
689             * Finds the last journal article image in the ordered set where groupId = &#63;.
690             *
691             * <p>
692             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
693             * </p>
694             *
695             * @param groupId the group id to search with
696             * @param orderByComparator the comparator to order the set by
697             * @return the last matching journal article image
698             * @throws com.liferay.portlet.journal.NoSuchArticleImageException if a matching journal article image could not be found
699             * @throws SystemException if a system exception occurred
700             */
701            public JournalArticleImage findByGroupId_Last(long groupId,
702                    OrderByComparator orderByComparator)
703                    throws NoSuchArticleImageException, SystemException {
704                    int count = countByGroupId(groupId);
705    
706                    List<JournalArticleImage> list = findByGroupId(groupId, count - 1,
707                                    count, orderByComparator);
708    
709                    if (list.isEmpty()) {
710                            StringBundler msg = new StringBundler(4);
711    
712                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
713    
714                            msg.append("groupId=");
715                            msg.append(groupId);
716    
717                            msg.append(StringPool.CLOSE_CURLY_BRACE);
718    
719                            throw new NoSuchArticleImageException(msg.toString());
720                    }
721                    else {
722                            return list.get(0);
723                    }
724            }
725    
726            /**
727             * Finds the journal article images before and after the current journal article image in the ordered set where groupId = &#63;.
728             *
729             * <p>
730             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
731             * </p>
732             *
733             * @param articleImageId the primary key of the current journal article image
734             * @param groupId the group id to search with
735             * @param orderByComparator the comparator to order the set by
736             * @return the previous, current, and next journal article image
737             * @throws com.liferay.portlet.journal.NoSuchArticleImageException if a journal article image with the primary key could not be found
738             * @throws SystemException if a system exception occurred
739             */
740            public JournalArticleImage[] findByGroupId_PrevAndNext(
741                    long articleImageId, long groupId, OrderByComparator orderByComparator)
742                    throws NoSuchArticleImageException, SystemException {
743                    JournalArticleImage journalArticleImage = findByPrimaryKey(articleImageId);
744    
745                    Session session = null;
746    
747                    try {
748                            session = openSession();
749    
750                            JournalArticleImage[] array = new JournalArticleImageImpl[3];
751    
752                            array[0] = getByGroupId_PrevAndNext(session, journalArticleImage,
753                                            groupId, orderByComparator, true);
754    
755                            array[1] = journalArticleImage;
756    
757                            array[2] = getByGroupId_PrevAndNext(session, journalArticleImage,
758                                            groupId, orderByComparator, false);
759    
760                            return array;
761                    }
762                    catch (Exception e) {
763                            throw processException(e);
764                    }
765                    finally {
766                            closeSession(session);
767                    }
768            }
769    
770            protected JournalArticleImage getByGroupId_PrevAndNext(Session session,
771                    JournalArticleImage journalArticleImage, long groupId,
772                    OrderByComparator orderByComparator, boolean previous) {
773                    StringBundler query = null;
774    
775                    if (orderByComparator != null) {
776                            query = new StringBundler(6 +
777                                            (orderByComparator.getOrderByFields().length * 6));
778                    }
779                    else {
780                            query = new StringBundler(3);
781                    }
782    
783                    query.append(_SQL_SELECT_JOURNALARTICLEIMAGE_WHERE);
784    
785                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
786    
787                    if (orderByComparator != null) {
788                            String[] orderByFields = orderByComparator.getOrderByFields();
789    
790                            if (orderByFields.length > 0) {
791                                    query.append(WHERE_AND);
792                            }
793    
794                            for (int i = 0; i < orderByFields.length; i++) {
795                                    query.append(_ORDER_BY_ENTITY_ALIAS);
796                                    query.append(orderByFields[i]);
797    
798                                    if ((i + 1) < orderByFields.length) {
799                                            if (orderByComparator.isAscending() ^ previous) {
800                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
801                                            }
802                                            else {
803                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
804                                            }
805                                    }
806                                    else {
807                                            if (orderByComparator.isAscending() ^ previous) {
808                                                    query.append(WHERE_GREATER_THAN);
809                                            }
810                                            else {
811                                                    query.append(WHERE_LESSER_THAN);
812                                            }
813                                    }
814                            }
815    
816                            query.append(ORDER_BY_CLAUSE);
817    
818                            for (int i = 0; i < orderByFields.length; i++) {
819                                    query.append(_ORDER_BY_ENTITY_ALIAS);
820                                    query.append(orderByFields[i]);
821    
822                                    if ((i + 1) < orderByFields.length) {
823                                            if (orderByComparator.isAscending() ^ previous) {
824                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
825                                            }
826                                            else {
827                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
828                                            }
829                                    }
830                                    else {
831                                            if (orderByComparator.isAscending() ^ previous) {
832                                                    query.append(ORDER_BY_ASC);
833                                            }
834                                            else {
835                                                    query.append(ORDER_BY_DESC);
836                                            }
837                                    }
838                            }
839                    }
840    
841                    String sql = query.toString();
842    
843                    Query q = session.createQuery(sql);
844    
845                    q.setFirstResult(0);
846                    q.setMaxResults(2);
847    
848                    QueryPos qPos = QueryPos.getInstance(q);
849    
850                    qPos.add(groupId);
851    
852                    if (orderByComparator != null) {
853                            Object[] values = orderByComparator.getOrderByValues(journalArticleImage);
854    
855                            for (Object value : values) {
856                                    qPos.add(value);
857                            }
858                    }
859    
860                    List<JournalArticleImage> list = q.list();
861    
862                    if (list.size() == 2) {
863                            return list.get(1);
864                    }
865                    else {
866                            return null;
867                    }
868            }
869    
870            /**
871             * Finds all the journal article images where tempImage = &#63;.
872             *
873             * @param tempImage the temp image to search with
874             * @return the matching journal article images
875             * @throws SystemException if a system exception occurred
876             */
877            public List<JournalArticleImage> findByTempImage(boolean tempImage)
878                    throws SystemException {
879                    return findByTempImage(tempImage, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
880                            null);
881            }
882    
883            /**
884             * Finds a range of all the journal article images where tempImage = &#63;.
885             *
886             * <p>
887             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
888             * </p>
889             *
890             * @param tempImage the temp image to search with
891             * @param start the lower bound of the range of journal article images to return
892             * @param end the upper bound of the range of journal article images to return (not inclusive)
893             * @return the range of matching journal article images
894             * @throws SystemException if a system exception occurred
895             */
896            public List<JournalArticleImage> findByTempImage(boolean tempImage,
897                    int start, int end) throws SystemException {
898                    return findByTempImage(tempImage, start, end, null);
899            }
900    
901            /**
902             * Finds an ordered range of all the journal article images where tempImage = &#63;.
903             *
904             * <p>
905             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
906             * </p>
907             *
908             * @param tempImage the temp image to search with
909             * @param start the lower bound of the range of journal article images to return
910             * @param end the upper bound of the range of journal article images to return (not inclusive)
911             * @param orderByComparator the comparator to order the results by
912             * @return the ordered range of matching journal article images
913             * @throws SystemException if a system exception occurred
914             */
915            public List<JournalArticleImage> findByTempImage(boolean tempImage,
916                    int start, int end, OrderByComparator orderByComparator)
917                    throws SystemException {
918                    Object[] finderArgs = new Object[] {
919                                    tempImage,
920                                    
921                                    String.valueOf(start), String.valueOf(end),
922                                    String.valueOf(orderByComparator)
923                            };
924    
925                    List<JournalArticleImage> list = (List<JournalArticleImage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_TEMPIMAGE,
926                                    finderArgs, this);
927    
928                    if (list == null) {
929                            Session session = null;
930    
931                            try {
932                                    session = openSession();
933    
934                                    StringBundler query = null;
935    
936                                    if (orderByComparator != null) {
937                                            query = new StringBundler(3 +
938                                                            (orderByComparator.getOrderByFields().length * 3));
939                                    }
940                                    else {
941                                            query = new StringBundler(2);
942                                    }
943    
944                                    query.append(_SQL_SELECT_JOURNALARTICLEIMAGE_WHERE);
945    
946                                    query.append(_FINDER_COLUMN_TEMPIMAGE_TEMPIMAGE_2);
947    
948                                    if (orderByComparator != null) {
949                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
950                                                    orderByComparator);
951                                    }
952    
953                                    String sql = query.toString();
954    
955                                    Query q = session.createQuery(sql);
956    
957                                    QueryPos qPos = QueryPos.getInstance(q);
958    
959                                    qPos.add(tempImage);
960    
961                                    list = (List<JournalArticleImage>)QueryUtil.list(q,
962                                                    getDialect(), start, end);
963                            }
964                            catch (Exception e) {
965                                    throw processException(e);
966                            }
967                            finally {
968                                    if (list == null) {
969                                            list = new ArrayList<JournalArticleImage>();
970                                    }
971    
972                                    cacheResult(list);
973    
974                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_TEMPIMAGE,
975                                            finderArgs, list);
976    
977                                    closeSession(session);
978                            }
979                    }
980    
981                    return list;
982            }
983    
984            /**
985             * Finds the first journal article image in the ordered set where tempImage = &#63;.
986             *
987             * <p>
988             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
989             * </p>
990             *
991             * @param tempImage the temp image to search with
992             * @param orderByComparator the comparator to order the set by
993             * @return the first matching journal article image
994             * @throws com.liferay.portlet.journal.NoSuchArticleImageException if a matching journal article image could not be found
995             * @throws SystemException if a system exception occurred
996             */
997            public JournalArticleImage findByTempImage_First(boolean tempImage,
998                    OrderByComparator orderByComparator)
999                    throws NoSuchArticleImageException, SystemException {
1000                    List<JournalArticleImage> list = findByTempImage(tempImage, 0, 1,
1001                                    orderByComparator);
1002    
1003                    if (list.isEmpty()) {
1004                            StringBundler msg = new StringBundler(4);
1005    
1006                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1007    
1008                            msg.append("tempImage=");
1009                            msg.append(tempImage);
1010    
1011                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1012    
1013                            throw new NoSuchArticleImageException(msg.toString());
1014                    }
1015                    else {
1016                            return list.get(0);
1017                    }
1018            }
1019    
1020            /**
1021             * Finds the last journal article image in the ordered set where tempImage = &#63;.
1022             *
1023             * <p>
1024             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1025             * </p>
1026             *
1027             * @param tempImage the temp image to search with
1028             * @param orderByComparator the comparator to order the set by
1029             * @return the last matching journal article image
1030             * @throws com.liferay.portlet.journal.NoSuchArticleImageException if a matching journal article image could not be found
1031             * @throws SystemException if a system exception occurred
1032             */
1033            public JournalArticleImage findByTempImage_Last(boolean tempImage,
1034                    OrderByComparator orderByComparator)
1035                    throws NoSuchArticleImageException, SystemException {
1036                    int count = countByTempImage(tempImage);
1037    
1038                    List<JournalArticleImage> list = findByTempImage(tempImage, count - 1,
1039                                    count, orderByComparator);
1040    
1041                    if (list.isEmpty()) {
1042                            StringBundler msg = new StringBundler(4);
1043    
1044                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1045    
1046                            msg.append("tempImage=");
1047                            msg.append(tempImage);
1048    
1049                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1050    
1051                            throw new NoSuchArticleImageException(msg.toString());
1052                    }
1053                    else {
1054                            return list.get(0);
1055                    }
1056            }
1057    
1058            /**
1059             * Finds the journal article images before and after the current journal article image in the ordered set where tempImage = &#63;.
1060             *
1061             * <p>
1062             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1063             * </p>
1064             *
1065             * @param articleImageId the primary key of the current journal article image
1066             * @param tempImage the temp image to search with
1067             * @param orderByComparator the comparator to order the set by
1068             * @return the previous, current, and next journal article image
1069             * @throws com.liferay.portlet.journal.NoSuchArticleImageException if a journal article image with the primary key could not be found
1070             * @throws SystemException if a system exception occurred
1071             */
1072            public JournalArticleImage[] findByTempImage_PrevAndNext(
1073                    long articleImageId, boolean tempImage,
1074                    OrderByComparator orderByComparator)
1075                    throws NoSuchArticleImageException, SystemException {
1076                    JournalArticleImage journalArticleImage = findByPrimaryKey(articleImageId);
1077    
1078                    Session session = null;
1079    
1080                    try {
1081                            session = openSession();
1082    
1083                            JournalArticleImage[] array = new JournalArticleImageImpl[3];
1084    
1085                            array[0] = getByTempImage_PrevAndNext(session, journalArticleImage,
1086                                            tempImage, orderByComparator, true);
1087    
1088                            array[1] = journalArticleImage;
1089    
1090                            array[2] = getByTempImage_PrevAndNext(session, journalArticleImage,
1091                                            tempImage, orderByComparator, false);
1092    
1093                            return array;
1094                    }
1095                    catch (Exception e) {
1096                            throw processException(e);
1097                    }
1098                    finally {
1099                            closeSession(session);
1100                    }
1101            }
1102    
1103            protected JournalArticleImage getByTempImage_PrevAndNext(Session session,
1104                    JournalArticleImage journalArticleImage, boolean tempImage,
1105                    OrderByComparator orderByComparator, boolean previous) {
1106                    StringBundler query = null;
1107    
1108                    if (orderByComparator != null) {
1109                            query = new StringBundler(6 +
1110                                            (orderByComparator.getOrderByFields().length * 6));
1111                    }
1112                    else {
1113                            query = new StringBundler(3);
1114                    }
1115    
1116                    query.append(_SQL_SELECT_JOURNALARTICLEIMAGE_WHERE);
1117    
1118                    query.append(_FINDER_COLUMN_TEMPIMAGE_TEMPIMAGE_2);
1119    
1120                    if (orderByComparator != null) {
1121                            String[] orderByFields = orderByComparator.getOrderByFields();
1122    
1123                            if (orderByFields.length > 0) {
1124                                    query.append(WHERE_AND);
1125                            }
1126    
1127                            for (int i = 0; i < orderByFields.length; i++) {
1128                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1129                                    query.append(orderByFields[i]);
1130    
1131                                    if ((i + 1) < orderByFields.length) {
1132                                            if (orderByComparator.isAscending() ^ previous) {
1133                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1134                                            }
1135                                            else {
1136                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1137                                            }
1138                                    }
1139                                    else {
1140                                            if (orderByComparator.isAscending() ^ previous) {
1141                                                    query.append(WHERE_GREATER_THAN);
1142                                            }
1143                                            else {
1144                                                    query.append(WHERE_LESSER_THAN);
1145                                            }
1146                                    }
1147                            }
1148    
1149                            query.append(ORDER_BY_CLAUSE);
1150    
1151                            for (int i = 0; i < orderByFields.length; i++) {
1152                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1153                                    query.append(orderByFields[i]);
1154    
1155                                    if ((i + 1) < orderByFields.length) {
1156                                            if (orderByComparator.isAscending() ^ previous) {
1157                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1158                                            }
1159                                            else {
1160                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1161                                            }
1162                                    }
1163                                    else {
1164                                            if (orderByComparator.isAscending() ^ previous) {
1165                                                    query.append(ORDER_BY_ASC);
1166                                            }
1167                                            else {
1168                                                    query.append(ORDER_BY_DESC);
1169                                            }
1170                                    }
1171                            }
1172                    }
1173    
1174                    String sql = query.toString();
1175    
1176                    Query q = session.createQuery(sql);
1177    
1178                    q.setFirstResult(0);
1179                    q.setMaxResults(2);
1180    
1181                    QueryPos qPos = QueryPos.getInstance(q);
1182    
1183                    qPos.add(tempImage);
1184    
1185                    if (orderByComparator != null) {
1186                            Object[] values = orderByComparator.getOrderByValues(journalArticleImage);
1187    
1188                            for (Object value : values) {
1189                                    qPos.add(value);
1190                            }
1191                    }
1192    
1193                    List<JournalArticleImage> list = q.list();
1194    
1195                    if (list.size() == 2) {
1196                            return list.get(1);
1197                    }
1198                    else {
1199                            return null;
1200                    }
1201            }
1202    
1203            /**
1204             * Finds all the journal article images where groupId = &#63; and articleId = &#63; and version = &#63;.
1205             *
1206             * @param groupId the group id to search with
1207             * @param articleId the article id to search with
1208             * @param version the version to search with
1209             * @return the matching journal article images
1210             * @throws SystemException if a system exception occurred
1211             */
1212            public List<JournalArticleImage> findByG_A_V(long groupId,
1213                    String articleId, double version) throws SystemException {
1214                    return findByG_A_V(groupId, articleId, version, QueryUtil.ALL_POS,
1215                            QueryUtil.ALL_POS, null);
1216            }
1217    
1218            /**
1219             * Finds a range of all the journal article images where groupId = &#63; and articleId = &#63; and version = &#63;.
1220             *
1221             * <p>
1222             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1223             * </p>
1224             *
1225             * @param groupId the group id to search with
1226             * @param articleId the article id to search with
1227             * @param version the version to search with
1228             * @param start the lower bound of the range of journal article images to return
1229             * @param end the upper bound of the range of journal article images to return (not inclusive)
1230             * @return the range of matching journal article images
1231             * @throws SystemException if a system exception occurred
1232             */
1233            public List<JournalArticleImage> findByG_A_V(long groupId,
1234                    String articleId, double version, int start, int end)
1235                    throws SystemException {
1236                    return findByG_A_V(groupId, articleId, version, start, end, null);
1237            }
1238    
1239            /**
1240             * Finds an ordered range of all the journal article images where groupId = &#63; and articleId = &#63; and version = &#63;.
1241             *
1242             * <p>
1243             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1244             * </p>
1245             *
1246             * @param groupId the group id to search with
1247             * @param articleId the article id to search with
1248             * @param version the version to search with
1249             * @param start the lower bound of the range of journal article images to return
1250             * @param end the upper bound of the range of journal article images to return (not inclusive)
1251             * @param orderByComparator the comparator to order the results by
1252             * @return the ordered range of matching journal article images
1253             * @throws SystemException if a system exception occurred
1254             */
1255            public List<JournalArticleImage> findByG_A_V(long groupId,
1256                    String articleId, double version, int start, int end,
1257                    OrderByComparator orderByComparator) throws SystemException {
1258                    Object[] finderArgs = new Object[] {
1259                                    groupId, articleId, version,
1260                                    
1261                                    String.valueOf(start), String.valueOf(end),
1262                                    String.valueOf(orderByComparator)
1263                            };
1264    
1265                    List<JournalArticleImage> list = (List<JournalArticleImage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_A_V,
1266                                    finderArgs, this);
1267    
1268                    if (list == null) {
1269                            Session session = null;
1270    
1271                            try {
1272                                    session = openSession();
1273    
1274                                    StringBundler query = null;
1275    
1276                                    if (orderByComparator != null) {
1277                                            query = new StringBundler(5 +
1278                                                            (orderByComparator.getOrderByFields().length * 3));
1279                                    }
1280                                    else {
1281                                            query = new StringBundler(4);
1282                                    }
1283    
1284                                    query.append(_SQL_SELECT_JOURNALARTICLEIMAGE_WHERE);
1285    
1286                                    query.append(_FINDER_COLUMN_G_A_V_GROUPID_2);
1287    
1288                                    if (articleId == null) {
1289                                            query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_1);
1290                                    }
1291                                    else {
1292                                            if (articleId.equals(StringPool.BLANK)) {
1293                                                    query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_3);
1294                                            }
1295                                            else {
1296                                                    query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_2);
1297                                            }
1298                                    }
1299    
1300                                    query.append(_FINDER_COLUMN_G_A_V_VERSION_2);
1301    
1302                                    if (orderByComparator != null) {
1303                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1304                                                    orderByComparator);
1305                                    }
1306    
1307                                    String sql = query.toString();
1308    
1309                                    Query q = session.createQuery(sql);
1310    
1311                                    QueryPos qPos = QueryPos.getInstance(q);
1312    
1313                                    qPos.add(groupId);
1314    
1315                                    if (articleId != null) {
1316                                            qPos.add(articleId);
1317                                    }
1318    
1319                                    qPos.add(version);
1320    
1321                                    list = (List<JournalArticleImage>)QueryUtil.list(q,
1322                                                    getDialect(), start, end);
1323                            }
1324                            catch (Exception e) {
1325                                    throw processException(e);
1326                            }
1327                            finally {
1328                                    if (list == null) {
1329                                            list = new ArrayList<JournalArticleImage>();
1330                                    }
1331    
1332                                    cacheResult(list);
1333    
1334                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_A_V,
1335                                            finderArgs, list);
1336    
1337                                    closeSession(session);
1338                            }
1339                    }
1340    
1341                    return list;
1342            }
1343    
1344            /**
1345             * Finds the first journal article image in the ordered set where groupId = &#63; and articleId = &#63; and version = &#63;.
1346             *
1347             * <p>
1348             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1349             * </p>
1350             *
1351             * @param groupId the group id to search with
1352             * @param articleId the article id to search with
1353             * @param version the version to search with
1354             * @param orderByComparator the comparator to order the set by
1355             * @return the first matching journal article image
1356             * @throws com.liferay.portlet.journal.NoSuchArticleImageException if a matching journal article image could not be found
1357             * @throws SystemException if a system exception occurred
1358             */
1359            public JournalArticleImage findByG_A_V_First(long groupId,
1360                    String articleId, double version, OrderByComparator orderByComparator)
1361                    throws NoSuchArticleImageException, SystemException {
1362                    List<JournalArticleImage> list = findByG_A_V(groupId, articleId,
1363                                    version, 0, 1, orderByComparator);
1364    
1365                    if (list.isEmpty()) {
1366                            StringBundler msg = new StringBundler(8);
1367    
1368                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1369    
1370                            msg.append("groupId=");
1371                            msg.append(groupId);
1372    
1373                            msg.append(", articleId=");
1374                            msg.append(articleId);
1375    
1376                            msg.append(", version=");
1377                            msg.append(version);
1378    
1379                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1380    
1381                            throw new NoSuchArticleImageException(msg.toString());
1382                    }
1383                    else {
1384                            return list.get(0);
1385                    }
1386            }
1387    
1388            /**
1389             * Finds the last journal article image in the ordered set where groupId = &#63; and articleId = &#63; and version = &#63;.
1390             *
1391             * <p>
1392             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1393             * </p>
1394             *
1395             * @param groupId the group id to search with
1396             * @param articleId the article id to search with
1397             * @param version the version to search with
1398             * @param orderByComparator the comparator to order the set by
1399             * @return the last matching journal article image
1400             * @throws com.liferay.portlet.journal.NoSuchArticleImageException if a matching journal article image could not be found
1401             * @throws SystemException if a system exception occurred
1402             */
1403            public JournalArticleImage findByG_A_V_Last(long groupId, String articleId,
1404                    double version, OrderByComparator orderByComparator)
1405                    throws NoSuchArticleImageException, SystemException {
1406                    int count = countByG_A_V(groupId, articleId, version);
1407    
1408                    List<JournalArticleImage> list = findByG_A_V(groupId, articleId,
1409                                    version, count - 1, count, orderByComparator);
1410    
1411                    if (list.isEmpty()) {
1412                            StringBundler msg = new StringBundler(8);
1413    
1414                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1415    
1416                            msg.append("groupId=");
1417                            msg.append(groupId);
1418    
1419                            msg.append(", articleId=");
1420                            msg.append(articleId);
1421    
1422                            msg.append(", version=");
1423                            msg.append(version);
1424    
1425                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1426    
1427                            throw new NoSuchArticleImageException(msg.toString());
1428                    }
1429                    else {
1430                            return list.get(0);
1431                    }
1432            }
1433    
1434            /**
1435             * Finds the journal article images before and after the current journal article image in the ordered set where groupId = &#63; and articleId = &#63; and version = &#63;.
1436             *
1437             * <p>
1438             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1439             * </p>
1440             *
1441             * @param articleImageId the primary key of the current journal article image
1442             * @param groupId the group id to search with
1443             * @param articleId the article id to search with
1444             * @param version the version to search with
1445             * @param orderByComparator the comparator to order the set by
1446             * @return the previous, current, and next journal article image
1447             * @throws com.liferay.portlet.journal.NoSuchArticleImageException if a journal article image with the primary key could not be found
1448             * @throws SystemException if a system exception occurred
1449             */
1450            public JournalArticleImage[] findByG_A_V_PrevAndNext(long articleImageId,
1451                    long groupId, String articleId, double version,
1452                    OrderByComparator orderByComparator)
1453                    throws NoSuchArticleImageException, SystemException {
1454                    JournalArticleImage journalArticleImage = findByPrimaryKey(articleImageId);
1455    
1456                    Session session = null;
1457    
1458                    try {
1459                            session = openSession();
1460    
1461                            JournalArticleImage[] array = new JournalArticleImageImpl[3];
1462    
1463                            array[0] = getByG_A_V_PrevAndNext(session, journalArticleImage,
1464                                            groupId, articleId, version, orderByComparator, true);
1465    
1466                            array[1] = journalArticleImage;
1467    
1468                            array[2] = getByG_A_V_PrevAndNext(session, journalArticleImage,
1469                                            groupId, articleId, version, orderByComparator, false);
1470    
1471                            return array;
1472                    }
1473                    catch (Exception e) {
1474                            throw processException(e);
1475                    }
1476                    finally {
1477                            closeSession(session);
1478                    }
1479            }
1480    
1481            protected JournalArticleImage getByG_A_V_PrevAndNext(Session session,
1482                    JournalArticleImage journalArticleImage, long groupId,
1483                    String articleId, double version, OrderByComparator orderByComparator,
1484                    boolean previous) {
1485                    StringBundler query = null;
1486    
1487                    if (orderByComparator != null) {
1488                            query = new StringBundler(6 +
1489                                            (orderByComparator.getOrderByFields().length * 6));
1490                    }
1491                    else {
1492                            query = new StringBundler(3);
1493                    }
1494    
1495                    query.append(_SQL_SELECT_JOURNALARTICLEIMAGE_WHERE);
1496    
1497                    query.append(_FINDER_COLUMN_G_A_V_GROUPID_2);
1498    
1499                    if (articleId == null) {
1500                            query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_1);
1501                    }
1502                    else {
1503                            if (articleId.equals(StringPool.BLANK)) {
1504                                    query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_3);
1505                            }
1506                            else {
1507                                    query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_2);
1508                            }
1509                    }
1510    
1511                    query.append(_FINDER_COLUMN_G_A_V_VERSION_2);
1512    
1513                    if (orderByComparator != null) {
1514                            String[] orderByFields = orderByComparator.getOrderByFields();
1515    
1516                            if (orderByFields.length > 0) {
1517                                    query.append(WHERE_AND);
1518                            }
1519    
1520                            for (int i = 0; i < orderByFields.length; i++) {
1521                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1522                                    query.append(orderByFields[i]);
1523    
1524                                    if ((i + 1) < orderByFields.length) {
1525                                            if (orderByComparator.isAscending() ^ previous) {
1526                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1527                                            }
1528                                            else {
1529                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1530                                            }
1531                                    }
1532                                    else {
1533                                            if (orderByComparator.isAscending() ^ previous) {
1534                                                    query.append(WHERE_GREATER_THAN);
1535                                            }
1536                                            else {
1537                                                    query.append(WHERE_LESSER_THAN);
1538                                            }
1539                                    }
1540                            }
1541    
1542                            query.append(ORDER_BY_CLAUSE);
1543    
1544                            for (int i = 0; i < orderByFields.length; i++) {
1545                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1546                                    query.append(orderByFields[i]);
1547    
1548                                    if ((i + 1) < orderByFields.length) {
1549                                            if (orderByComparator.isAscending() ^ previous) {
1550                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1551                                            }
1552                                            else {
1553                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1554                                            }
1555                                    }
1556                                    else {
1557                                            if (orderByComparator.isAscending() ^ previous) {
1558                                                    query.append(ORDER_BY_ASC);
1559                                            }
1560                                            else {
1561                                                    query.append(ORDER_BY_DESC);
1562                                            }
1563                                    }
1564                            }
1565                    }
1566    
1567                    String sql = query.toString();
1568    
1569                    Query q = session.createQuery(sql);
1570    
1571                    q.setFirstResult(0);
1572                    q.setMaxResults(2);
1573    
1574                    QueryPos qPos = QueryPos.getInstance(q);
1575    
1576                    qPos.add(groupId);
1577    
1578                    if (articleId != null) {
1579                            qPos.add(articleId);
1580                    }
1581    
1582                    qPos.add(version);
1583    
1584                    if (orderByComparator != null) {
1585                            Object[] values = orderByComparator.getOrderByValues(journalArticleImage);
1586    
1587                            for (Object value : values) {
1588                                    qPos.add(value);
1589                            }
1590                    }
1591    
1592                    List<JournalArticleImage> list = q.list();
1593    
1594                    if (list.size() == 2) {
1595                            return list.get(1);
1596                    }
1597                    else {
1598                            return null;
1599                    }
1600            }
1601    
1602            /**
1603             * Finds the journal article image where groupId = &#63; and articleId = &#63; and version = &#63; and elInstanceId = &#63; and elName = &#63; and languageId = &#63; or throws a {@link com.liferay.portlet.journal.NoSuchArticleImageException} if it could not be found.
1604             *
1605             * @param groupId the group id to search with
1606             * @param articleId the article id to search with
1607             * @param version the version to search with
1608             * @param elInstanceId the el instance id to search with
1609             * @param elName the el name to search with
1610             * @param languageId the language id to search with
1611             * @return the matching journal article image
1612             * @throws com.liferay.portlet.journal.NoSuchArticleImageException if a matching journal article image could not be found
1613             * @throws SystemException if a system exception occurred
1614             */
1615            public JournalArticleImage findByG_A_V_E_E_L(long groupId,
1616                    String articleId, double version, String elInstanceId, String elName,
1617                    String languageId) throws NoSuchArticleImageException, SystemException {
1618                    JournalArticleImage journalArticleImage = fetchByG_A_V_E_E_L(groupId,
1619                                    articleId, version, elInstanceId, elName, languageId);
1620    
1621                    if (journalArticleImage == null) {
1622                            StringBundler msg = new StringBundler(14);
1623    
1624                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1625    
1626                            msg.append("groupId=");
1627                            msg.append(groupId);
1628    
1629                            msg.append(", articleId=");
1630                            msg.append(articleId);
1631    
1632                            msg.append(", version=");
1633                            msg.append(version);
1634    
1635                            msg.append(", elInstanceId=");
1636                            msg.append(elInstanceId);
1637    
1638                            msg.append(", elName=");
1639                            msg.append(elName);
1640    
1641                            msg.append(", languageId=");
1642                            msg.append(languageId);
1643    
1644                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1645    
1646                            if (_log.isWarnEnabled()) {
1647                                    _log.warn(msg.toString());
1648                            }
1649    
1650                            throw new NoSuchArticleImageException(msg.toString());
1651                    }
1652    
1653                    return journalArticleImage;
1654            }
1655    
1656            /**
1657             * Finds the journal article image where groupId = &#63; and articleId = &#63; and version = &#63; and elInstanceId = &#63; and elName = &#63; and languageId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
1658             *
1659             * @param groupId the group id to search with
1660             * @param articleId the article id to search with
1661             * @param version the version to search with
1662             * @param elInstanceId the el instance id to search with
1663             * @param elName the el name to search with
1664             * @param languageId the language id to search with
1665             * @return the matching journal article image, or <code>null</code> if a matching journal article image could not be found
1666             * @throws SystemException if a system exception occurred
1667             */
1668            public JournalArticleImage fetchByG_A_V_E_E_L(long groupId,
1669                    String articleId, double version, String elInstanceId, String elName,
1670                    String languageId) throws SystemException {
1671                    return fetchByG_A_V_E_E_L(groupId, articleId, version, elInstanceId,
1672                            elName, languageId, true);
1673            }
1674    
1675            /**
1676             * Finds the journal article image where groupId = &#63; and articleId = &#63; and version = &#63; and elInstanceId = &#63; and elName = &#63; and languageId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
1677             *
1678             * @param groupId the group id to search with
1679             * @param articleId the article id to search with
1680             * @param version the version to search with
1681             * @param elInstanceId the el instance id to search with
1682             * @param elName the el name to search with
1683             * @param languageId the language id to search with
1684             * @return the matching journal article image, or <code>null</code> if a matching journal article image could not be found
1685             * @throws SystemException if a system exception occurred
1686             */
1687            public JournalArticleImage fetchByG_A_V_E_E_L(long groupId,
1688                    String articleId, double version, String elInstanceId, String elName,
1689                    String languageId, boolean retrieveFromCache) throws SystemException {
1690                    Object[] finderArgs = new Object[] {
1691                                    groupId, articleId, version, elInstanceId, elName, languageId
1692                            };
1693    
1694                    Object result = null;
1695    
1696                    if (retrieveFromCache) {
1697                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_A_V_E_E_L,
1698                                            finderArgs, this);
1699                    }
1700    
1701                    if (result == null) {
1702                            Session session = null;
1703    
1704                            try {
1705                                    session = openSession();
1706    
1707                                    StringBundler query = new StringBundler(7);
1708    
1709                                    query.append(_SQL_SELECT_JOURNALARTICLEIMAGE_WHERE);
1710    
1711                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_GROUPID_2);
1712    
1713                                    if (articleId == null) {
1714                                            query.append(_FINDER_COLUMN_G_A_V_E_E_L_ARTICLEID_1);
1715                                    }
1716                                    else {
1717                                            if (articleId.equals(StringPool.BLANK)) {
1718                                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_ARTICLEID_3);
1719                                            }
1720                                            else {
1721                                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_ARTICLEID_2);
1722                                            }
1723                                    }
1724    
1725                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_VERSION_2);
1726    
1727                                    if (elInstanceId == null) {
1728                                            query.append(_FINDER_COLUMN_G_A_V_E_E_L_ELINSTANCEID_1);
1729                                    }
1730                                    else {
1731                                            if (elInstanceId.equals(StringPool.BLANK)) {
1732                                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_ELINSTANCEID_3);
1733                                            }
1734                                            else {
1735                                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_ELINSTANCEID_2);
1736                                            }
1737                                    }
1738    
1739                                    if (elName == null) {
1740                                            query.append(_FINDER_COLUMN_G_A_V_E_E_L_ELNAME_1);
1741                                    }
1742                                    else {
1743                                            if (elName.equals(StringPool.BLANK)) {
1744                                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_ELNAME_3);
1745                                            }
1746                                            else {
1747                                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_ELNAME_2);
1748                                            }
1749                                    }
1750    
1751                                    if (languageId == null) {
1752                                            query.append(_FINDER_COLUMN_G_A_V_E_E_L_LANGUAGEID_1);
1753                                    }
1754                                    else {
1755                                            if (languageId.equals(StringPool.BLANK)) {
1756                                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_LANGUAGEID_3);
1757                                            }
1758                                            else {
1759                                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_LANGUAGEID_2);
1760                                            }
1761                                    }
1762    
1763                                    String sql = query.toString();
1764    
1765                                    Query q = session.createQuery(sql);
1766    
1767                                    QueryPos qPos = QueryPos.getInstance(q);
1768    
1769                                    qPos.add(groupId);
1770    
1771                                    if (articleId != null) {
1772                                            qPos.add(articleId);
1773                                    }
1774    
1775                                    qPos.add(version);
1776    
1777                                    if (elInstanceId != null) {
1778                                            qPos.add(elInstanceId);
1779                                    }
1780    
1781                                    if (elName != null) {
1782                                            qPos.add(elName);
1783                                    }
1784    
1785                                    if (languageId != null) {
1786                                            qPos.add(languageId);
1787                                    }
1788    
1789                                    List<JournalArticleImage> list = q.list();
1790    
1791                                    result = list;
1792    
1793                                    JournalArticleImage journalArticleImage = null;
1794    
1795                                    if (list.isEmpty()) {
1796                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_V_E_E_L,
1797                                                    finderArgs, list);
1798                                    }
1799                                    else {
1800                                            journalArticleImage = list.get(0);
1801    
1802                                            cacheResult(journalArticleImage);
1803    
1804                                            if ((journalArticleImage.getGroupId() != groupId) ||
1805                                                            (journalArticleImage.getArticleId() == null) ||
1806                                                            !journalArticleImage.getArticleId().equals(articleId) ||
1807                                                            (journalArticleImage.getVersion() != version) ||
1808                                                            (journalArticleImage.getElInstanceId() == null) ||
1809                                                            !journalArticleImage.getElInstanceId()
1810                                                                                                            .equals(elInstanceId) ||
1811                                                            (journalArticleImage.getElName() == null) ||
1812                                                            !journalArticleImage.getElName().equals(elName) ||
1813                                                            (journalArticleImage.getLanguageId() == null) ||
1814                                                            !journalArticleImage.getLanguageId()
1815                                                                                                            .equals(languageId)) {
1816                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_V_E_E_L,
1817                                                            finderArgs, journalArticleImage);
1818                                            }
1819                                    }
1820    
1821                                    return journalArticleImage;
1822                            }
1823                            catch (Exception e) {
1824                                    throw processException(e);
1825                            }
1826                            finally {
1827                                    if (result == null) {
1828                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_A_V_E_E_L,
1829                                                    finderArgs, new ArrayList<JournalArticleImage>());
1830                                    }
1831    
1832                                    closeSession(session);
1833                            }
1834                    }
1835                    else {
1836                            if (result instanceof List<?>) {
1837                                    return null;
1838                            }
1839                            else {
1840                                    return (JournalArticleImage)result;
1841                            }
1842                    }
1843            }
1844    
1845            /**
1846             * Finds all the journal article images.
1847             *
1848             * @return the journal article images
1849             * @throws SystemException if a system exception occurred
1850             */
1851            public List<JournalArticleImage> findAll() throws SystemException {
1852                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1853            }
1854    
1855            /**
1856             * Finds a range of all the journal article images.
1857             *
1858             * <p>
1859             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1860             * </p>
1861             *
1862             * @param start the lower bound of the range of journal article images to return
1863             * @param end the upper bound of the range of journal article images to return (not inclusive)
1864             * @return the range of journal article images
1865             * @throws SystemException if a system exception occurred
1866             */
1867            public List<JournalArticleImage> findAll(int start, int end)
1868                    throws SystemException {
1869                    return findAll(start, end, null);
1870            }
1871    
1872            /**
1873             * Finds an ordered range of all the journal article images.
1874             *
1875             * <p>
1876             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1877             * </p>
1878             *
1879             * @param start the lower bound of the range of journal article images to return
1880             * @param end the upper bound of the range of journal article images to return (not inclusive)
1881             * @param orderByComparator the comparator to order the results by
1882             * @return the ordered range of journal article images
1883             * @throws SystemException if a system exception occurred
1884             */
1885            public List<JournalArticleImage> findAll(int start, int end,
1886                    OrderByComparator orderByComparator) throws SystemException {
1887                    Object[] finderArgs = new Object[] {
1888                                    String.valueOf(start), String.valueOf(end),
1889                                    String.valueOf(orderByComparator)
1890                            };
1891    
1892                    List<JournalArticleImage> list = (List<JournalArticleImage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1893                                    finderArgs, this);
1894    
1895                    if (list == null) {
1896                            Session session = null;
1897    
1898                            try {
1899                                    session = openSession();
1900    
1901                                    StringBundler query = null;
1902                                    String sql = null;
1903    
1904                                    if (orderByComparator != null) {
1905                                            query = new StringBundler(2 +
1906                                                            (orderByComparator.getOrderByFields().length * 3));
1907    
1908                                            query.append(_SQL_SELECT_JOURNALARTICLEIMAGE);
1909    
1910                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1911                                                    orderByComparator);
1912    
1913                                            sql = query.toString();
1914                                    }
1915                                    else {
1916                                            sql = _SQL_SELECT_JOURNALARTICLEIMAGE;
1917                                    }
1918    
1919                                    Query q = session.createQuery(sql);
1920    
1921                                    if (orderByComparator == null) {
1922                                            list = (List<JournalArticleImage>)QueryUtil.list(q,
1923                                                            getDialect(), start, end, false);
1924    
1925                                            Collections.sort(list);
1926                                    }
1927                                    else {
1928                                            list = (List<JournalArticleImage>)QueryUtil.list(q,
1929                                                            getDialect(), start, end);
1930                                    }
1931                            }
1932                            catch (Exception e) {
1933                                    throw processException(e);
1934                            }
1935                            finally {
1936                                    if (list == null) {
1937                                            list = new ArrayList<JournalArticleImage>();
1938                                    }
1939    
1940                                    cacheResult(list);
1941    
1942                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1943    
1944                                    closeSession(session);
1945                            }
1946                    }
1947    
1948                    return list;
1949            }
1950    
1951            /**
1952             * Removes all the journal article images where groupId = &#63; from the database.
1953             *
1954             * @param groupId the group id to search with
1955             * @throws SystemException if a system exception occurred
1956             */
1957            public void removeByGroupId(long groupId) throws SystemException {
1958                    for (JournalArticleImage journalArticleImage : findByGroupId(groupId)) {
1959                            remove(journalArticleImage);
1960                    }
1961            }
1962    
1963            /**
1964             * Removes all the journal article images where tempImage = &#63; from the database.
1965             *
1966             * @param tempImage the temp image to search with
1967             * @throws SystemException if a system exception occurred
1968             */
1969            public void removeByTempImage(boolean tempImage) throws SystemException {
1970                    for (JournalArticleImage journalArticleImage : findByTempImage(
1971                                    tempImage)) {
1972                            remove(journalArticleImage);
1973                    }
1974            }
1975    
1976            /**
1977             * Removes all the journal article images where groupId = &#63; and articleId = &#63; and version = &#63; from the database.
1978             *
1979             * @param groupId the group id to search with
1980             * @param articleId the article id to search with
1981             * @param version the version to search with
1982             * @throws SystemException if a system exception occurred
1983             */
1984            public void removeByG_A_V(long groupId, String articleId, double version)
1985                    throws SystemException {
1986                    for (JournalArticleImage journalArticleImage : findByG_A_V(groupId,
1987                                    articleId, version)) {
1988                            remove(journalArticleImage);
1989                    }
1990            }
1991    
1992            /**
1993             * Removes the journal article image where groupId = &#63; and articleId = &#63; and version = &#63; and elInstanceId = &#63; and elName = &#63; and languageId = &#63; from the database.
1994             *
1995             * @param groupId the group id to search with
1996             * @param articleId the article id to search with
1997             * @param version the version to search with
1998             * @param elInstanceId the el instance id to search with
1999             * @param elName the el name to search with
2000             * @param languageId the language id to search with
2001             * @throws SystemException if a system exception occurred
2002             */
2003            public void removeByG_A_V_E_E_L(long groupId, String articleId,
2004                    double version, String elInstanceId, String elName, String languageId)
2005                    throws NoSuchArticleImageException, SystemException {
2006                    JournalArticleImage journalArticleImage = findByG_A_V_E_E_L(groupId,
2007                                    articleId, version, elInstanceId, elName, languageId);
2008    
2009                    remove(journalArticleImage);
2010            }
2011    
2012            /**
2013             * Removes all the journal article images from the database.
2014             *
2015             * @throws SystemException if a system exception occurred
2016             */
2017            public void removeAll() throws SystemException {
2018                    for (JournalArticleImage journalArticleImage : findAll()) {
2019                            remove(journalArticleImage);
2020                    }
2021            }
2022    
2023            /**
2024             * Counts all the journal article images where groupId = &#63;.
2025             *
2026             * @param groupId the group id to search with
2027             * @return the number of matching journal article images
2028             * @throws SystemException if a system exception occurred
2029             */
2030            public int countByGroupId(long groupId) throws SystemException {
2031                    Object[] finderArgs = new Object[] { groupId };
2032    
2033                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2034                                    finderArgs, this);
2035    
2036                    if (count == null) {
2037                            Session session = null;
2038    
2039                            try {
2040                                    session = openSession();
2041    
2042                                    StringBundler query = new StringBundler(2);
2043    
2044                                    query.append(_SQL_COUNT_JOURNALARTICLEIMAGE_WHERE);
2045    
2046                                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2047    
2048                                    String sql = query.toString();
2049    
2050                                    Query q = session.createQuery(sql);
2051    
2052                                    QueryPos qPos = QueryPos.getInstance(q);
2053    
2054                                    qPos.add(groupId);
2055    
2056                                    count = (Long)q.uniqueResult();
2057                            }
2058                            catch (Exception e) {
2059                                    throw processException(e);
2060                            }
2061                            finally {
2062                                    if (count == null) {
2063                                            count = Long.valueOf(0);
2064                                    }
2065    
2066                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2067                                            finderArgs, count);
2068    
2069                                    closeSession(session);
2070                            }
2071                    }
2072    
2073                    return count.intValue();
2074            }
2075    
2076            /**
2077             * Counts all the journal article images where tempImage = &#63;.
2078             *
2079             * @param tempImage the temp image to search with
2080             * @return the number of matching journal article images
2081             * @throws SystemException if a system exception occurred
2082             */
2083            public int countByTempImage(boolean tempImage) throws SystemException {
2084                    Object[] finderArgs = new Object[] { tempImage };
2085    
2086                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TEMPIMAGE,
2087                                    finderArgs, this);
2088    
2089                    if (count == null) {
2090                            Session session = null;
2091    
2092                            try {
2093                                    session = openSession();
2094    
2095                                    StringBundler query = new StringBundler(2);
2096    
2097                                    query.append(_SQL_COUNT_JOURNALARTICLEIMAGE_WHERE);
2098    
2099                                    query.append(_FINDER_COLUMN_TEMPIMAGE_TEMPIMAGE_2);
2100    
2101                                    String sql = query.toString();
2102    
2103                                    Query q = session.createQuery(sql);
2104    
2105                                    QueryPos qPos = QueryPos.getInstance(q);
2106    
2107                                    qPos.add(tempImage);
2108    
2109                                    count = (Long)q.uniqueResult();
2110                            }
2111                            catch (Exception e) {
2112                                    throw processException(e);
2113                            }
2114                            finally {
2115                                    if (count == null) {
2116                                            count = Long.valueOf(0);
2117                                    }
2118    
2119                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TEMPIMAGE,
2120                                            finderArgs, count);
2121    
2122                                    closeSession(session);
2123                            }
2124                    }
2125    
2126                    return count.intValue();
2127            }
2128    
2129            /**
2130             * Counts all the journal article images where groupId = &#63; and articleId = &#63; and version = &#63;.
2131             *
2132             * @param groupId the group id to search with
2133             * @param articleId the article id to search with
2134             * @param version the version to search with
2135             * @return the number of matching journal article images
2136             * @throws SystemException if a system exception occurred
2137             */
2138            public int countByG_A_V(long groupId, String articleId, double version)
2139                    throws SystemException {
2140                    Object[] finderArgs = new Object[] { groupId, articleId, version };
2141    
2142                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_A_V,
2143                                    finderArgs, this);
2144    
2145                    if (count == null) {
2146                            Session session = null;
2147    
2148                            try {
2149                                    session = openSession();
2150    
2151                                    StringBundler query = new StringBundler(4);
2152    
2153                                    query.append(_SQL_COUNT_JOURNALARTICLEIMAGE_WHERE);
2154    
2155                                    query.append(_FINDER_COLUMN_G_A_V_GROUPID_2);
2156    
2157                                    if (articleId == null) {
2158                                            query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_1);
2159                                    }
2160                                    else {
2161                                            if (articleId.equals(StringPool.BLANK)) {
2162                                                    query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_3);
2163                                            }
2164                                            else {
2165                                                    query.append(_FINDER_COLUMN_G_A_V_ARTICLEID_2);
2166                                            }
2167                                    }
2168    
2169                                    query.append(_FINDER_COLUMN_G_A_V_VERSION_2);
2170    
2171                                    String sql = query.toString();
2172    
2173                                    Query q = session.createQuery(sql);
2174    
2175                                    QueryPos qPos = QueryPos.getInstance(q);
2176    
2177                                    qPos.add(groupId);
2178    
2179                                    if (articleId != null) {
2180                                            qPos.add(articleId);
2181                                    }
2182    
2183                                    qPos.add(version);
2184    
2185                                    count = (Long)q.uniqueResult();
2186                            }
2187                            catch (Exception e) {
2188                                    throw processException(e);
2189                            }
2190                            finally {
2191                                    if (count == null) {
2192                                            count = Long.valueOf(0);
2193                                    }
2194    
2195                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_A_V,
2196                                            finderArgs, count);
2197    
2198                                    closeSession(session);
2199                            }
2200                    }
2201    
2202                    return count.intValue();
2203            }
2204    
2205            /**
2206             * Counts all the journal article images where groupId = &#63; and articleId = &#63; and version = &#63; and elInstanceId = &#63; and elName = &#63; and languageId = &#63;.
2207             *
2208             * @param groupId the group id to search with
2209             * @param articleId the article id to search with
2210             * @param version the version to search with
2211             * @param elInstanceId the el instance id to search with
2212             * @param elName the el name to search with
2213             * @param languageId the language id to search with
2214             * @return the number of matching journal article images
2215             * @throws SystemException if a system exception occurred
2216             */
2217            public int countByG_A_V_E_E_L(long groupId, String articleId,
2218                    double version, String elInstanceId, String elName, String languageId)
2219                    throws SystemException {
2220                    Object[] finderArgs = new Object[] {
2221                                    groupId, articleId, version, elInstanceId, elName, languageId
2222                            };
2223    
2224                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_A_V_E_E_L,
2225                                    finderArgs, this);
2226    
2227                    if (count == null) {
2228                            Session session = null;
2229    
2230                            try {
2231                                    session = openSession();
2232    
2233                                    StringBundler query = new StringBundler(7);
2234    
2235                                    query.append(_SQL_COUNT_JOURNALARTICLEIMAGE_WHERE);
2236    
2237                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_GROUPID_2);
2238    
2239                                    if (articleId == null) {
2240                                            query.append(_FINDER_COLUMN_G_A_V_E_E_L_ARTICLEID_1);
2241                                    }
2242                                    else {
2243                                            if (articleId.equals(StringPool.BLANK)) {
2244                                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_ARTICLEID_3);
2245                                            }
2246                                            else {
2247                                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_ARTICLEID_2);
2248                                            }
2249                                    }
2250    
2251                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_VERSION_2);
2252    
2253                                    if (elInstanceId == null) {
2254                                            query.append(_FINDER_COLUMN_G_A_V_E_E_L_ELINSTANCEID_1);
2255                                    }
2256                                    else {
2257                                            if (elInstanceId.equals(StringPool.BLANK)) {
2258                                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_ELINSTANCEID_3);
2259                                            }
2260                                            else {
2261                                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_ELINSTANCEID_2);
2262                                            }
2263                                    }
2264    
2265                                    if (elName == null) {
2266                                            query.append(_FINDER_COLUMN_G_A_V_E_E_L_ELNAME_1);
2267                                    }
2268                                    else {
2269                                            if (elName.equals(StringPool.BLANK)) {
2270                                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_ELNAME_3);
2271                                            }
2272                                            else {
2273                                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_ELNAME_2);
2274                                            }
2275                                    }
2276    
2277                                    if (languageId == null) {
2278                                            query.append(_FINDER_COLUMN_G_A_V_E_E_L_LANGUAGEID_1);
2279                                    }
2280                                    else {
2281                                            if (languageId.equals(StringPool.BLANK)) {
2282                                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_LANGUAGEID_3);
2283                                            }
2284                                            else {
2285                                                    query.append(_FINDER_COLUMN_G_A_V_E_E_L_LANGUAGEID_2);
2286                                            }
2287                                    }
2288    
2289                                    String sql = query.toString();
2290    
2291                                    Query q = session.createQuery(sql);
2292    
2293                                    QueryPos qPos = QueryPos.getInstance(q);
2294    
2295                                    qPos.add(groupId);
2296    
2297                                    if (articleId != null) {
2298                                            qPos.add(articleId);
2299                                    }
2300    
2301                                    qPos.add(version);
2302    
2303                                    if (elInstanceId != null) {
2304                                            qPos.add(elInstanceId);
2305                                    }
2306    
2307                                    if (elName != null) {
2308                                            qPos.add(elName);
2309                                    }
2310    
2311                                    if (languageId != null) {
2312                                            qPos.add(languageId);
2313                                    }
2314    
2315                                    count = (Long)q.uniqueResult();
2316                            }
2317                            catch (Exception e) {
2318                                    throw processException(e);
2319                            }
2320                            finally {
2321                                    if (count == null) {
2322                                            count = Long.valueOf(0);
2323                                    }
2324    
2325                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_A_V_E_E_L,
2326                                            finderArgs, count);
2327    
2328                                    closeSession(session);
2329                            }
2330                    }
2331    
2332                    return count.intValue();
2333            }
2334    
2335            /**
2336             * Counts all the journal article images.
2337             *
2338             * @return the number of journal article images
2339             * @throws SystemException if a system exception occurred
2340             */
2341            public int countAll() throws SystemException {
2342                    Object[] finderArgs = new Object[0];
2343    
2344                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2345                                    finderArgs, this);
2346    
2347                    if (count == null) {
2348                            Session session = null;
2349    
2350                            try {
2351                                    session = openSession();
2352    
2353                                    Query q = session.createQuery(_SQL_COUNT_JOURNALARTICLEIMAGE);
2354    
2355                                    count = (Long)q.uniqueResult();
2356                            }
2357                            catch (Exception e) {
2358                                    throw processException(e);
2359                            }
2360                            finally {
2361                                    if (count == null) {
2362                                            count = Long.valueOf(0);
2363                                    }
2364    
2365                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2366                                            count);
2367    
2368                                    closeSession(session);
2369                            }
2370                    }
2371    
2372                    return count.intValue();
2373            }
2374    
2375            /**
2376             * Initializes the journal article image persistence.
2377             */
2378            public void afterPropertiesSet() {
2379                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2380                                            com.liferay.portal.util.PropsUtil.get(
2381                                                    "value.object.listener.com.liferay.portlet.journal.model.JournalArticleImage")));
2382    
2383                    if (listenerClassNames.length > 0) {
2384                            try {
2385                                    List<ModelListener<JournalArticleImage>> listenersList = new ArrayList<ModelListener<JournalArticleImage>>();
2386    
2387                                    for (String listenerClassName : listenerClassNames) {
2388                                            listenersList.add((ModelListener<JournalArticleImage>)InstanceFactory.newInstance(
2389                                                            listenerClassName));
2390                                    }
2391    
2392                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2393                            }
2394                            catch (Exception e) {
2395                                    _log.error(e);
2396                            }
2397                    }
2398            }
2399    
2400            @BeanReference(type = JournalArticlePersistence.class)
2401            protected JournalArticlePersistence journalArticlePersistence;
2402            @BeanReference(type = JournalArticleImagePersistence.class)
2403            protected JournalArticleImagePersistence journalArticleImagePersistence;
2404            @BeanReference(type = JournalArticleResourcePersistence.class)
2405            protected JournalArticleResourcePersistence journalArticleResourcePersistence;
2406            @BeanReference(type = JournalContentSearchPersistence.class)
2407            protected JournalContentSearchPersistence journalContentSearchPersistence;
2408            @BeanReference(type = JournalFeedPersistence.class)
2409            protected JournalFeedPersistence journalFeedPersistence;
2410            @BeanReference(type = JournalStructurePersistence.class)
2411            protected JournalStructurePersistence journalStructurePersistence;
2412            @BeanReference(type = JournalTemplatePersistence.class)
2413            protected JournalTemplatePersistence journalTemplatePersistence;
2414            @BeanReference(type = ImagePersistence.class)
2415            protected ImagePersistence imagePersistence;
2416            @BeanReference(type = ResourcePersistence.class)
2417            protected ResourcePersistence resourcePersistence;
2418            @BeanReference(type = UserPersistence.class)
2419            protected UserPersistence userPersistence;
2420            private static final String _SQL_SELECT_JOURNALARTICLEIMAGE = "SELECT journalArticleImage FROM JournalArticleImage journalArticleImage";
2421            private static final String _SQL_SELECT_JOURNALARTICLEIMAGE_WHERE = "SELECT journalArticleImage FROM JournalArticleImage journalArticleImage WHERE ";
2422            private static final String _SQL_COUNT_JOURNALARTICLEIMAGE = "SELECT COUNT(journalArticleImage) FROM JournalArticleImage journalArticleImage";
2423            private static final String _SQL_COUNT_JOURNALARTICLEIMAGE_WHERE = "SELECT COUNT(journalArticleImage) FROM JournalArticleImage journalArticleImage WHERE ";
2424            private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "journalArticleImage.groupId = ?";
2425            private static final String _FINDER_COLUMN_TEMPIMAGE_TEMPIMAGE_2 = "journalArticleImage.tempImage = ?";
2426            private static final String _FINDER_COLUMN_G_A_V_GROUPID_2 = "journalArticleImage.groupId = ? AND ";
2427            private static final String _FINDER_COLUMN_G_A_V_ARTICLEID_1 = "journalArticleImage.articleId IS NULL AND ";
2428            private static final String _FINDER_COLUMN_G_A_V_ARTICLEID_2 = "journalArticleImage.articleId = ? AND ";
2429            private static final String _FINDER_COLUMN_G_A_V_ARTICLEID_3 = "(journalArticleImage.articleId IS NULL OR journalArticleImage.articleId = ?) AND ";
2430            private static final String _FINDER_COLUMN_G_A_V_VERSION_2 = "journalArticleImage.version = ?";
2431            private static final String _FINDER_COLUMN_G_A_V_E_E_L_GROUPID_2 = "journalArticleImage.groupId = ? AND ";
2432            private static final String _FINDER_COLUMN_G_A_V_E_E_L_ARTICLEID_1 = "journalArticleImage.articleId IS NULL AND ";
2433            private static final String _FINDER_COLUMN_G_A_V_E_E_L_ARTICLEID_2 = "journalArticleImage.articleId = ? AND ";
2434            private static final String _FINDER_COLUMN_G_A_V_E_E_L_ARTICLEID_3 = "(journalArticleImage.articleId IS NULL OR journalArticleImage.articleId = ?) AND ";
2435            private static final String _FINDER_COLUMN_G_A_V_E_E_L_VERSION_2 = "journalArticleImage.version = ? AND ";
2436            private static final String _FINDER_COLUMN_G_A_V_E_E_L_ELINSTANCEID_1 = "journalArticleImage.elInstanceId IS NULL AND ";
2437            private static final String _FINDER_COLUMN_G_A_V_E_E_L_ELINSTANCEID_2 = "journalArticleImage.elInstanceId = ? AND ";
2438            private static final String _FINDER_COLUMN_G_A_V_E_E_L_ELINSTANCEID_3 = "(journalArticleImage.elInstanceId IS NULL OR journalArticleImage.elInstanceId = ?) AND ";
2439            private static final String _FINDER_COLUMN_G_A_V_E_E_L_ELNAME_1 = "journalArticleImage.elName IS NULL AND ";
2440            private static final String _FINDER_COLUMN_G_A_V_E_E_L_ELNAME_2 = "journalArticleImage.elName = ? AND ";
2441            private static final String _FINDER_COLUMN_G_A_V_E_E_L_ELNAME_3 = "(journalArticleImage.elName IS NULL OR journalArticleImage.elName = ?) AND ";
2442            private static final String _FINDER_COLUMN_G_A_V_E_E_L_LANGUAGEID_1 = "journalArticleImage.languageId IS NULL";
2443            private static final String _FINDER_COLUMN_G_A_V_E_E_L_LANGUAGEID_2 = "journalArticleImage.languageId = ?";
2444            private static final String _FINDER_COLUMN_G_A_V_E_E_L_LANGUAGEID_3 = "(journalArticleImage.languageId IS NULL OR journalArticleImage.languageId = ?)";
2445            private static final String _ORDER_BY_ENTITY_ALIAS = "journalArticleImage.";
2446            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No JournalArticleImage exists with the primary key ";
2447            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No JournalArticleImage exists with the key {";
2448            private static Log _log = LogFactoryUtil.getLog(JournalArticleImagePersistenceImpl.class);
2449    }