1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.imagegallery.service.persistence;
24  
25  import com.liferay.portal.SystemException;
26  import com.liferay.portal.kernel.annotation.BeanReference;
27  import com.liferay.portal.kernel.cache.CacheRegistry;
28  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
29  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
30  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
31  import com.liferay.portal.kernel.dao.orm.FinderPath;
32  import com.liferay.portal.kernel.dao.orm.Query;
33  import com.liferay.portal.kernel.dao.orm.QueryPos;
34  import com.liferay.portal.kernel.dao.orm.QueryUtil;
35  import com.liferay.portal.kernel.dao.orm.Session;
36  import com.liferay.portal.kernel.log.Log;
37  import com.liferay.portal.kernel.log.LogFactoryUtil;
38  import com.liferay.portal.kernel.util.GetterUtil;
39  import com.liferay.portal.kernel.util.OrderByComparator;
40  import com.liferay.portal.kernel.util.StringPool;
41  import com.liferay.portal.kernel.util.StringUtil;
42  import com.liferay.portal.kernel.util.Validator;
43  import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
44  import com.liferay.portal.model.ModelListener;
45  import com.liferay.portal.service.persistence.BatchSessionUtil;
46  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
47  
48  import com.liferay.portlet.imagegallery.NoSuchImageException;
49  import com.liferay.portlet.imagegallery.model.IGImage;
50  import com.liferay.portlet.imagegallery.model.impl.IGImageImpl;
51  import com.liferay.portlet.imagegallery.model.impl.IGImageModelImpl;
52  
53  import java.util.ArrayList;
54  import java.util.Collections;
55  import java.util.List;
56  
57  /**
58   * <a href="IGImagePersistenceImpl.java.html"><b><i>View Source</i></b></a>
59   *
60   * @author Brian Wing Shun Chan
61   *
62   */
63  public class IGImagePersistenceImpl extends BasePersistenceImpl
64      implements IGImagePersistence {
65      public static final String FINDER_CLASS_NAME_ENTITY = IGImageImpl.class.getName();
66      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
67          ".List";
68      public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
69              IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
70              "findByUuid", new String[] { String.class.getName() });
71      public static final FinderPath FINDER_PATH_FIND_BY_OBC_UUID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
72              IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
73              "findByUuid",
74              new String[] {
75                  String.class.getName(),
76                  
77              "java.lang.Integer", "java.lang.Integer",
78                  "com.liferay.portal.kernel.util.OrderByComparator"
79              });
80      public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
81              IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
82              "countByUuid", new String[] { String.class.getName() });
83      public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
84              IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
85              "fetchByUUID_G",
86              new String[] { String.class.getName(), Long.class.getName() });
87      public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
88              IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
89              "countByUUID_G",
90              new String[] { String.class.getName(), Long.class.getName() });
91      public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
92              IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
93              "findByGroupId", new String[] { Long.class.getName() });
94      public static final FinderPath FINDER_PATH_FIND_BY_OBC_GROUPID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
95              IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
96              "findByGroupId",
97              new String[] {
98                  Long.class.getName(),
99                  
100             "java.lang.Integer", "java.lang.Integer",
101                 "com.liferay.portal.kernel.util.OrderByComparator"
102             });
103     public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
104             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
105             "countByGroupId", new String[] { Long.class.getName() });
106     public static final FinderPath FINDER_PATH_FIND_BY_FOLDERID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
107             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
108             "findByFolderId", new String[] { Long.class.getName() });
109     public static final FinderPath FINDER_PATH_FIND_BY_OBC_FOLDERID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
110             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
111             "findByFolderId",
112             new String[] {
113                 Long.class.getName(),
114                 
115             "java.lang.Integer", "java.lang.Integer",
116                 "com.liferay.portal.kernel.util.OrderByComparator"
117             });
118     public static final FinderPath FINDER_PATH_COUNT_BY_FOLDERID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
119             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
120             "countByFolderId", new String[] { Long.class.getName() });
121     public static final FinderPath FINDER_PATH_FETCH_BY_SMALLIMAGEID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
122             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
123             "fetchBySmallImageId", new String[] { Long.class.getName() });
124     public static final FinderPath FINDER_PATH_COUNT_BY_SMALLIMAGEID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
125             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
126             "countBySmallImageId", new String[] { Long.class.getName() });
127     public static final FinderPath FINDER_PATH_FETCH_BY_LARGEIMAGEID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
128             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
129             "fetchByLargeImageId", new String[] { Long.class.getName() });
130     public static final FinderPath FINDER_PATH_COUNT_BY_LARGEIMAGEID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
131             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
132             "countByLargeImageId", new String[] { Long.class.getName() });
133     public static final FinderPath FINDER_PATH_FETCH_BY_CUSTOM1IMAGEID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
134             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
135             "fetchByCustom1ImageId", new String[] { Long.class.getName() });
136     public static final FinderPath FINDER_PATH_COUNT_BY_CUSTOM1IMAGEID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
137             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
138             "countByCustom1ImageId", new String[] { Long.class.getName() });
139     public static final FinderPath FINDER_PATH_FETCH_BY_CUSTOM2IMAGEID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
140             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
141             "fetchByCustom2ImageId", new String[] { Long.class.getName() });
142     public static final FinderPath FINDER_PATH_COUNT_BY_CUSTOM2IMAGEID = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
143             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
144             "countByCustom2ImageId", new String[] { Long.class.getName() });
145     public static final FinderPath FINDER_PATH_FIND_BY_G_U = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
146             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
147             "findByG_U",
148             new String[] { Long.class.getName(), Long.class.getName() });
149     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_U = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
150             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
151             "findByG_U",
152             new String[] {
153                 Long.class.getName(), Long.class.getName(),
154                 
155             "java.lang.Integer", "java.lang.Integer",
156                 "com.liferay.portal.kernel.util.OrderByComparator"
157             });
158     public static final FinderPath FINDER_PATH_COUNT_BY_G_U = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
159             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
160             "countByG_U",
161             new String[] { Long.class.getName(), Long.class.getName() });
162     public static final FinderPath FINDER_PATH_FIND_BY_F_N = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
163             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
164             "findByF_N",
165             new String[] { Long.class.getName(), String.class.getName() });
166     public static final FinderPath FINDER_PATH_FIND_BY_OBC_F_N = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
167             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
168             "findByF_N",
169             new String[] {
170                 Long.class.getName(), String.class.getName(),
171                 
172             "java.lang.Integer", "java.lang.Integer",
173                 "com.liferay.portal.kernel.util.OrderByComparator"
174             });
175     public static final FinderPath FINDER_PATH_COUNT_BY_F_N = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
176             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
177             "countByF_N",
178             new String[] { Long.class.getName(), String.class.getName() });
179     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
180             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
181             "findAll", new String[0]);
182     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(IGImageModelImpl.ENTITY_CACHE_ENABLED,
183             IGImageModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
184             "countAll", new String[0]);
185 
186     public void cacheResult(IGImage igImage) {
187         EntityCacheUtil.putResult(IGImageModelImpl.ENTITY_CACHE_ENABLED,
188             IGImageImpl.class, igImage.getPrimaryKey(), igImage);
189 
190         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
191             new Object[] { igImage.getUuid(), new Long(igImage.getGroupId()) },
192             igImage);
193 
194         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
195             new Object[] { new Long(igImage.getSmallImageId()) }, igImage);
196 
197         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
198             new Object[] { new Long(igImage.getLargeImageId()) }, igImage);
199 
200         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CUSTOM1IMAGEID,
201             new Object[] { new Long(igImage.getCustom1ImageId()) }, igImage);
202 
203         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CUSTOM2IMAGEID,
204             new Object[] { new Long(igImage.getCustom2ImageId()) }, igImage);
205     }
206 
207     public void cacheResult(List<IGImage> igImages) {
208         for (IGImage igImage : igImages) {
209             if (EntityCacheUtil.getResult(
210                         IGImageModelImpl.ENTITY_CACHE_ENABLED,
211                         IGImageImpl.class, igImage.getPrimaryKey(), this) == null) {
212                 cacheResult(igImage);
213             }
214         }
215     }
216 
217     public void clearCache() {
218         CacheRegistry.clear(IGImageImpl.class.getName());
219         EntityCacheUtil.clearCache(IGImageImpl.class.getName());
220         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
221         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
222     }
223 
224     public IGImage create(long imageId) {
225         IGImage igImage = new IGImageImpl();
226 
227         igImage.setNew(true);
228         igImage.setPrimaryKey(imageId);
229 
230         String uuid = PortalUUIDUtil.generate();
231 
232         igImage.setUuid(uuid);
233 
234         return igImage;
235     }
236 
237     public IGImage remove(long imageId)
238         throws NoSuchImageException, SystemException {
239         Session session = null;
240 
241         try {
242             session = openSession();
243 
244             IGImage igImage = (IGImage)session.get(IGImageImpl.class,
245                     new Long(imageId));
246 
247             if (igImage == null) {
248                 if (_log.isWarnEnabled()) {
249                     _log.warn("No IGImage exists with the primary key " +
250                         imageId);
251                 }
252 
253                 throw new NoSuchImageException(
254                     "No IGImage exists with the primary key " + imageId);
255             }
256 
257             return remove(igImage);
258         }
259         catch (NoSuchImageException nsee) {
260             throw nsee;
261         }
262         catch (Exception e) {
263             throw processException(e);
264         }
265         finally {
266             closeSession(session);
267         }
268     }
269 
270     public IGImage remove(IGImage igImage) throws SystemException {
271         for (ModelListener<IGImage> listener : listeners) {
272             listener.onBeforeRemove(igImage);
273         }
274 
275         igImage = removeImpl(igImage);
276 
277         for (ModelListener<IGImage> listener : listeners) {
278             listener.onAfterRemove(igImage);
279         }
280 
281         return igImage;
282     }
283 
284     protected IGImage removeImpl(IGImage igImage) throws SystemException {
285         Session session = null;
286 
287         try {
288             session = openSession();
289 
290             if (igImage.isCachedModel() || BatchSessionUtil.isEnabled()) {
291                 Object staleObject = session.get(IGImageImpl.class,
292                         igImage.getPrimaryKeyObj());
293 
294                 if (staleObject != null) {
295                     session.evict(staleObject);
296                 }
297             }
298 
299             session.delete(igImage);
300 
301             session.flush();
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         IGImageModelImpl igImageModelImpl = (IGImageModelImpl)igImage;
313 
314         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
315             new Object[] {
316                 igImageModelImpl.getOriginalUuid(),
317                 new Long(igImageModelImpl.getOriginalGroupId())
318             });
319 
320         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
321             new Object[] { new Long(igImageModelImpl.getOriginalSmallImageId()) });
322 
323         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
324             new Object[] { new Long(igImageModelImpl.getOriginalLargeImageId()) });
325 
326         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CUSTOM1IMAGEID,
327             new Object[] { new Long(igImageModelImpl.getOriginalCustom1ImageId()) });
328 
329         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CUSTOM2IMAGEID,
330             new Object[] { new Long(igImageModelImpl.getOriginalCustom2ImageId()) });
331 
332         EntityCacheUtil.removeResult(IGImageModelImpl.ENTITY_CACHE_ENABLED,
333             IGImageImpl.class, igImage.getPrimaryKey());
334 
335         return igImage;
336     }
337 
338     /**
339      * @deprecated Use <code>update(IGImage igImage, boolean merge)</code>.
340      */
341     public IGImage update(IGImage igImage) throws SystemException {
342         if (_log.isWarnEnabled()) {
343             _log.warn(
344                 "Using the deprecated update(IGImage igImage) method. Use update(IGImage igImage, boolean merge) instead.");
345         }
346 
347         return update(igImage, false);
348     }
349 
350     /**
351      * Add, update, or merge, the entity. This method also calls the model
352      * listeners to trigger the proper events associated with adding, deleting,
353      * or updating an entity.
354      *
355      * @param        igImage the entity to add, update, or merge
356      * @param        merge boolean value for whether to merge the entity. The
357      *                default value is false. Setting merge to true is more
358      *                expensive and should only be true when igImage is
359      *                transient. See LEP-5473 for a detailed discussion of this
360      *                method.
361      * @return        true if the portlet can be displayed via Ajax
362      */
363     public IGImage update(IGImage igImage, boolean merge)
364         throws SystemException {
365         boolean isNew = igImage.isNew();
366 
367         for (ModelListener<IGImage> listener : listeners) {
368             if (isNew) {
369                 listener.onBeforeCreate(igImage);
370             }
371             else {
372                 listener.onBeforeUpdate(igImage);
373             }
374         }
375 
376         igImage = updateImpl(igImage, merge);
377 
378         for (ModelListener<IGImage> listener : listeners) {
379             if (isNew) {
380                 listener.onAfterCreate(igImage);
381             }
382             else {
383                 listener.onAfterUpdate(igImage);
384             }
385         }
386 
387         return igImage;
388     }
389 
390     public IGImage updateImpl(
391         com.liferay.portlet.imagegallery.model.IGImage igImage, boolean merge)
392         throws SystemException {
393         boolean isNew = igImage.isNew();
394 
395         IGImageModelImpl igImageModelImpl = (IGImageModelImpl)igImage;
396 
397         if (Validator.isNull(igImage.getUuid())) {
398             String uuid = PortalUUIDUtil.generate();
399 
400             igImage.setUuid(uuid);
401         }
402 
403         Session session = null;
404 
405         try {
406             session = openSession();
407 
408             BatchSessionUtil.update(session, igImage, merge);
409 
410             igImage.setNew(false);
411         }
412         catch (Exception e) {
413             throw processException(e);
414         }
415         finally {
416             closeSession(session);
417         }
418 
419         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
420 
421         EntityCacheUtil.putResult(IGImageModelImpl.ENTITY_CACHE_ENABLED,
422             IGImageImpl.class, igImage.getPrimaryKey(), igImage);
423 
424         if (!isNew &&
425                 (!Validator.equals(igImage.getUuid(),
426                     igImageModelImpl.getOriginalUuid()) ||
427                 (igImage.getGroupId() != igImageModelImpl.getOriginalGroupId()))) {
428             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
429                 new Object[] {
430                     igImageModelImpl.getOriginalUuid(),
431                     new Long(igImageModelImpl.getOriginalGroupId())
432                 });
433         }
434 
435         if (isNew ||
436                 (!Validator.equals(igImage.getUuid(),
437                     igImageModelImpl.getOriginalUuid()) ||
438                 (igImage.getGroupId() != igImageModelImpl.getOriginalGroupId()))) {
439             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
440                 new Object[] { igImage.getUuid(), new Long(igImage.getGroupId()) },
441                 igImage);
442         }
443 
444         if (!isNew &&
445                 (igImage.getSmallImageId() != igImageModelImpl.getOriginalSmallImageId())) {
446             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
447                 new Object[] {
448                     new Long(igImageModelImpl.getOriginalSmallImageId())
449                 });
450         }
451 
452         if (isNew ||
453                 (igImage.getSmallImageId() != igImageModelImpl.getOriginalSmallImageId())) {
454             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
455                 new Object[] { new Long(igImage.getSmallImageId()) }, igImage);
456         }
457 
458         if (!isNew &&
459                 (igImage.getLargeImageId() != igImageModelImpl.getOriginalLargeImageId())) {
460             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
461                 new Object[] {
462                     new Long(igImageModelImpl.getOriginalLargeImageId())
463                 });
464         }
465 
466         if (isNew ||
467                 (igImage.getLargeImageId() != igImageModelImpl.getOriginalLargeImageId())) {
468             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
469                 new Object[] { new Long(igImage.getLargeImageId()) }, igImage);
470         }
471 
472         if (!isNew &&
473                 (igImage.getCustom1ImageId() != igImageModelImpl.getOriginalCustom1ImageId())) {
474             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CUSTOM1IMAGEID,
475                 new Object[] {
476                     new Long(igImageModelImpl.getOriginalCustom1ImageId())
477                 });
478         }
479 
480         if (isNew ||
481                 (igImage.getCustom1ImageId() != igImageModelImpl.getOriginalCustom1ImageId())) {
482             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CUSTOM1IMAGEID,
483                 new Object[] { new Long(igImage.getCustom1ImageId()) }, igImage);
484         }
485 
486         if (!isNew &&
487                 (igImage.getCustom2ImageId() != igImageModelImpl.getOriginalCustom2ImageId())) {
488             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_CUSTOM2IMAGEID,
489                 new Object[] {
490                     new Long(igImageModelImpl.getOriginalCustom2ImageId())
491                 });
492         }
493 
494         if (isNew ||
495                 (igImage.getCustom2ImageId() != igImageModelImpl.getOriginalCustom2ImageId())) {
496             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CUSTOM2IMAGEID,
497                 new Object[] { new Long(igImage.getCustom2ImageId()) }, igImage);
498         }
499 
500         return igImage;
501     }
502 
503     public IGImage findByPrimaryKey(long imageId)
504         throws NoSuchImageException, SystemException {
505         IGImage igImage = fetchByPrimaryKey(imageId);
506 
507         if (igImage == null) {
508             if (_log.isWarnEnabled()) {
509                 _log.warn("No IGImage exists with the primary key " + imageId);
510             }
511 
512             throw new NoSuchImageException(
513                 "No IGImage exists with the primary key " + imageId);
514         }
515 
516         return igImage;
517     }
518 
519     public IGImage fetchByPrimaryKey(long imageId) throws SystemException {
520         IGImage igImage = (IGImage)EntityCacheUtil.getResult(IGImageModelImpl.ENTITY_CACHE_ENABLED,
521                 IGImageImpl.class, imageId, this);
522 
523         if (igImage == null) {
524             Session session = null;
525 
526             try {
527                 session = openSession();
528 
529                 igImage = (IGImage)session.get(IGImageImpl.class,
530                         new Long(imageId));
531             }
532             catch (Exception e) {
533                 throw processException(e);
534             }
535             finally {
536                 if (igImage != null) {
537                     cacheResult(igImage);
538                 }
539 
540                 closeSession(session);
541             }
542         }
543 
544         return igImage;
545     }
546 
547     public List<IGImage> findByUuid(String uuid) throws SystemException {
548         Object[] finderArgs = new Object[] { uuid };
549 
550         List<IGImage> list = (List<IGImage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
551                 finderArgs, this);
552 
553         if (list == null) {
554             Session session = null;
555 
556             try {
557                 session = openSession();
558 
559                 StringBuilder query = new StringBuilder();
560 
561                 query.append(
562                     "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
563 
564                 if (uuid == null) {
565                     query.append("uuid_ IS NULL");
566                 }
567                 else {
568                     query.append("uuid_ = ?");
569                 }
570 
571                 query.append(" ");
572 
573                 query.append("ORDER BY ");
574 
575                 query.append("imageId ASC");
576 
577                 Query q = session.createQuery(query.toString());
578 
579                 QueryPos qPos = QueryPos.getInstance(q);
580 
581                 if (uuid != null) {
582                     qPos.add(uuid);
583                 }
584 
585                 list = q.list();
586             }
587             catch (Exception e) {
588                 throw processException(e);
589             }
590             finally {
591                 if (list == null) {
592                     list = new ArrayList<IGImage>();
593                 }
594 
595                 cacheResult(list);
596 
597                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
598                     list);
599 
600                 closeSession(session);
601             }
602         }
603 
604         return list;
605     }
606 
607     public List<IGImage> findByUuid(String uuid, int start, int end)
608         throws SystemException {
609         return findByUuid(uuid, start, end, null);
610     }
611 
612     public List<IGImage> findByUuid(String uuid, int start, int end,
613         OrderByComparator obc) throws SystemException {
614         Object[] finderArgs = new Object[] {
615                 uuid,
616                 
617                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
618             };
619 
620         List<IGImage> list = (List<IGImage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_UUID,
621                 finderArgs, this);
622 
623         if (list == null) {
624             Session session = null;
625 
626             try {
627                 session = openSession();
628 
629                 StringBuilder query = new StringBuilder();
630 
631                 query.append(
632                     "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
633 
634                 if (uuid == null) {
635                     query.append("uuid_ IS NULL");
636                 }
637                 else {
638                     query.append("uuid_ = ?");
639                 }
640 
641                 query.append(" ");
642 
643                 if (obc != null) {
644                     query.append("ORDER BY ");
645                     query.append(obc.getOrderBy());
646                 }
647 
648                 else {
649                     query.append("ORDER BY ");
650 
651                     query.append("imageId ASC");
652                 }
653 
654                 Query q = session.createQuery(query.toString());
655 
656                 QueryPos qPos = QueryPos.getInstance(q);
657 
658                 if (uuid != null) {
659                     qPos.add(uuid);
660                 }
661 
662                 list = (List<IGImage>)QueryUtil.list(q, getDialect(), start, end);
663             }
664             catch (Exception e) {
665                 throw processException(e);
666             }
667             finally {
668                 if (list == null) {
669                     list = new ArrayList<IGImage>();
670                 }
671 
672                 cacheResult(list);
673 
674                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_UUID,
675                     finderArgs, list);
676 
677                 closeSession(session);
678             }
679         }
680 
681         return list;
682     }
683 
684     public IGImage findByUuid_First(String uuid, OrderByComparator obc)
685         throws NoSuchImageException, SystemException {
686         List<IGImage> list = findByUuid(uuid, 0, 1, obc);
687 
688         if (list.isEmpty()) {
689             StringBuilder msg = new StringBuilder();
690 
691             msg.append("No IGImage exists with the key {");
692 
693             msg.append("uuid=" + uuid);
694 
695             msg.append(StringPool.CLOSE_CURLY_BRACE);
696 
697             throw new NoSuchImageException(msg.toString());
698         }
699         else {
700             return list.get(0);
701         }
702     }
703 
704     public IGImage findByUuid_Last(String uuid, OrderByComparator obc)
705         throws NoSuchImageException, SystemException {
706         int count = countByUuid(uuid);
707 
708         List<IGImage> list = findByUuid(uuid, count - 1, count, obc);
709 
710         if (list.isEmpty()) {
711             StringBuilder msg = new StringBuilder();
712 
713             msg.append("No IGImage exists with the key {");
714 
715             msg.append("uuid=" + uuid);
716 
717             msg.append(StringPool.CLOSE_CURLY_BRACE);
718 
719             throw new NoSuchImageException(msg.toString());
720         }
721         else {
722             return list.get(0);
723         }
724     }
725 
726     public IGImage[] findByUuid_PrevAndNext(long imageId, String uuid,
727         OrderByComparator obc) throws NoSuchImageException, SystemException {
728         IGImage igImage = findByPrimaryKey(imageId);
729 
730         int count = countByUuid(uuid);
731 
732         Session session = null;
733 
734         try {
735             session = openSession();
736 
737             StringBuilder query = new StringBuilder();
738 
739             query.append(
740                 "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
741 
742             if (uuid == null) {
743                 query.append("uuid_ IS NULL");
744             }
745             else {
746                 query.append("uuid_ = ?");
747             }
748 
749             query.append(" ");
750 
751             if (obc != null) {
752                 query.append("ORDER BY ");
753                 query.append(obc.getOrderBy());
754             }
755 
756             else {
757                 query.append("ORDER BY ");
758 
759                 query.append("imageId ASC");
760             }
761 
762             Query q = session.createQuery(query.toString());
763 
764             QueryPos qPos = QueryPos.getInstance(q);
765 
766             if (uuid != null) {
767                 qPos.add(uuid);
768             }
769 
770             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, igImage);
771 
772             IGImage[] array = new IGImageImpl[3];
773 
774             array[0] = (IGImage)objArray[0];
775             array[1] = (IGImage)objArray[1];
776             array[2] = (IGImage)objArray[2];
777 
778             return array;
779         }
780         catch (Exception e) {
781             throw processException(e);
782         }
783         finally {
784             closeSession(session);
785         }
786     }
787 
788     public IGImage findByUUID_G(String uuid, long groupId)
789         throws NoSuchImageException, SystemException {
790         IGImage igImage = fetchByUUID_G(uuid, groupId);
791 
792         if (igImage == null) {
793             StringBuilder msg = new StringBuilder();
794 
795             msg.append("No IGImage exists with the key {");
796 
797             msg.append("uuid=" + uuid);
798 
799             msg.append(", ");
800             msg.append("groupId=" + groupId);
801 
802             msg.append(StringPool.CLOSE_CURLY_BRACE);
803 
804             if (_log.isWarnEnabled()) {
805                 _log.warn(msg.toString());
806             }
807 
808             throw new NoSuchImageException(msg.toString());
809         }
810 
811         return igImage;
812     }
813 
814     public IGImage fetchByUUID_G(String uuid, long groupId)
815         throws SystemException {
816         return fetchByUUID_G(uuid, groupId, true);
817     }
818 
819     public IGImage fetchByUUID_G(String uuid, long groupId,
820         boolean retrieveFromCache) throws SystemException {
821         Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
822 
823         Object result = null;
824 
825         if (retrieveFromCache) {
826             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
827                     finderArgs, this);
828         }
829 
830         if (result == null) {
831             Session session = null;
832 
833             try {
834                 session = openSession();
835 
836                 StringBuilder query = new StringBuilder();
837 
838                 query.append(
839                     "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
840 
841                 if (uuid == null) {
842                     query.append("uuid_ IS NULL");
843                 }
844                 else {
845                     query.append("uuid_ = ?");
846                 }
847 
848                 query.append(" AND ");
849 
850                 query.append("groupId = ?");
851 
852                 query.append(" ");
853 
854                 query.append("ORDER BY ");
855 
856                 query.append("imageId ASC");
857 
858                 Query q = session.createQuery(query.toString());
859 
860                 QueryPos qPos = QueryPos.getInstance(q);
861 
862                 if (uuid != null) {
863                     qPos.add(uuid);
864                 }
865 
866                 qPos.add(groupId);
867 
868                 List<IGImage> list = q.list();
869 
870                 result = list;
871 
872                 IGImage igImage = null;
873 
874                 if (list.isEmpty()) {
875                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
876                         finderArgs, list);
877                 }
878                 else {
879                     igImage = list.get(0);
880 
881                     cacheResult(igImage);
882 
883                     if ((igImage.getUuid() == null) ||
884                             !igImage.getUuid().equals(uuid) ||
885                             (igImage.getGroupId() != groupId)) {
886                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
887                             finderArgs, igImage);
888                     }
889                 }
890 
891                 return igImage;
892             }
893             catch (Exception e) {
894                 throw processException(e);
895             }
896             finally {
897                 if (result == null) {
898                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
899                         finderArgs, new ArrayList<IGImage>());
900                 }
901 
902                 closeSession(session);
903             }
904         }
905         else {
906             if (result instanceof List) {
907                 return null;
908             }
909             else {
910                 return (IGImage)result;
911             }
912         }
913     }
914 
915     public List<IGImage> findByGroupId(long groupId) throws SystemException {
916         Object[] finderArgs = new Object[] { new Long(groupId) };
917 
918         List<IGImage> list = (List<IGImage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
919                 finderArgs, this);
920 
921         if (list == null) {
922             Session session = null;
923 
924             try {
925                 session = openSession();
926 
927                 StringBuilder query = new StringBuilder();
928 
929                 query.append(
930                     "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
931 
932                 query.append("groupId = ?");
933 
934                 query.append(" ");
935 
936                 query.append("ORDER BY ");
937 
938                 query.append("imageId ASC");
939 
940                 Query q = session.createQuery(query.toString());
941 
942                 QueryPos qPos = QueryPos.getInstance(q);
943 
944                 qPos.add(groupId);
945 
946                 list = q.list();
947             }
948             catch (Exception e) {
949                 throw processException(e);
950             }
951             finally {
952                 if (list == null) {
953                     list = new ArrayList<IGImage>();
954                 }
955 
956                 cacheResult(list);
957 
958                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
959                     finderArgs, list);
960 
961                 closeSession(session);
962             }
963         }
964 
965         return list;
966     }
967 
968     public List<IGImage> findByGroupId(long groupId, int start, int end)
969         throws SystemException {
970         return findByGroupId(groupId, start, end, null);
971     }
972 
973     public List<IGImage> findByGroupId(long groupId, int start, int end,
974         OrderByComparator obc) throws SystemException {
975         Object[] finderArgs = new Object[] {
976                 new Long(groupId),
977                 
978                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
979             };
980 
981         List<IGImage> list = (List<IGImage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
982                 finderArgs, this);
983 
984         if (list == null) {
985             Session session = null;
986 
987             try {
988                 session = openSession();
989 
990                 StringBuilder query = new StringBuilder();
991 
992                 query.append(
993                     "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
994 
995                 query.append("groupId = ?");
996 
997                 query.append(" ");
998 
999                 if (obc != null) {
1000                    query.append("ORDER BY ");
1001                    query.append(obc.getOrderBy());
1002                }
1003
1004                else {
1005                    query.append("ORDER BY ");
1006
1007                    query.append("imageId ASC");
1008                }
1009
1010                Query q = session.createQuery(query.toString());
1011
1012                QueryPos qPos = QueryPos.getInstance(q);
1013
1014                qPos.add(groupId);
1015
1016                list = (List<IGImage>)QueryUtil.list(q, getDialect(), start, end);
1017            }
1018            catch (Exception e) {
1019                throw processException(e);
1020            }
1021            finally {
1022                if (list == null) {
1023                    list = new ArrayList<IGImage>();
1024                }
1025
1026                cacheResult(list);
1027
1028                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
1029                    finderArgs, list);
1030
1031                closeSession(session);
1032            }
1033        }
1034
1035        return list;
1036    }
1037
1038    public IGImage findByGroupId_First(long groupId, OrderByComparator obc)
1039        throws NoSuchImageException, SystemException {
1040        List<IGImage> list = findByGroupId(groupId, 0, 1, obc);
1041
1042        if (list.isEmpty()) {
1043            StringBuilder msg = new StringBuilder();
1044
1045            msg.append("No IGImage exists with the key {");
1046
1047            msg.append("groupId=" + groupId);
1048
1049            msg.append(StringPool.CLOSE_CURLY_BRACE);
1050
1051            throw new NoSuchImageException(msg.toString());
1052        }
1053        else {
1054            return list.get(0);
1055        }
1056    }
1057
1058    public IGImage findByGroupId_Last(long groupId, OrderByComparator obc)
1059        throws NoSuchImageException, SystemException {
1060        int count = countByGroupId(groupId);
1061
1062        List<IGImage> list = findByGroupId(groupId, count - 1, count, obc);
1063
1064        if (list.isEmpty()) {
1065            StringBuilder msg = new StringBuilder();
1066
1067            msg.append("No IGImage exists with the key {");
1068
1069            msg.append("groupId=" + groupId);
1070
1071            msg.append(StringPool.CLOSE_CURLY_BRACE);
1072
1073            throw new NoSuchImageException(msg.toString());
1074        }
1075        else {
1076            return list.get(0);
1077        }
1078    }
1079
1080    public IGImage[] findByGroupId_PrevAndNext(long imageId, long groupId,
1081        OrderByComparator obc) throws NoSuchImageException, SystemException {
1082        IGImage igImage = findByPrimaryKey(imageId);
1083
1084        int count = countByGroupId(groupId);
1085
1086        Session session = null;
1087
1088        try {
1089            session = openSession();
1090
1091            StringBuilder query = new StringBuilder();
1092
1093            query.append(
1094                "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
1095
1096            query.append("groupId = ?");
1097
1098            query.append(" ");
1099
1100            if (obc != null) {
1101                query.append("ORDER BY ");
1102                query.append(obc.getOrderBy());
1103            }
1104
1105            else {
1106                query.append("ORDER BY ");
1107
1108                query.append("imageId ASC");
1109            }
1110
1111            Query q = session.createQuery(query.toString());
1112
1113            QueryPos qPos = QueryPos.getInstance(q);
1114
1115            qPos.add(groupId);
1116
1117            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, igImage);
1118
1119            IGImage[] array = new IGImageImpl[3];
1120
1121            array[0] = (IGImage)objArray[0];
1122            array[1] = (IGImage)objArray[1];
1123            array[2] = (IGImage)objArray[2];
1124
1125            return array;
1126        }
1127        catch (Exception e) {
1128            throw processException(e);
1129        }
1130        finally {
1131            closeSession(session);
1132        }
1133    }
1134
1135    public List<IGImage> findByFolderId(long folderId)
1136        throws SystemException {
1137        Object[] finderArgs = new Object[] { new Long(folderId) };
1138
1139        List<IGImage> list = (List<IGImage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_FOLDERID,
1140                finderArgs, this);
1141
1142        if (list == null) {
1143            Session session = null;
1144
1145            try {
1146                session = openSession();
1147
1148                StringBuilder query = new StringBuilder();
1149
1150                query.append(
1151                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
1152
1153                query.append("folderId = ?");
1154
1155                query.append(" ");
1156
1157                query.append("ORDER BY ");
1158
1159                query.append("imageId ASC");
1160
1161                Query q = session.createQuery(query.toString());
1162
1163                QueryPos qPos = QueryPos.getInstance(q);
1164
1165                qPos.add(folderId);
1166
1167                list = q.list();
1168            }
1169            catch (Exception e) {
1170                throw processException(e);
1171            }
1172            finally {
1173                if (list == null) {
1174                    list = new ArrayList<IGImage>();
1175                }
1176
1177                cacheResult(list);
1178
1179                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_FOLDERID,
1180                    finderArgs, list);
1181
1182                closeSession(session);
1183            }
1184        }
1185
1186        return list;
1187    }
1188
1189    public List<IGImage> findByFolderId(long folderId, int start, int end)
1190        throws SystemException {
1191        return findByFolderId(folderId, start, end, null);
1192    }
1193
1194    public List<IGImage> findByFolderId(long folderId, int start, int end,
1195        OrderByComparator obc) throws SystemException {
1196        Object[] finderArgs = new Object[] {
1197                new Long(folderId),
1198                
1199                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1200            };
1201
1202        List<IGImage> list = (List<IGImage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_FOLDERID,
1203                finderArgs, this);
1204
1205        if (list == null) {
1206            Session session = null;
1207
1208            try {
1209                session = openSession();
1210
1211                StringBuilder query = new StringBuilder();
1212
1213                query.append(
1214                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
1215
1216                query.append("folderId = ?");
1217
1218                query.append(" ");
1219
1220                if (obc != null) {
1221                    query.append("ORDER BY ");
1222                    query.append(obc.getOrderBy());
1223                }
1224
1225                else {
1226                    query.append("ORDER BY ");
1227
1228                    query.append("imageId ASC");
1229                }
1230
1231                Query q = session.createQuery(query.toString());
1232
1233                QueryPos qPos = QueryPos.getInstance(q);
1234
1235                qPos.add(folderId);
1236
1237                list = (List<IGImage>)QueryUtil.list(q, getDialect(), start, end);
1238            }
1239            catch (Exception e) {
1240                throw processException(e);
1241            }
1242            finally {
1243                if (list == null) {
1244                    list = new ArrayList<IGImage>();
1245                }
1246
1247                cacheResult(list);
1248
1249                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_FOLDERID,
1250                    finderArgs, list);
1251
1252                closeSession(session);
1253            }
1254        }
1255
1256        return list;
1257    }
1258
1259    public IGImage findByFolderId_First(long folderId, OrderByComparator obc)
1260        throws NoSuchImageException, SystemException {
1261        List<IGImage> list = findByFolderId(folderId, 0, 1, obc);
1262
1263        if (list.isEmpty()) {
1264            StringBuilder msg = new StringBuilder();
1265
1266            msg.append("No IGImage exists with the key {");
1267
1268            msg.append("folderId=" + folderId);
1269
1270            msg.append(StringPool.CLOSE_CURLY_BRACE);
1271
1272            throw new NoSuchImageException(msg.toString());
1273        }
1274        else {
1275            return list.get(0);
1276        }
1277    }
1278
1279    public IGImage findByFolderId_Last(long folderId, OrderByComparator obc)
1280        throws NoSuchImageException, SystemException {
1281        int count = countByFolderId(folderId);
1282
1283        List<IGImage> list = findByFolderId(folderId, count - 1, count, obc);
1284
1285        if (list.isEmpty()) {
1286            StringBuilder msg = new StringBuilder();
1287
1288            msg.append("No IGImage exists with the key {");
1289
1290            msg.append("folderId=" + folderId);
1291
1292            msg.append(StringPool.CLOSE_CURLY_BRACE);
1293
1294            throw new NoSuchImageException(msg.toString());
1295        }
1296        else {
1297            return list.get(0);
1298        }
1299    }
1300
1301    public IGImage[] findByFolderId_PrevAndNext(long imageId, long folderId,
1302        OrderByComparator obc) throws NoSuchImageException, SystemException {
1303        IGImage igImage = findByPrimaryKey(imageId);
1304
1305        int count = countByFolderId(folderId);
1306
1307        Session session = null;
1308
1309        try {
1310            session = openSession();
1311
1312            StringBuilder query = new StringBuilder();
1313
1314            query.append(
1315                "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
1316
1317            query.append("folderId = ?");
1318
1319            query.append(" ");
1320
1321            if (obc != null) {
1322                query.append("ORDER BY ");
1323                query.append(obc.getOrderBy());
1324            }
1325
1326            else {
1327                query.append("ORDER BY ");
1328
1329                query.append("imageId ASC");
1330            }
1331
1332            Query q = session.createQuery(query.toString());
1333
1334            QueryPos qPos = QueryPos.getInstance(q);
1335
1336            qPos.add(folderId);
1337
1338            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, igImage);
1339
1340            IGImage[] array = new IGImageImpl[3];
1341
1342            array[0] = (IGImage)objArray[0];
1343            array[1] = (IGImage)objArray[1];
1344            array[2] = (IGImage)objArray[2];
1345
1346            return array;
1347        }
1348        catch (Exception e) {
1349            throw processException(e);
1350        }
1351        finally {
1352            closeSession(session);
1353        }
1354    }
1355
1356    public IGImage findBySmallImageId(long smallImageId)
1357        throws NoSuchImageException, SystemException {
1358        IGImage igImage = fetchBySmallImageId(smallImageId);
1359
1360        if (igImage == null) {
1361            StringBuilder msg = new StringBuilder();
1362
1363            msg.append("No IGImage exists with the key {");
1364
1365            msg.append("smallImageId=" + smallImageId);
1366
1367            msg.append(StringPool.CLOSE_CURLY_BRACE);
1368
1369            if (_log.isWarnEnabled()) {
1370                _log.warn(msg.toString());
1371            }
1372
1373            throw new NoSuchImageException(msg.toString());
1374        }
1375
1376        return igImage;
1377    }
1378
1379    public IGImage fetchBySmallImageId(long smallImageId)
1380        throws SystemException {
1381        return fetchBySmallImageId(smallImageId, true);
1382    }
1383
1384    public IGImage fetchBySmallImageId(long smallImageId,
1385        boolean retrieveFromCache) throws SystemException {
1386        Object[] finderArgs = new Object[] { new Long(smallImageId) };
1387
1388        Object result = null;
1389
1390        if (retrieveFromCache) {
1391            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
1392                    finderArgs, this);
1393        }
1394
1395        if (result == null) {
1396            Session session = null;
1397
1398            try {
1399                session = openSession();
1400
1401                StringBuilder query = new StringBuilder();
1402
1403                query.append(
1404                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
1405
1406                query.append("smallImageId = ?");
1407
1408                query.append(" ");
1409
1410                query.append("ORDER BY ");
1411
1412                query.append("imageId ASC");
1413
1414                Query q = session.createQuery(query.toString());
1415
1416                QueryPos qPos = QueryPos.getInstance(q);
1417
1418                qPos.add(smallImageId);
1419
1420                List<IGImage> list = q.list();
1421
1422                result = list;
1423
1424                IGImage igImage = null;
1425
1426                if (list.isEmpty()) {
1427                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
1428                        finderArgs, list);
1429                }
1430                else {
1431                    igImage = list.get(0);
1432
1433                    cacheResult(igImage);
1434
1435                    if ((igImage.getSmallImageId() != smallImageId)) {
1436                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
1437                            finderArgs, igImage);
1438                    }
1439                }
1440
1441                return igImage;
1442            }
1443            catch (Exception e) {
1444                throw processException(e);
1445            }
1446            finally {
1447                if (result == null) {
1448                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_SMALLIMAGEID,
1449                        finderArgs, new ArrayList<IGImage>());
1450                }
1451
1452                closeSession(session);
1453            }
1454        }
1455        else {
1456            if (result instanceof List) {
1457                return null;
1458            }
1459            else {
1460                return (IGImage)result;
1461            }
1462        }
1463    }
1464
1465    public IGImage findByLargeImageId(long largeImageId)
1466        throws NoSuchImageException, SystemException {
1467        IGImage igImage = fetchByLargeImageId(largeImageId);
1468
1469        if (igImage == null) {
1470            StringBuilder msg = new StringBuilder();
1471
1472            msg.append("No IGImage exists with the key {");
1473
1474            msg.append("largeImageId=" + largeImageId);
1475
1476            msg.append(StringPool.CLOSE_CURLY_BRACE);
1477
1478            if (_log.isWarnEnabled()) {
1479                _log.warn(msg.toString());
1480            }
1481
1482            throw new NoSuchImageException(msg.toString());
1483        }
1484
1485        return igImage;
1486    }
1487
1488    public IGImage fetchByLargeImageId(long largeImageId)
1489        throws SystemException {
1490        return fetchByLargeImageId(largeImageId, true);
1491    }
1492
1493    public IGImage fetchByLargeImageId(long largeImageId,
1494        boolean retrieveFromCache) throws SystemException {
1495        Object[] finderArgs = new Object[] { new Long(largeImageId) };
1496
1497        Object result = null;
1498
1499        if (retrieveFromCache) {
1500            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
1501                    finderArgs, this);
1502        }
1503
1504        if (result == null) {
1505            Session session = null;
1506
1507            try {
1508                session = openSession();
1509
1510                StringBuilder query = new StringBuilder();
1511
1512                query.append(
1513                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
1514
1515                query.append("largeImageId = ?");
1516
1517                query.append(" ");
1518
1519                query.append("ORDER BY ");
1520
1521                query.append("imageId ASC");
1522
1523                Query q = session.createQuery(query.toString());
1524
1525                QueryPos qPos = QueryPos.getInstance(q);
1526
1527                qPos.add(largeImageId);
1528
1529                List<IGImage> list = q.list();
1530
1531                result = list;
1532
1533                IGImage igImage = null;
1534
1535                if (list.isEmpty()) {
1536                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
1537                        finderArgs, list);
1538                }
1539                else {
1540                    igImage = list.get(0);
1541
1542                    cacheResult(igImage);
1543
1544                    if ((igImage.getLargeImageId() != largeImageId)) {
1545                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
1546                            finderArgs, igImage);
1547                    }
1548                }
1549
1550                return igImage;
1551            }
1552            catch (Exception e) {
1553                throw processException(e);
1554            }
1555            finally {
1556                if (result == null) {
1557                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LARGEIMAGEID,
1558                        finderArgs, new ArrayList<IGImage>());
1559                }
1560
1561                closeSession(session);
1562            }
1563        }
1564        else {
1565            if (result instanceof List) {
1566                return null;
1567            }
1568            else {
1569                return (IGImage)result;
1570            }
1571        }
1572    }
1573
1574    public IGImage findByCustom1ImageId(long custom1ImageId)
1575        throws NoSuchImageException, SystemException {
1576        IGImage igImage = fetchByCustom1ImageId(custom1ImageId);
1577
1578        if (igImage == null) {
1579            StringBuilder msg = new StringBuilder();
1580
1581            msg.append("No IGImage exists with the key {");
1582
1583            msg.append("custom1ImageId=" + custom1ImageId);
1584
1585            msg.append(StringPool.CLOSE_CURLY_BRACE);
1586
1587            if (_log.isWarnEnabled()) {
1588                _log.warn(msg.toString());
1589            }
1590
1591            throw new NoSuchImageException(msg.toString());
1592        }
1593
1594        return igImage;
1595    }
1596
1597    public IGImage fetchByCustom1ImageId(long custom1ImageId)
1598        throws SystemException {
1599        return fetchByCustom1ImageId(custom1ImageId, true);
1600    }
1601
1602    public IGImage fetchByCustom1ImageId(long custom1ImageId,
1603        boolean retrieveFromCache) throws SystemException {
1604        Object[] finderArgs = new Object[] { new Long(custom1ImageId) };
1605
1606        Object result = null;
1607
1608        if (retrieveFromCache) {
1609            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_CUSTOM1IMAGEID,
1610                    finderArgs, this);
1611        }
1612
1613        if (result == null) {
1614            Session session = null;
1615
1616            try {
1617                session = openSession();
1618
1619                StringBuilder query = new StringBuilder();
1620
1621                query.append(
1622                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
1623
1624                query.append("custom1ImageId = ?");
1625
1626                query.append(" ");
1627
1628                query.append("ORDER BY ");
1629
1630                query.append("imageId ASC");
1631
1632                Query q = session.createQuery(query.toString());
1633
1634                QueryPos qPos = QueryPos.getInstance(q);
1635
1636                qPos.add(custom1ImageId);
1637
1638                List<IGImage> list = q.list();
1639
1640                result = list;
1641
1642                IGImage igImage = null;
1643
1644                if (list.isEmpty()) {
1645                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CUSTOM1IMAGEID,
1646                        finderArgs, list);
1647                }
1648                else {
1649                    igImage = list.get(0);
1650
1651                    cacheResult(igImage);
1652
1653                    if ((igImage.getCustom1ImageId() != custom1ImageId)) {
1654                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CUSTOM1IMAGEID,
1655                            finderArgs, igImage);
1656                    }
1657                }
1658
1659                return igImage;
1660            }
1661            catch (Exception e) {
1662                throw processException(e);
1663            }
1664            finally {
1665                if (result == null) {
1666                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CUSTOM1IMAGEID,
1667                        finderArgs, new ArrayList<IGImage>());
1668                }
1669
1670                closeSession(session);
1671            }
1672        }
1673        else {
1674            if (result instanceof List) {
1675                return null;
1676            }
1677            else {
1678                return (IGImage)result;
1679            }
1680        }
1681    }
1682
1683    public IGImage findByCustom2ImageId(long custom2ImageId)
1684        throws NoSuchImageException, SystemException {
1685        IGImage igImage = fetchByCustom2ImageId(custom2ImageId);
1686
1687        if (igImage == null) {
1688            StringBuilder msg = new StringBuilder();
1689
1690            msg.append("No IGImage exists with the key {");
1691
1692            msg.append("custom2ImageId=" + custom2ImageId);
1693
1694            msg.append(StringPool.CLOSE_CURLY_BRACE);
1695
1696            if (_log.isWarnEnabled()) {
1697                _log.warn(msg.toString());
1698            }
1699
1700            throw new NoSuchImageException(msg.toString());
1701        }
1702
1703        return igImage;
1704    }
1705
1706    public IGImage fetchByCustom2ImageId(long custom2ImageId)
1707        throws SystemException {
1708        return fetchByCustom2ImageId(custom2ImageId, true);
1709    }
1710
1711    public IGImage fetchByCustom2ImageId(long custom2ImageId,
1712        boolean retrieveFromCache) throws SystemException {
1713        Object[] finderArgs = new Object[] { new Long(custom2ImageId) };
1714
1715        Object result = null;
1716
1717        if (retrieveFromCache) {
1718            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_CUSTOM2IMAGEID,
1719                    finderArgs, this);
1720        }
1721
1722        if (result == null) {
1723            Session session = null;
1724
1725            try {
1726                session = openSession();
1727
1728                StringBuilder query = new StringBuilder();
1729
1730                query.append(
1731                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
1732
1733                query.append("custom2ImageId = ?");
1734
1735                query.append(" ");
1736
1737                query.append("ORDER BY ");
1738
1739                query.append("imageId ASC");
1740
1741                Query q = session.createQuery(query.toString());
1742
1743                QueryPos qPos = QueryPos.getInstance(q);
1744
1745                qPos.add(custom2ImageId);
1746
1747                List<IGImage> list = q.list();
1748
1749                result = list;
1750
1751                IGImage igImage = null;
1752
1753                if (list.isEmpty()) {
1754                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CUSTOM2IMAGEID,
1755                        finderArgs, list);
1756                }
1757                else {
1758                    igImage = list.get(0);
1759
1760                    cacheResult(igImage);
1761
1762                    if ((igImage.getCustom2ImageId() != custom2ImageId)) {
1763                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CUSTOM2IMAGEID,
1764                            finderArgs, igImage);
1765                    }
1766                }
1767
1768                return igImage;
1769            }
1770            catch (Exception e) {
1771                throw processException(e);
1772            }
1773            finally {
1774                if (result == null) {
1775                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CUSTOM2IMAGEID,
1776                        finderArgs, new ArrayList<IGImage>());
1777                }
1778
1779                closeSession(session);
1780            }
1781        }
1782        else {
1783            if (result instanceof List) {
1784                return null;
1785            }
1786            else {
1787                return (IGImage)result;
1788            }
1789        }
1790    }
1791
1792    public List<IGImage> findByG_U(long groupId, long userId)
1793        throws SystemException {
1794        Object[] finderArgs = new Object[] { new Long(groupId), new Long(userId) };
1795
1796        List<IGImage> list = (List<IGImage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_U,
1797                finderArgs, this);
1798
1799        if (list == null) {
1800            Session session = null;
1801
1802            try {
1803                session = openSession();
1804
1805                StringBuilder query = new StringBuilder();
1806
1807                query.append(
1808                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
1809
1810                query.append("groupId = ?");
1811
1812                query.append(" AND ");
1813
1814                query.append("userId = ?");
1815
1816                query.append(" ");
1817
1818                query.append("ORDER BY ");
1819
1820                query.append("imageId ASC");
1821
1822                Query q = session.createQuery(query.toString());
1823
1824                QueryPos qPos = QueryPos.getInstance(q);
1825
1826                qPos.add(groupId);
1827
1828                qPos.add(userId);
1829
1830                list = q.list();
1831            }
1832            catch (Exception e) {
1833                throw processException(e);
1834            }
1835            finally {
1836                if (list == null) {
1837                    list = new ArrayList<IGImage>();
1838                }
1839
1840                cacheResult(list);
1841
1842                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_U, finderArgs,
1843                    list);
1844
1845                closeSession(session);
1846            }
1847        }
1848
1849        return list;
1850    }
1851
1852    public List<IGImage> findByG_U(long groupId, long userId, int start, int end)
1853        throws SystemException {
1854        return findByG_U(groupId, userId, start, end, null);
1855    }
1856
1857    public List<IGImage> findByG_U(long groupId, long userId, int start,
1858        int end, OrderByComparator obc) throws SystemException {
1859        Object[] finderArgs = new Object[] {
1860                new Long(groupId), new Long(userId),
1861                
1862                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1863            };
1864
1865        List<IGImage> list = (List<IGImage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_U,
1866                finderArgs, this);
1867
1868        if (list == null) {
1869            Session session = null;
1870
1871            try {
1872                session = openSession();
1873
1874                StringBuilder query = new StringBuilder();
1875
1876                query.append(
1877                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
1878
1879                query.append("groupId = ?");
1880
1881                query.append(" AND ");
1882
1883                query.append("userId = ?");
1884
1885                query.append(" ");
1886
1887                if (obc != null) {
1888                    query.append("ORDER BY ");
1889                    query.append(obc.getOrderBy());
1890                }
1891
1892                else {
1893                    query.append("ORDER BY ");
1894
1895                    query.append("imageId ASC");
1896                }
1897
1898                Query q = session.createQuery(query.toString());
1899
1900                QueryPos qPos = QueryPos.getInstance(q);
1901
1902                qPos.add(groupId);
1903
1904                qPos.add(userId);
1905
1906                list = (List<IGImage>)QueryUtil.list(q, getDialect(), start, end);
1907            }
1908            catch (Exception e) {
1909                throw processException(e);
1910            }
1911            finally {
1912                if (list == null) {
1913                    list = new ArrayList<IGImage>();
1914                }
1915
1916                cacheResult(list);
1917
1918                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_U,
1919                    finderArgs, list);
1920
1921                closeSession(session);
1922            }
1923        }
1924
1925        return list;
1926    }
1927
1928    public IGImage findByG_U_First(long groupId, long userId,
1929        OrderByComparator obc) throws NoSuchImageException, SystemException {
1930        List<IGImage> list = findByG_U(groupId, userId, 0, 1, obc);
1931
1932        if (list.isEmpty()) {
1933            StringBuilder msg = new StringBuilder();
1934
1935            msg.append("No IGImage exists with the key {");
1936
1937            msg.append("groupId=" + groupId);
1938
1939            msg.append(", ");
1940            msg.append("userId=" + userId);
1941
1942            msg.append(StringPool.CLOSE_CURLY_BRACE);
1943
1944            throw new NoSuchImageException(msg.toString());
1945        }
1946        else {
1947            return list.get(0);
1948        }
1949    }
1950
1951    public IGImage findByG_U_Last(long groupId, long userId,
1952        OrderByComparator obc) throws NoSuchImageException, SystemException {
1953        int count = countByG_U(groupId, userId);
1954
1955        List<IGImage> list = findByG_U(groupId, userId, count - 1, count, obc);
1956
1957        if (list.isEmpty()) {
1958            StringBuilder msg = new StringBuilder();
1959
1960            msg.append("No IGImage exists with the key {");
1961
1962            msg.append("groupId=" + groupId);
1963
1964            msg.append(", ");
1965            msg.append("userId=" + userId);
1966
1967            msg.append(StringPool.CLOSE_CURLY_BRACE);
1968
1969            throw new NoSuchImageException(msg.toString());
1970        }
1971        else {
1972            return list.get(0);
1973        }
1974    }
1975
1976    public IGImage[] findByG_U_PrevAndNext(long imageId, long groupId,
1977        long userId, OrderByComparator obc)
1978        throws NoSuchImageException, SystemException {
1979        IGImage igImage = findByPrimaryKey(imageId);
1980
1981        int count = countByG_U(groupId, userId);
1982
1983        Session session = null;
1984
1985        try {
1986            session = openSession();
1987
1988            StringBuilder query = new StringBuilder();
1989
1990            query.append(
1991                "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
1992
1993            query.append("groupId = ?");
1994
1995            query.append(" AND ");
1996
1997            query.append("userId = ?");
1998
1999            query.append(" ");
2000
2001            if (obc != null) {
2002                query.append("ORDER BY ");
2003                query.append(obc.getOrderBy());
2004            }
2005
2006            else {
2007                query.append("ORDER BY ");
2008
2009                query.append("imageId ASC");
2010            }
2011
2012            Query q = session.createQuery(query.toString());
2013
2014            QueryPos qPos = QueryPos.getInstance(q);
2015
2016            qPos.add(groupId);
2017
2018            qPos.add(userId);
2019
2020            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, igImage);
2021
2022            IGImage[] array = new IGImageImpl[3];
2023
2024            array[0] = (IGImage)objArray[0];
2025            array[1] = (IGImage)objArray[1];
2026            array[2] = (IGImage)objArray[2];
2027
2028            return array;
2029        }
2030        catch (Exception e) {
2031            throw processException(e);
2032        }
2033        finally {
2034            closeSession(session);
2035        }
2036    }
2037
2038    public List<IGImage> findByF_N(long folderId, String name)
2039        throws SystemException {
2040        Object[] finderArgs = new Object[] { new Long(folderId), name };
2041
2042        List<IGImage> list = (List<IGImage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_F_N,
2043                finderArgs, this);
2044
2045        if (list == null) {
2046            Session session = null;
2047
2048            try {
2049                session = openSession();
2050
2051                StringBuilder query = new StringBuilder();
2052
2053                query.append(
2054                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
2055
2056                query.append("folderId = ?");
2057
2058                query.append(" AND ");
2059
2060                if (name == null) {
2061                    query.append("name IS NULL");
2062                }
2063                else {
2064                    query.append("name = ?");
2065                }
2066
2067                query.append(" ");
2068
2069                query.append("ORDER BY ");
2070
2071                query.append("imageId ASC");
2072
2073                Query q = session.createQuery(query.toString());
2074
2075                QueryPos qPos = QueryPos.getInstance(q);
2076
2077                qPos.add(folderId);
2078
2079                if (name != null) {
2080                    qPos.add(name);
2081                }
2082
2083                list = q.list();
2084            }
2085            catch (Exception e) {
2086                throw processException(e);
2087            }
2088            finally {
2089                if (list == null) {
2090                    list = new ArrayList<IGImage>();
2091                }
2092
2093                cacheResult(list);
2094
2095                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_F_N, finderArgs,
2096                    list);
2097
2098                closeSession(session);
2099            }
2100        }
2101
2102        return list;
2103    }
2104
2105    public List<IGImage> findByF_N(long folderId, String name, int start,
2106        int end) throws SystemException {
2107        return findByF_N(folderId, name, start, end, null);
2108    }
2109
2110    public List<IGImage> findByF_N(long folderId, String name, int start,
2111        int end, OrderByComparator obc) throws SystemException {
2112        Object[] finderArgs = new Object[] {
2113                new Long(folderId),
2114                
2115                name,
2116                
2117                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2118            };
2119
2120        List<IGImage> list = (List<IGImage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_F_N,
2121                finderArgs, this);
2122
2123        if (list == null) {
2124            Session session = null;
2125
2126            try {
2127                session = openSession();
2128
2129                StringBuilder query = new StringBuilder();
2130
2131                query.append(
2132                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
2133
2134                query.append("folderId = ?");
2135
2136                query.append(" AND ");
2137
2138                if (name == null) {
2139                    query.append("name IS NULL");
2140                }
2141                else {
2142                    query.append("name = ?");
2143                }
2144
2145                query.append(" ");
2146
2147                if (obc != null) {
2148                    query.append("ORDER BY ");
2149                    query.append(obc.getOrderBy());
2150                }
2151
2152                else {
2153                    query.append("ORDER BY ");
2154
2155                    query.append("imageId ASC");
2156                }
2157
2158                Query q = session.createQuery(query.toString());
2159
2160                QueryPos qPos = QueryPos.getInstance(q);
2161
2162                qPos.add(folderId);
2163
2164                if (name != null) {
2165                    qPos.add(name);
2166                }
2167
2168                list = (List<IGImage>)QueryUtil.list(q, getDialect(), start, end);
2169            }
2170            catch (Exception e) {
2171                throw processException(e);
2172            }
2173            finally {
2174                if (list == null) {
2175                    list = new ArrayList<IGImage>();
2176                }
2177
2178                cacheResult(list);
2179
2180                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_F_N,
2181                    finderArgs, list);
2182
2183                closeSession(session);
2184            }
2185        }
2186
2187        return list;
2188    }
2189
2190    public IGImage findByF_N_First(long folderId, String name,
2191        OrderByComparator obc) throws NoSuchImageException, SystemException {
2192        List<IGImage> list = findByF_N(folderId, name, 0, 1, obc);
2193
2194        if (list.isEmpty()) {
2195            StringBuilder msg = new StringBuilder();
2196
2197            msg.append("No IGImage exists with the key {");
2198
2199            msg.append("folderId=" + folderId);
2200
2201            msg.append(", ");
2202            msg.append("name=" + name);
2203
2204            msg.append(StringPool.CLOSE_CURLY_BRACE);
2205
2206            throw new NoSuchImageException(msg.toString());
2207        }
2208        else {
2209            return list.get(0);
2210        }
2211    }
2212
2213    public IGImage findByF_N_Last(long folderId, String name,
2214        OrderByComparator obc) throws NoSuchImageException, SystemException {
2215        int count = countByF_N(folderId, name);
2216
2217        List<IGImage> list = findByF_N(folderId, name, count - 1, count, obc);
2218
2219        if (list.isEmpty()) {
2220            StringBuilder msg = new StringBuilder();
2221
2222            msg.append("No IGImage exists with the key {");
2223
2224            msg.append("folderId=" + folderId);
2225
2226            msg.append(", ");
2227            msg.append("name=" + name);
2228
2229            msg.append(StringPool.CLOSE_CURLY_BRACE);
2230
2231            throw new NoSuchImageException(msg.toString());
2232        }
2233        else {
2234            return list.get(0);
2235        }
2236    }
2237
2238    public IGImage[] findByF_N_PrevAndNext(long imageId, long folderId,
2239        String name, OrderByComparator obc)
2240        throws NoSuchImageException, SystemException {
2241        IGImage igImage = findByPrimaryKey(imageId);
2242
2243        int count = countByF_N(folderId, name);
2244
2245        Session session = null;
2246
2247        try {
2248            session = openSession();
2249
2250            StringBuilder query = new StringBuilder();
2251
2252            query.append(
2253                "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
2254
2255            query.append("folderId = ?");
2256
2257            query.append(" AND ");
2258
2259            if (name == null) {
2260                query.append("name IS NULL");
2261            }
2262            else {
2263                query.append("name = ?");
2264            }
2265
2266            query.append(" ");
2267
2268            if (obc != null) {
2269                query.append("ORDER BY ");
2270                query.append(obc.getOrderBy());
2271            }
2272
2273            else {
2274                query.append("ORDER BY ");
2275
2276                query.append("imageId ASC");
2277            }
2278
2279            Query q = session.createQuery(query.toString());
2280
2281            QueryPos qPos = QueryPos.getInstance(q);
2282
2283            qPos.add(folderId);
2284
2285            if (name != null) {
2286                qPos.add(name);
2287            }
2288
2289            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, igImage);
2290
2291            IGImage[] array = new IGImageImpl[3];
2292
2293            array[0] = (IGImage)objArray[0];
2294            array[1] = (IGImage)objArray[1];
2295            array[2] = (IGImage)objArray[2];
2296
2297            return array;
2298        }
2299        catch (Exception e) {
2300            throw processException(e);
2301        }
2302        finally {
2303            closeSession(session);
2304        }
2305    }
2306
2307    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
2308        throws SystemException {
2309        Session session = null;
2310
2311        try {
2312            session = openSession();
2313
2314            dynamicQuery.compile(session);
2315
2316            return dynamicQuery.list();
2317        }
2318        catch (Exception e) {
2319            throw processException(e);
2320        }
2321        finally {
2322            closeSession(session);
2323        }
2324    }
2325
2326    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
2327        int start, int end) throws SystemException {
2328        Session session = null;
2329
2330        try {
2331            session = openSession();
2332
2333            dynamicQuery.setLimit(start, end);
2334
2335            dynamicQuery.compile(session);
2336
2337            return dynamicQuery.list();
2338        }
2339        catch (Exception e) {
2340            throw processException(e);
2341        }
2342        finally {
2343            closeSession(session);
2344        }
2345    }
2346
2347    public List<IGImage> findAll() throws SystemException {
2348        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2349    }
2350
2351    public List<IGImage> findAll(int start, int end) throws SystemException {
2352        return findAll(start, end, null);
2353    }
2354
2355    public List<IGImage> findAll(int start, int end, OrderByComparator obc)
2356        throws SystemException {
2357        Object[] finderArgs = new Object[] {
2358                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2359            };
2360
2361        List<IGImage> list = (List<IGImage>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2362                finderArgs, this);
2363
2364        if (list == null) {
2365            Session session = null;
2366
2367            try {
2368                session = openSession();
2369
2370                StringBuilder query = new StringBuilder();
2371
2372                query.append(
2373                    "FROM com.liferay.portlet.imagegallery.model.IGImage ");
2374
2375                if (obc != null) {
2376                    query.append("ORDER BY ");
2377                    query.append(obc.getOrderBy());
2378                }
2379
2380                else {
2381                    query.append("ORDER BY ");
2382
2383                    query.append("imageId ASC");
2384                }
2385
2386                Query q = session.createQuery(query.toString());
2387
2388                if (obc == null) {
2389                    list = (List<IGImage>)QueryUtil.list(q, getDialect(),
2390                            start, end, false);
2391
2392                    Collections.sort(list);
2393                }
2394                else {
2395                    list = (List<IGImage>)QueryUtil.list(q, getDialect(),
2396                            start, end);
2397                }
2398            }
2399            catch (Exception e) {
2400                throw processException(e);
2401            }
2402            finally {
2403                if (list == null) {
2404                    list = new ArrayList<IGImage>();
2405                }
2406
2407                cacheResult(list);
2408
2409                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2410
2411                closeSession(session);
2412            }
2413        }
2414
2415        return list;
2416    }
2417
2418    public void removeByUuid(String uuid) throws SystemException {
2419        for (IGImage igImage : findByUuid(uuid)) {
2420            remove(igImage);
2421        }
2422    }
2423
2424    public void removeByUUID_G(String uuid, long groupId)
2425        throws NoSuchImageException, SystemException {
2426        IGImage igImage = findByUUID_G(uuid, groupId);
2427
2428        remove(igImage);
2429    }
2430
2431    public void removeByGroupId(long groupId) throws SystemException {
2432        for (IGImage igImage : findByGroupId(groupId)) {
2433            remove(igImage);
2434        }
2435    }
2436
2437    public void removeByFolderId(long folderId) throws SystemException {
2438        for (IGImage igImage : findByFolderId(folderId)) {
2439            remove(igImage);
2440        }
2441    }
2442
2443    public void removeBySmallImageId(long smallImageId)
2444        throws NoSuchImageException, SystemException {
2445        IGImage igImage = findBySmallImageId(smallImageId);
2446
2447        remove(igImage);
2448    }
2449
2450    public void removeByLargeImageId(long largeImageId)
2451        throws NoSuchImageException, SystemException {
2452        IGImage igImage = findByLargeImageId(largeImageId);
2453
2454        remove(igImage);
2455    }
2456
2457    public void removeByCustom1ImageId(long custom1ImageId)
2458        throws NoSuchImageException, SystemException {
2459        IGImage igImage = findByCustom1ImageId(custom1ImageId);
2460
2461        remove(igImage);
2462    }
2463
2464    public void removeByCustom2ImageId(long custom2ImageId)
2465        throws NoSuchImageException, SystemException {
2466        IGImage igImage = findByCustom2ImageId(custom2ImageId);
2467
2468        remove(igImage);
2469    }
2470
2471    public void removeByG_U(long groupId, long userId)
2472        throws SystemException {
2473        for (IGImage igImage : findByG_U(groupId, userId)) {
2474            remove(igImage);
2475        }
2476    }
2477
2478    public void removeByF_N(long folderId, String name)
2479        throws SystemException {
2480        for (IGImage igImage : findByF_N(folderId, name)) {
2481            remove(igImage);
2482        }
2483    }
2484
2485    public void removeAll() throws SystemException {
2486        for (IGImage igImage : findAll()) {
2487            remove(igImage);
2488        }
2489    }
2490
2491    public int countByUuid(String uuid) throws SystemException {
2492        Object[] finderArgs = new Object[] { uuid };
2493
2494        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2495                finderArgs, this);
2496
2497        if (count == null) {
2498            Session session = null;
2499
2500            try {
2501                session = openSession();
2502
2503                StringBuilder query = new StringBuilder();
2504
2505                query.append("SELECT COUNT(*) ");
2506                query.append(
2507                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
2508
2509                if (uuid == null) {
2510                    query.append("uuid_ IS NULL");
2511                }
2512                else {
2513                    query.append("uuid_ = ?");
2514                }
2515
2516                query.append(" ");
2517
2518                Query q = session.createQuery(query.toString());
2519
2520                QueryPos qPos = QueryPos.getInstance(q);
2521
2522                if (uuid != null) {
2523                    qPos.add(uuid);
2524                }
2525
2526                count = (Long)q.uniqueResult();
2527            }
2528            catch (Exception e) {
2529                throw processException(e);
2530            }
2531            finally {
2532                if (count == null) {
2533                    count = Long.valueOf(0);
2534                }
2535
2536                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2537                    finderArgs, count);
2538
2539                closeSession(session);
2540            }
2541        }
2542
2543        return count.intValue();
2544    }
2545
2546    public int countByUUID_G(String uuid, long groupId)
2547        throws SystemException {
2548        Object[] finderArgs = new Object[] { uuid, new Long(groupId) };
2549
2550        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
2551                finderArgs, this);
2552
2553        if (count == null) {
2554            Session session = null;
2555
2556            try {
2557                session = openSession();
2558
2559                StringBuilder query = new StringBuilder();
2560
2561                query.append("SELECT COUNT(*) ");
2562                query.append(
2563                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
2564
2565                if (uuid == null) {
2566                    query.append("uuid_ IS NULL");
2567                }
2568                else {
2569                    query.append("uuid_ = ?");
2570                }
2571
2572                query.append(" AND ");
2573
2574                query.append("groupId = ?");
2575
2576                query.append(" ");
2577
2578                Query q = session.createQuery(query.toString());
2579
2580                QueryPos qPos = QueryPos.getInstance(q);
2581
2582                if (uuid != null) {
2583                    qPos.add(uuid);
2584                }
2585
2586                qPos.add(groupId);
2587
2588                count = (Long)q.uniqueResult();
2589            }
2590            catch (Exception e) {
2591                throw processException(e);
2592            }
2593            finally {
2594                if (count == null) {
2595                    count = Long.valueOf(0);
2596                }
2597
2598                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
2599                    finderArgs, count);
2600
2601                closeSession(session);
2602            }
2603        }
2604
2605        return count.intValue();
2606    }
2607
2608    public int countByGroupId(long groupId) throws SystemException {
2609        Object[] finderArgs = new Object[] { new Long(groupId) };
2610
2611        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2612                finderArgs, this);
2613
2614        if (count == null) {
2615            Session session = null;
2616
2617            try {
2618                session = openSession();
2619
2620                StringBuilder query = new StringBuilder();
2621
2622                query.append("SELECT COUNT(*) ");
2623                query.append(
2624                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
2625
2626                query.append("groupId = ?");
2627
2628                query.append(" ");
2629
2630                Query q = session.createQuery(query.toString());
2631
2632                QueryPos qPos = QueryPos.getInstance(q);
2633
2634                qPos.add(groupId);
2635
2636                count = (Long)q.uniqueResult();
2637            }
2638            catch (Exception e) {
2639                throw processException(e);
2640            }
2641            finally {
2642                if (count == null) {
2643                    count = Long.valueOf(0);
2644                }
2645
2646                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2647                    finderArgs, count);
2648
2649                closeSession(session);
2650            }
2651        }
2652
2653        return count.intValue();
2654    }
2655
2656    public int countByFolderId(long folderId) throws SystemException {
2657        Object[] finderArgs = new Object[] { new Long(folderId) };
2658
2659        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_FOLDERID,
2660                finderArgs, this);
2661
2662        if (count == null) {
2663            Session session = null;
2664
2665            try {
2666                session = openSession();
2667
2668                StringBuilder query = new StringBuilder();
2669
2670                query.append("SELECT COUNT(*) ");
2671                query.append(
2672                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
2673
2674                query.append("folderId = ?");
2675
2676                query.append(" ");
2677
2678                Query q = session.createQuery(query.toString());
2679
2680                QueryPos qPos = QueryPos.getInstance(q);
2681
2682                qPos.add(folderId);
2683
2684                count = (Long)q.uniqueResult();
2685            }
2686            catch (Exception e) {
2687                throw processException(e);
2688            }
2689            finally {
2690                if (count == null) {
2691                    count = Long.valueOf(0);
2692                }
2693
2694                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FOLDERID,
2695                    finderArgs, count);
2696
2697                closeSession(session);
2698            }
2699        }
2700
2701        return count.intValue();
2702    }
2703
2704    public int countBySmallImageId(long smallImageId) throws SystemException {
2705        Object[] finderArgs = new Object[] { new Long(smallImageId) };
2706
2707        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SMALLIMAGEID,
2708                finderArgs, this);
2709
2710        if (count == null) {
2711            Session session = null;
2712
2713            try {
2714                session = openSession();
2715
2716                StringBuilder query = new StringBuilder();
2717
2718                query.append("SELECT COUNT(*) ");
2719                query.append(
2720                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
2721
2722                query.append("smallImageId = ?");
2723
2724                query.append(" ");
2725
2726                Query q = session.createQuery(query.toString());
2727
2728                QueryPos qPos = QueryPos.getInstance(q);
2729
2730                qPos.add(smallImageId);
2731
2732                count = (Long)q.uniqueResult();
2733            }
2734            catch (Exception e) {
2735                throw processException(e);
2736            }
2737            finally {
2738                if (count == null) {
2739                    count = Long.valueOf(0);
2740                }
2741
2742                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SMALLIMAGEID,
2743                    finderArgs, count);
2744
2745                closeSession(session);
2746            }
2747        }
2748
2749        return count.intValue();
2750    }
2751
2752    public int countByLargeImageId(long largeImageId) throws SystemException {
2753        Object[] finderArgs = new Object[] { new Long(largeImageId) };
2754
2755        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_LARGEIMAGEID,
2756                finderArgs, this);
2757
2758        if (count == null) {
2759            Session session = null;
2760
2761            try {
2762                session = openSession();
2763
2764                StringBuilder query = new StringBuilder();
2765
2766                query.append("SELECT COUNT(*) ");
2767                query.append(
2768                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
2769
2770                query.append("largeImageId = ?");
2771
2772                query.append(" ");
2773
2774                Query q = session.createQuery(query.toString());
2775
2776                QueryPos qPos = QueryPos.getInstance(q);
2777
2778                qPos.add(largeImageId);
2779
2780                count = (Long)q.uniqueResult();
2781            }
2782            catch (Exception e) {
2783                throw processException(e);
2784            }
2785            finally {
2786                if (count == null) {
2787                    count = Long.valueOf(0);
2788                }
2789
2790                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_LARGEIMAGEID,
2791                    finderArgs, count);
2792
2793                closeSession(session);
2794            }
2795        }
2796
2797        return count.intValue();
2798    }
2799
2800    public int countByCustom1ImageId(long custom1ImageId)
2801        throws SystemException {
2802        Object[] finderArgs = new Object[] { new Long(custom1ImageId) };
2803
2804        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CUSTOM1IMAGEID,
2805                finderArgs, this);
2806
2807        if (count == null) {
2808            Session session = null;
2809
2810            try {
2811                session = openSession();
2812
2813                StringBuilder query = new StringBuilder();
2814
2815                query.append("SELECT COUNT(*) ");
2816                query.append(
2817                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
2818
2819                query.append("custom1ImageId = ?");
2820
2821                query.append(" ");
2822
2823                Query q = session.createQuery(query.toString());
2824
2825                QueryPos qPos = QueryPos.getInstance(q);
2826
2827                qPos.add(custom1ImageId);
2828
2829                count = (Long)q.uniqueResult();
2830            }
2831            catch (Exception e) {
2832                throw processException(e);
2833            }
2834            finally {
2835                if (count == null) {
2836                    count = Long.valueOf(0);
2837                }
2838
2839                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_CUSTOM1IMAGEID,
2840                    finderArgs, count);
2841
2842                closeSession(session);
2843            }
2844        }
2845
2846        return count.intValue();
2847    }
2848
2849    public int countByCustom2ImageId(long custom2ImageId)
2850        throws SystemException {
2851        Object[] finderArgs = new Object[] { new Long(custom2ImageId) };
2852
2853        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CUSTOM2IMAGEID,
2854                finderArgs, this);
2855
2856        if (count == null) {
2857            Session session = null;
2858
2859            try {
2860                session = openSession();
2861
2862                StringBuilder query = new StringBuilder();
2863
2864                query.append("SELECT COUNT(*) ");
2865                query.append(
2866                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
2867
2868                query.append("custom2ImageId = ?");
2869
2870                query.append(" ");
2871
2872                Query q = session.createQuery(query.toString());
2873
2874                QueryPos qPos = QueryPos.getInstance(q);
2875
2876                qPos.add(custom2ImageId);
2877
2878                count = (Long)q.uniqueResult();
2879            }
2880            catch (Exception e) {
2881                throw processException(e);
2882            }
2883            finally {
2884                if (count == null) {
2885                    count = Long.valueOf(0);
2886                }
2887
2888                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_CUSTOM2IMAGEID,
2889                    finderArgs, count);
2890
2891                closeSession(session);
2892            }
2893        }
2894
2895        return count.intValue();
2896    }
2897
2898    public int countByG_U(long groupId, long userId) throws SystemException {
2899        Object[] finderArgs = new Object[] { new Long(groupId), new Long(userId) };
2900
2901        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U,
2902                finderArgs, this);
2903
2904        if (count == null) {
2905            Session session = null;
2906
2907            try {
2908                session = openSession();
2909
2910                StringBuilder query = new StringBuilder();
2911
2912                query.append("SELECT COUNT(*) ");
2913                query.append(
2914                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
2915
2916                query.append("groupId = ?");
2917
2918                query.append(" AND ");
2919
2920                query.append("userId = ?");
2921
2922                query.append(" ");
2923
2924                Query q = session.createQuery(query.toString());
2925
2926                QueryPos qPos = QueryPos.getInstance(q);
2927
2928                qPos.add(groupId);
2929
2930                qPos.add(userId);
2931
2932                count = (Long)q.uniqueResult();
2933            }
2934            catch (Exception e) {
2935                throw processException(e);
2936            }
2937            finally {
2938                if (count == null) {
2939                    count = Long.valueOf(0);
2940                }
2941
2942                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U, finderArgs,
2943                    count);
2944
2945                closeSession(session);
2946            }
2947        }
2948
2949        return count.intValue();
2950    }
2951
2952    public int countByF_N(long folderId, String name) throws SystemException {
2953        Object[] finderArgs = new Object[] { new Long(folderId), name };
2954
2955        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_F_N,
2956                finderArgs, this);
2957
2958        if (count == null) {
2959            Session session = null;
2960
2961            try {
2962                session = openSession();
2963
2964                StringBuilder query = new StringBuilder();
2965
2966                query.append("SELECT COUNT(*) ");
2967                query.append(
2968                    "FROM com.liferay.portlet.imagegallery.model.IGImage WHERE ");
2969
2970                query.append("folderId = ?");
2971
2972                query.append(" AND ");
2973
2974                if (name == null) {
2975                    query.append("name IS NULL");
2976                }
2977                else {
2978                    query.append("name = ?");
2979                }
2980
2981                query.append(" ");
2982
2983                Query q = session.createQuery(query.toString());
2984
2985                QueryPos qPos = QueryPos.getInstance(q);
2986
2987                qPos.add(folderId);
2988
2989                if (name != null) {
2990                    qPos.add(name);
2991                }
2992
2993                count = (Long)q.uniqueResult();
2994            }
2995            catch (Exception e) {
2996                throw processException(e);
2997            }
2998            finally {
2999                if (count == null) {
3000                    count = Long.valueOf(0);
3001                }
3002
3003                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_F_N, finderArgs,
3004                    count);
3005
3006                closeSession(session);
3007            }
3008        }
3009
3010        return count.intValue();
3011    }
3012
3013    public int countAll() throws SystemException {
3014        Object[] finderArgs = new Object[0];
3015
3016        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3017                finderArgs, this);
3018
3019        if (count == null) {
3020            Session session = null;
3021
3022            try {
3023                session = openSession();
3024
3025                Query q = session.createQuery(
3026                        "SELECT COUNT(*) FROM com.liferay.portlet.imagegallery.model.IGImage");
3027
3028                count = (Long)q.uniqueResult();
3029            }
3030            catch (Exception e) {
3031                throw processException(e);
3032            }
3033            finally {
3034                if (count == null) {
3035                    count = Long.valueOf(0);
3036                }
3037
3038                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3039                    count);
3040
3041                closeSession(session);
3042            }
3043        }
3044
3045        return count.intValue();
3046    }
3047
3048    public void afterPropertiesSet() {
3049        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3050                    com.liferay.portal.util.PropsUtil.get(
3051                        "value.object.listener.com.liferay.portlet.imagegallery.model.IGImage")));
3052
3053        if (listenerClassNames.length > 0) {
3054            try {
3055                List<ModelListener<IGImage>> listenersList = new ArrayList<ModelListener<IGImage>>();
3056
3057                for (String listenerClassName : listenerClassNames) {
3058                    listenersList.add((ModelListener<IGImage>)Class.forName(
3059                            listenerClassName).newInstance());
3060                }
3061
3062                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3063            }
3064            catch (Exception e) {
3065                _log.error(e);
3066            }
3067        }
3068    }
3069
3070    @BeanReference(name = "com.liferay.portlet.imagegallery.service.persistence.IGFolderPersistence.impl")
3071    protected com.liferay.portlet.imagegallery.service.persistence.IGFolderPersistence igFolderPersistence;
3072    @BeanReference(name = "com.liferay.portlet.imagegallery.service.persistence.IGImagePersistence.impl")
3073    protected com.liferay.portlet.imagegallery.service.persistence.IGImagePersistence igImagePersistence;
3074    @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence.impl")
3075    protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
3076    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence.impl")
3077    protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
3078    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
3079    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
3080    @BeanReference(name = "com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence.impl")
3081    protected com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence expandoValuePersistence;
3082    @BeanReference(name = "com.liferay.portlet.tags.service.persistence.TagsAssetPersistence.impl")
3083    protected com.liferay.portlet.tags.service.persistence.TagsAssetPersistence tagsAssetPersistence;
3084    @BeanReference(name = "com.liferay.portlet.tags.service.persistence.TagsEntryPersistence.impl")
3085    protected com.liferay.portlet.tags.service.persistence.TagsEntryPersistence tagsEntryPersistence;
3086    private static Log _log = LogFactoryUtil.getLog(IGImagePersistenceImpl.class);
3087}