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