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