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