1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.softwarecatalog.service.persistence;
24  
25  import com.liferay.portal.SystemException;
26  import com.liferay.portal.kernel.annotation.BeanReference;
27  import com.liferay.portal.kernel.cache.CacheRegistry;
28  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
29  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
30  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
31  import com.liferay.portal.kernel.dao.orm.FinderPath;
32  import com.liferay.portal.kernel.dao.orm.Query;
33  import com.liferay.portal.kernel.dao.orm.QueryPos;
34  import com.liferay.portal.kernel.dao.orm.QueryUtil;
35  import com.liferay.portal.kernel.dao.orm.Session;
36  import com.liferay.portal.kernel.log.Log;
37  import com.liferay.portal.kernel.log.LogFactoryUtil;
38  import com.liferay.portal.kernel.util.GetterUtil;
39  import com.liferay.portal.kernel.util.OrderByComparator;
40  import com.liferay.portal.kernel.util.StringPool;
41  import com.liferay.portal.kernel.util.StringUtil;
42  import com.liferay.portal.model.ModelListener;
43  import com.liferay.portal.service.persistence.BatchSessionUtil;
44  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
45  
46  import com.liferay.portlet.softwarecatalog.NoSuchProductScreenshotException;
47  import com.liferay.portlet.softwarecatalog.model.SCProductScreenshot;
48  import com.liferay.portlet.softwarecatalog.model.impl.SCProductScreenshotImpl;
49  import com.liferay.portlet.softwarecatalog.model.impl.SCProductScreenshotModelImpl;
50  
51  import java.util.ArrayList;
52  import java.util.Collections;
53  import java.util.List;
54  
55  /**
56   * <a href="SCProductScreenshotPersistenceImpl.java.html"><b><i>View Source</i></b></a>
57   *
58   * @author Brian Wing Shun Chan
59   *
60   */
61  public class SCProductScreenshotPersistenceImpl extends BasePersistenceImpl
62      implements SCProductScreenshotPersistence {
63      public static final String FINDER_CLASS_NAME_ENTITY = SCProductScreenshotImpl.class.getName();
64      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
65          ".List";
66      public static final FinderPath FINDER_PATH_FIND_BY_PRODUCTENTRYID = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
67              SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
68              FINDER_CLASS_NAME_LIST, "findByProductEntryId",
69              new String[] { Long.class.getName() });
70      public static final FinderPath FINDER_PATH_FIND_BY_OBC_PRODUCTENTRYID = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
71              SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
72              FINDER_CLASS_NAME_LIST, "findByProductEntryId",
73              new String[] {
74                  Long.class.getName(),
75                  
76              "java.lang.Integer", "java.lang.Integer",
77                  "com.liferay.portal.kernel.util.OrderByComparator"
78              });
79      public static final FinderPath FINDER_PATH_COUNT_BY_PRODUCTENTRYID = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
80              SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
81              FINDER_CLASS_NAME_LIST, "countByProductEntryId",
82              new String[] { Long.class.getName() });
83      public static final FinderPath FINDER_PATH_FETCH_BY_THUMBNAILID = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
84              SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
85              FINDER_CLASS_NAME_ENTITY, "fetchByThumbnailId",
86              new String[] { Long.class.getName() });
87      public static final FinderPath FINDER_PATH_COUNT_BY_THUMBNAILID = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
88              SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
89              FINDER_CLASS_NAME_LIST, "countByThumbnailId",
90              new String[] { Long.class.getName() });
91      public static final FinderPath FINDER_PATH_FETCH_BY_FULLIMAGEID = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
92              SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
93              FINDER_CLASS_NAME_ENTITY, "fetchByFullImageId",
94              new String[] { Long.class.getName() });
95      public static final FinderPath FINDER_PATH_COUNT_BY_FULLIMAGEID = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
96              SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
97              FINDER_CLASS_NAME_LIST, "countByFullImageId",
98              new String[] { Long.class.getName() });
99      public static final FinderPath FINDER_PATH_FETCH_BY_P_P = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
100             SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
101             FINDER_CLASS_NAME_ENTITY, "fetchByP_P",
102             new String[] { Long.class.getName(), Integer.class.getName() });
103     public static final FinderPath FINDER_PATH_COUNT_BY_P_P = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
104             SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
105             FINDER_CLASS_NAME_LIST, "countByP_P",
106             new String[] { Long.class.getName(), Integer.class.getName() });
107     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
108             SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
109             FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
110     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
111             SCProductScreenshotModelImpl.FINDER_CACHE_ENABLED,
112             FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
113 
114     public void cacheResult(SCProductScreenshot scProductScreenshot) {
115         EntityCacheUtil.putResult(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
116             SCProductScreenshotImpl.class, scProductScreenshot.getPrimaryKey(),
117             scProductScreenshot);
118 
119         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
120             new Object[] { new Long(scProductScreenshot.getThumbnailId()) },
121             scProductScreenshot);
122 
123         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
124             new Object[] { new Long(scProductScreenshot.getFullImageId()) },
125             scProductScreenshot);
126 
127         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_P,
128             new Object[] {
129                 new Long(scProductScreenshot.getProductEntryId()),
130                 new Integer(scProductScreenshot.getPriority())
131             }, scProductScreenshot);
132     }
133 
134     public void cacheResult(List<SCProductScreenshot> scProductScreenshots) {
135         for (SCProductScreenshot scProductScreenshot : scProductScreenshots) {
136             if (EntityCacheUtil.getResult(
137                         SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
138                         SCProductScreenshotImpl.class,
139                         scProductScreenshot.getPrimaryKey(), this) == null) {
140                 cacheResult(scProductScreenshot);
141             }
142         }
143     }
144 
145     public void clearCache() {
146         CacheRegistry.clear(SCProductScreenshotImpl.class.getName());
147         EntityCacheUtil.clearCache(SCProductScreenshotImpl.class.getName());
148         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
149         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
150     }
151 
152     public SCProductScreenshot create(long productScreenshotId) {
153         SCProductScreenshot scProductScreenshot = new SCProductScreenshotImpl();
154 
155         scProductScreenshot.setNew(true);
156         scProductScreenshot.setPrimaryKey(productScreenshotId);
157 
158         return scProductScreenshot;
159     }
160 
161     public SCProductScreenshot remove(long productScreenshotId)
162         throws NoSuchProductScreenshotException, SystemException {
163         Session session = null;
164 
165         try {
166             session = openSession();
167 
168             SCProductScreenshot scProductScreenshot = (SCProductScreenshot)session.get(SCProductScreenshotImpl.class,
169                     new Long(productScreenshotId));
170 
171             if (scProductScreenshot == null) {
172                 if (_log.isWarnEnabled()) {
173                     _log.warn(
174                         "No SCProductScreenshot exists with the primary key " +
175                         productScreenshotId);
176                 }
177 
178                 throw new NoSuchProductScreenshotException(
179                     "No SCProductScreenshot exists with the primary key " +
180                     productScreenshotId);
181             }
182 
183             return remove(scProductScreenshot);
184         }
185         catch (NoSuchProductScreenshotException nsee) {
186             throw nsee;
187         }
188         catch (Exception e) {
189             throw processException(e);
190         }
191         finally {
192             closeSession(session);
193         }
194     }
195 
196     public SCProductScreenshot remove(SCProductScreenshot scProductScreenshot)
197         throws SystemException {
198         for (ModelListener<SCProductScreenshot> listener : listeners) {
199             listener.onBeforeRemove(scProductScreenshot);
200         }
201 
202         scProductScreenshot = removeImpl(scProductScreenshot);
203 
204         for (ModelListener<SCProductScreenshot> listener : listeners) {
205             listener.onAfterRemove(scProductScreenshot);
206         }
207 
208         return scProductScreenshot;
209     }
210 
211     protected SCProductScreenshot removeImpl(
212         SCProductScreenshot scProductScreenshot) throws SystemException {
213         Session session = null;
214 
215         try {
216             session = openSession();
217 
218             if (scProductScreenshot.isCachedModel() ||
219                     BatchSessionUtil.isEnabled()) {
220                 Object staleObject = session.get(SCProductScreenshotImpl.class,
221                         scProductScreenshot.getPrimaryKeyObj());
222 
223                 if (staleObject != null) {
224                     session.evict(staleObject);
225                 }
226             }
227 
228             session.delete(scProductScreenshot);
229 
230             session.flush();
231         }
232         catch (Exception e) {
233             throw processException(e);
234         }
235         finally {
236             closeSession(session);
237         }
238 
239         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
240 
241         SCProductScreenshotModelImpl scProductScreenshotModelImpl = (SCProductScreenshotModelImpl)scProductScreenshot;
242 
243         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
244             new Object[] {
245                 new Long(scProductScreenshotModelImpl.getOriginalThumbnailId())
246             });
247 
248         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
249             new Object[] {
250                 new Long(scProductScreenshotModelImpl.getOriginalFullImageId())
251             });
252 
253         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_P_P,
254             new Object[] {
255                 new Long(scProductScreenshotModelImpl.getOriginalProductEntryId()),
256                 new Integer(scProductScreenshotModelImpl.getOriginalPriority())
257             });
258 
259         EntityCacheUtil.removeResult(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
260             SCProductScreenshotImpl.class, scProductScreenshot.getPrimaryKey());
261 
262         return scProductScreenshot;
263     }
264 
265     /**
266      * @deprecated Use <code>update(SCProductScreenshot scProductScreenshot, boolean merge)</code>.
267      */
268     public SCProductScreenshot update(SCProductScreenshot scProductScreenshot)
269         throws SystemException {
270         if (_log.isWarnEnabled()) {
271             _log.warn(
272                 "Using the deprecated update(SCProductScreenshot scProductScreenshot) method. Use update(SCProductScreenshot scProductScreenshot, boolean merge) instead.");
273         }
274 
275         return update(scProductScreenshot, false);
276     }
277 
278     /**
279      * Add, update, or merge, the entity. This method also calls the model
280      * listeners to trigger the proper events associated with adding, deleting,
281      * or updating an entity.
282      *
283      * @param        scProductScreenshot the entity to add, update, or merge
284      * @param        merge boolean value for whether to merge the entity. The
285      *                default value is false. Setting merge to true is more
286      *                expensive and should only be true when scProductScreenshot is
287      *                transient. See LEP-5473 for a detailed discussion of this
288      *                method.
289      * @return        true if the portlet can be displayed via Ajax
290      */
291     public SCProductScreenshot update(SCProductScreenshot scProductScreenshot,
292         boolean merge) throws SystemException {
293         boolean isNew = scProductScreenshot.isNew();
294 
295         for (ModelListener<SCProductScreenshot> listener : listeners) {
296             if (isNew) {
297                 listener.onBeforeCreate(scProductScreenshot);
298             }
299             else {
300                 listener.onBeforeUpdate(scProductScreenshot);
301             }
302         }
303 
304         scProductScreenshot = updateImpl(scProductScreenshot, merge);
305 
306         for (ModelListener<SCProductScreenshot> listener : listeners) {
307             if (isNew) {
308                 listener.onAfterCreate(scProductScreenshot);
309             }
310             else {
311                 listener.onAfterUpdate(scProductScreenshot);
312             }
313         }
314 
315         return scProductScreenshot;
316     }
317 
318     public SCProductScreenshot updateImpl(
319         com.liferay.portlet.softwarecatalog.model.SCProductScreenshot scProductScreenshot,
320         boolean merge) throws SystemException {
321         boolean isNew = scProductScreenshot.isNew();
322 
323         SCProductScreenshotModelImpl scProductScreenshotModelImpl = (SCProductScreenshotModelImpl)scProductScreenshot;
324 
325         Session session = null;
326 
327         try {
328             session = openSession();
329 
330             BatchSessionUtil.update(session, scProductScreenshot, merge);
331 
332             scProductScreenshot.setNew(false);
333         }
334         catch (Exception e) {
335             throw processException(e);
336         }
337         finally {
338             closeSession(session);
339         }
340 
341         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
342 
343         EntityCacheUtil.putResult(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
344             SCProductScreenshotImpl.class, scProductScreenshot.getPrimaryKey(),
345             scProductScreenshot);
346 
347         if (!isNew &&
348                 (scProductScreenshot.getThumbnailId() != scProductScreenshotModelImpl.getOriginalThumbnailId())) {
349             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
350                 new Object[] {
351                     new Long(scProductScreenshotModelImpl.getOriginalThumbnailId())
352                 });
353         }
354 
355         if (isNew ||
356                 (scProductScreenshot.getThumbnailId() != scProductScreenshotModelImpl.getOriginalThumbnailId())) {
357             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
358                 new Object[] { new Long(scProductScreenshot.getThumbnailId()) },
359                 scProductScreenshot);
360         }
361 
362         if (!isNew &&
363                 (scProductScreenshot.getFullImageId() != scProductScreenshotModelImpl.getOriginalFullImageId())) {
364             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
365                 new Object[] {
366                     new Long(scProductScreenshotModelImpl.getOriginalFullImageId())
367                 });
368         }
369 
370         if (isNew ||
371                 (scProductScreenshot.getFullImageId() != scProductScreenshotModelImpl.getOriginalFullImageId())) {
372             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
373                 new Object[] { new Long(scProductScreenshot.getFullImageId()) },
374                 scProductScreenshot);
375         }
376 
377         if (!isNew &&
378                 ((scProductScreenshot.getProductEntryId() != scProductScreenshotModelImpl.getOriginalProductEntryId()) ||
379                 (scProductScreenshot.getPriority() != scProductScreenshotModelImpl.getOriginalPriority()))) {
380             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_P_P,
381                 new Object[] {
382                     new Long(scProductScreenshotModelImpl.getOriginalProductEntryId()),
383                     new Integer(scProductScreenshotModelImpl.getOriginalPriority())
384                 });
385         }
386 
387         if (isNew ||
388                 ((scProductScreenshot.getProductEntryId() != scProductScreenshotModelImpl.getOriginalProductEntryId()) ||
389                 (scProductScreenshot.getPriority() != scProductScreenshotModelImpl.getOriginalPriority()))) {
390             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_P,
391                 new Object[] {
392                     new Long(scProductScreenshot.getProductEntryId()),
393                     new Integer(scProductScreenshot.getPriority())
394                 }, scProductScreenshot);
395         }
396 
397         return scProductScreenshot;
398     }
399 
400     public SCProductScreenshot findByPrimaryKey(long productScreenshotId)
401         throws NoSuchProductScreenshotException, SystemException {
402         SCProductScreenshot scProductScreenshot = fetchByPrimaryKey(productScreenshotId);
403 
404         if (scProductScreenshot == null) {
405             if (_log.isWarnEnabled()) {
406                 _log.warn("No SCProductScreenshot exists with the primary key " +
407                     productScreenshotId);
408             }
409 
410             throw new NoSuchProductScreenshotException(
411                 "No SCProductScreenshot exists with the primary key " +
412                 productScreenshotId);
413         }
414 
415         return scProductScreenshot;
416     }
417 
418     public SCProductScreenshot fetchByPrimaryKey(long productScreenshotId)
419         throws SystemException {
420         SCProductScreenshot scProductScreenshot = (SCProductScreenshot)EntityCacheUtil.getResult(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
421                 SCProductScreenshotImpl.class, productScreenshotId, this);
422 
423         if (scProductScreenshot == null) {
424             Session session = null;
425 
426             try {
427                 session = openSession();
428 
429                 scProductScreenshot = (SCProductScreenshot)session.get(SCProductScreenshotImpl.class,
430                         new Long(productScreenshotId));
431             }
432             catch (Exception e) {
433                 throw processException(e);
434             }
435             finally {
436                 if (scProductScreenshot != null) {
437                     cacheResult(scProductScreenshot);
438                 }
439 
440                 closeSession(session);
441             }
442         }
443 
444         return scProductScreenshot;
445     }
446 
447     public List<SCProductScreenshot> findByProductEntryId(long productEntryId)
448         throws SystemException {
449         Object[] finderArgs = new Object[] { new Long(productEntryId) };
450 
451         List<SCProductScreenshot> list = (List<SCProductScreenshot>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_PRODUCTENTRYID,
452                 finderArgs, this);
453 
454         if (list == null) {
455             Session session = null;
456 
457             try {
458                 session = openSession();
459 
460                 StringBuilder query = new StringBuilder();
461 
462                 query.append(
463                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductScreenshot WHERE ");
464 
465                 query.append("productEntryId = ?");
466 
467                 query.append(" ");
468 
469                 query.append("ORDER BY ");
470 
471                 query.append("productEntryId ASC, ");
472                 query.append("priority ASC");
473 
474                 Query q = session.createQuery(query.toString());
475 
476                 QueryPos qPos = QueryPos.getInstance(q);
477 
478                 qPos.add(productEntryId);
479 
480                 list = q.list();
481             }
482             catch (Exception e) {
483                 throw processException(e);
484             }
485             finally {
486                 if (list == null) {
487                     list = new ArrayList<SCProductScreenshot>();
488                 }
489 
490                 cacheResult(list);
491 
492                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_PRODUCTENTRYID,
493                     finderArgs, list);
494 
495                 closeSession(session);
496             }
497         }
498 
499         return list;
500     }
501 
502     public List<SCProductScreenshot> findByProductEntryId(long productEntryId,
503         int start, int end) throws SystemException {
504         return findByProductEntryId(productEntryId, start, end, null);
505     }
506 
507     public List<SCProductScreenshot> findByProductEntryId(long productEntryId,
508         int start, int end, OrderByComparator obc) throws SystemException {
509         Object[] finderArgs = new Object[] {
510                 new Long(productEntryId),
511                 
512                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
513             };
514 
515         List<SCProductScreenshot> list = (List<SCProductScreenshot>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_PRODUCTENTRYID,
516                 finderArgs, this);
517 
518         if (list == null) {
519             Session session = null;
520 
521             try {
522                 session = openSession();
523 
524                 StringBuilder query = new StringBuilder();
525 
526                 query.append(
527                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductScreenshot WHERE ");
528 
529                 query.append("productEntryId = ?");
530 
531                 query.append(" ");
532 
533                 if (obc != null) {
534                     query.append("ORDER BY ");
535                     query.append(obc.getOrderBy());
536                 }
537 
538                 else {
539                     query.append("ORDER BY ");
540 
541                     query.append("productEntryId ASC, ");
542                     query.append("priority ASC");
543                 }
544 
545                 Query q = session.createQuery(query.toString());
546 
547                 QueryPos qPos = QueryPos.getInstance(q);
548 
549                 qPos.add(productEntryId);
550 
551                 list = (List<SCProductScreenshot>)QueryUtil.list(q,
552                         getDialect(), start, end);
553             }
554             catch (Exception e) {
555                 throw processException(e);
556             }
557             finally {
558                 if (list == null) {
559                     list = new ArrayList<SCProductScreenshot>();
560                 }
561 
562                 cacheResult(list);
563 
564                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_PRODUCTENTRYID,
565                     finderArgs, list);
566 
567                 closeSession(session);
568             }
569         }
570 
571         return list;
572     }
573 
574     public SCProductScreenshot findByProductEntryId_First(long productEntryId,
575         OrderByComparator obc)
576         throws NoSuchProductScreenshotException, SystemException {
577         List<SCProductScreenshot> list = findByProductEntryId(productEntryId,
578                 0, 1, obc);
579 
580         if (list.isEmpty()) {
581             StringBuilder msg = new StringBuilder();
582 
583             msg.append("No SCProductScreenshot exists with the key {");
584 
585             msg.append("productEntryId=" + productEntryId);
586 
587             msg.append(StringPool.CLOSE_CURLY_BRACE);
588 
589             throw new NoSuchProductScreenshotException(msg.toString());
590         }
591         else {
592             return list.get(0);
593         }
594     }
595 
596     public SCProductScreenshot findByProductEntryId_Last(long productEntryId,
597         OrderByComparator obc)
598         throws NoSuchProductScreenshotException, SystemException {
599         int count = countByProductEntryId(productEntryId);
600 
601         List<SCProductScreenshot> list = findByProductEntryId(productEntryId,
602                 count - 1, count, obc);
603 
604         if (list.isEmpty()) {
605             StringBuilder msg = new StringBuilder();
606 
607             msg.append("No SCProductScreenshot exists with the key {");
608 
609             msg.append("productEntryId=" + productEntryId);
610 
611             msg.append(StringPool.CLOSE_CURLY_BRACE);
612 
613             throw new NoSuchProductScreenshotException(msg.toString());
614         }
615         else {
616             return list.get(0);
617         }
618     }
619 
620     public SCProductScreenshot[] findByProductEntryId_PrevAndNext(
621         long productScreenshotId, long productEntryId, OrderByComparator obc)
622         throws NoSuchProductScreenshotException, SystemException {
623         SCProductScreenshot scProductScreenshot = findByPrimaryKey(productScreenshotId);
624 
625         int count = countByProductEntryId(productEntryId);
626 
627         Session session = null;
628 
629         try {
630             session = openSession();
631 
632             StringBuilder query = new StringBuilder();
633 
634             query.append(
635                 "FROM com.liferay.portlet.softwarecatalog.model.SCProductScreenshot WHERE ");
636 
637             query.append("productEntryId = ?");
638 
639             query.append(" ");
640 
641             if (obc != null) {
642                 query.append("ORDER BY ");
643                 query.append(obc.getOrderBy());
644             }
645 
646             else {
647                 query.append("ORDER BY ");
648 
649                 query.append("productEntryId ASC, ");
650                 query.append("priority ASC");
651             }
652 
653             Query q = session.createQuery(query.toString());
654 
655             QueryPos qPos = QueryPos.getInstance(q);
656 
657             qPos.add(productEntryId);
658 
659             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
660                     scProductScreenshot);
661 
662             SCProductScreenshot[] array = new SCProductScreenshotImpl[3];
663 
664             array[0] = (SCProductScreenshot)objArray[0];
665             array[1] = (SCProductScreenshot)objArray[1];
666             array[2] = (SCProductScreenshot)objArray[2];
667 
668             return array;
669         }
670         catch (Exception e) {
671             throw processException(e);
672         }
673         finally {
674             closeSession(session);
675         }
676     }
677 
678     public SCProductScreenshot findByThumbnailId(long thumbnailId)
679         throws NoSuchProductScreenshotException, SystemException {
680         SCProductScreenshot scProductScreenshot = fetchByThumbnailId(thumbnailId);
681 
682         if (scProductScreenshot == null) {
683             StringBuilder msg = new StringBuilder();
684 
685             msg.append("No SCProductScreenshot exists with the key {");
686 
687             msg.append("thumbnailId=" + thumbnailId);
688 
689             msg.append(StringPool.CLOSE_CURLY_BRACE);
690 
691             if (_log.isWarnEnabled()) {
692                 _log.warn(msg.toString());
693             }
694 
695             throw new NoSuchProductScreenshotException(msg.toString());
696         }
697 
698         return scProductScreenshot;
699     }
700 
701     public SCProductScreenshot fetchByThumbnailId(long thumbnailId)
702         throws SystemException {
703         return fetchByThumbnailId(thumbnailId, true);
704     }
705 
706     public SCProductScreenshot fetchByThumbnailId(long thumbnailId,
707         boolean retrieveFromCache) throws SystemException {
708         Object[] finderArgs = new Object[] { new Long(thumbnailId) };
709 
710         Object result = null;
711 
712         if (retrieveFromCache) {
713             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
714                     finderArgs, this);
715         }
716 
717         if (result == null) {
718             Session session = null;
719 
720             try {
721                 session = openSession();
722 
723                 StringBuilder query = new StringBuilder();
724 
725                 query.append(
726                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductScreenshot WHERE ");
727 
728                 query.append("thumbnailId = ?");
729 
730                 query.append(" ");
731 
732                 query.append("ORDER BY ");
733 
734                 query.append("productEntryId ASC, ");
735                 query.append("priority ASC");
736 
737                 Query q = session.createQuery(query.toString());
738 
739                 QueryPos qPos = QueryPos.getInstance(q);
740 
741                 qPos.add(thumbnailId);
742 
743                 List<SCProductScreenshot> list = q.list();
744 
745                 result = list;
746 
747                 SCProductScreenshot scProductScreenshot = null;
748 
749                 if (list.isEmpty()) {
750                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
751                         finderArgs, list);
752                 }
753                 else {
754                     scProductScreenshot = list.get(0);
755 
756                     cacheResult(scProductScreenshot);
757 
758                     if ((scProductScreenshot.getThumbnailId() != thumbnailId)) {
759                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
760                             finderArgs, scProductScreenshot);
761                     }
762                 }
763 
764                 return scProductScreenshot;
765             }
766             catch (Exception e) {
767                 throw processException(e);
768             }
769             finally {
770                 if (result == null) {
771                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
772                         finderArgs, new ArrayList<SCProductScreenshot>());
773                 }
774 
775                 closeSession(session);
776             }
777         }
778         else {
779             if (result instanceof List) {
780                 return null;
781             }
782             else {
783                 return (SCProductScreenshot)result;
784             }
785         }
786     }
787 
788     public SCProductScreenshot findByFullImageId(long fullImageId)
789         throws NoSuchProductScreenshotException, SystemException {
790         SCProductScreenshot scProductScreenshot = fetchByFullImageId(fullImageId);
791 
792         if (scProductScreenshot == null) {
793             StringBuilder msg = new StringBuilder();
794 
795             msg.append("No SCProductScreenshot exists with the key {");
796 
797             msg.append("fullImageId=" + fullImageId);
798 
799             msg.append(StringPool.CLOSE_CURLY_BRACE);
800 
801             if (_log.isWarnEnabled()) {
802                 _log.warn(msg.toString());
803             }
804 
805             throw new NoSuchProductScreenshotException(msg.toString());
806         }
807 
808         return scProductScreenshot;
809     }
810 
811     public SCProductScreenshot fetchByFullImageId(long fullImageId)
812         throws SystemException {
813         return fetchByFullImageId(fullImageId, true);
814     }
815 
816     public SCProductScreenshot fetchByFullImageId(long fullImageId,
817         boolean retrieveFromCache) throws SystemException {
818         Object[] finderArgs = new Object[] { new Long(fullImageId) };
819 
820         Object result = null;
821 
822         if (retrieveFromCache) {
823             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
824                     finderArgs, this);
825         }
826 
827         if (result == null) {
828             Session session = null;
829 
830             try {
831                 session = openSession();
832 
833                 StringBuilder query = new StringBuilder();
834 
835                 query.append(
836                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductScreenshot WHERE ");
837 
838                 query.append("fullImageId = ?");
839 
840                 query.append(" ");
841 
842                 query.append("ORDER BY ");
843 
844                 query.append("productEntryId ASC, ");
845                 query.append("priority ASC");
846 
847                 Query q = session.createQuery(query.toString());
848 
849                 QueryPos qPos = QueryPos.getInstance(q);
850 
851                 qPos.add(fullImageId);
852 
853                 List<SCProductScreenshot> list = q.list();
854 
855                 result = list;
856 
857                 SCProductScreenshot scProductScreenshot = null;
858 
859                 if (list.isEmpty()) {
860                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
861                         finderArgs, list);
862                 }
863                 else {
864                     scProductScreenshot = list.get(0);
865 
866                     cacheResult(scProductScreenshot);
867 
868                     if ((scProductScreenshot.getFullImageId() != fullImageId)) {
869                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
870                             finderArgs, scProductScreenshot);
871                     }
872                 }
873 
874                 return scProductScreenshot;
875             }
876             catch (Exception e) {
877                 throw processException(e);
878             }
879             finally {
880                 if (result == null) {
881                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
882                         finderArgs, new ArrayList<SCProductScreenshot>());
883                 }
884 
885                 closeSession(session);
886             }
887         }
888         else {
889             if (result instanceof List) {
890                 return null;
891             }
892             else {
893                 return (SCProductScreenshot)result;
894             }
895         }
896     }
897 
898     public SCProductScreenshot findByP_P(long productEntryId, int priority)
899         throws NoSuchProductScreenshotException, SystemException {
900         SCProductScreenshot scProductScreenshot = fetchByP_P(productEntryId,
901                 priority);
902 
903         if (scProductScreenshot == null) {
904             StringBuilder msg = new StringBuilder();
905 
906             msg.append("No SCProductScreenshot exists with the key {");
907 
908             msg.append("productEntryId=" + productEntryId);
909 
910             msg.append(", ");
911             msg.append("priority=" + priority);
912 
913             msg.append(StringPool.CLOSE_CURLY_BRACE);
914 
915             if (_log.isWarnEnabled()) {
916                 _log.warn(msg.toString());
917             }
918 
919             throw new NoSuchProductScreenshotException(msg.toString());
920         }
921 
922         return scProductScreenshot;
923     }
924 
925     public SCProductScreenshot fetchByP_P(long productEntryId, int priority)
926         throws SystemException {
927         return fetchByP_P(productEntryId, priority, true);
928     }
929 
930     public SCProductScreenshot fetchByP_P(long productEntryId, int priority,
931         boolean retrieveFromCache) throws SystemException {
932         Object[] finderArgs = new Object[] {
933                 new Long(productEntryId), new Integer(priority)
934             };
935 
936         Object result = null;
937 
938         if (retrieveFromCache) {
939             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_P_P,
940                     finderArgs, this);
941         }
942 
943         if (result == null) {
944             Session session = null;
945 
946             try {
947                 session = openSession();
948 
949                 StringBuilder query = new StringBuilder();
950 
951                 query.append(
952                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductScreenshot WHERE ");
953 
954                 query.append("productEntryId = ?");
955 
956                 query.append(" AND ");
957 
958                 query.append("priority = ?");
959 
960                 query.append(" ");
961 
962                 query.append("ORDER BY ");
963 
964                 query.append("productEntryId ASC, ");
965                 query.append("priority ASC");
966 
967                 Query q = session.createQuery(query.toString());
968 
969                 QueryPos qPos = QueryPos.getInstance(q);
970 
971                 qPos.add(productEntryId);
972 
973                 qPos.add(priority);
974 
975                 List<SCProductScreenshot> list = q.list();
976 
977                 result = list;
978 
979                 SCProductScreenshot scProductScreenshot = null;
980 
981                 if (list.isEmpty()) {
982                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_P,
983                         finderArgs, list);
984                 }
985                 else {
986                     scProductScreenshot = list.get(0);
987 
988                     cacheResult(scProductScreenshot);
989 
990                     if ((scProductScreenshot.getProductEntryId() != productEntryId) ||
991                             (scProductScreenshot.getPriority() != priority)) {
992                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_P,
993                             finderArgs, scProductScreenshot);
994                     }
995                 }
996 
997                 return scProductScreenshot;
998             }
999             catch (Exception e) {
1000                throw processException(e);
1001            }
1002            finally {
1003                if (result == null) {
1004                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_P,
1005                        finderArgs, new ArrayList<SCProductScreenshot>());
1006                }
1007
1008                closeSession(session);
1009            }
1010        }
1011        else {
1012            if (result instanceof List) {
1013                return null;
1014            }
1015            else {
1016                return (SCProductScreenshot)result;
1017            }
1018        }
1019    }
1020
1021    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1022        throws SystemException {
1023        Session session = null;
1024
1025        try {
1026            session = openSession();
1027
1028            dynamicQuery.compile(session);
1029
1030            return dynamicQuery.list();
1031        }
1032        catch (Exception e) {
1033            throw processException(e);
1034        }
1035        finally {
1036            closeSession(session);
1037        }
1038    }
1039
1040    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1041        int start, int end) throws SystemException {
1042        Session session = null;
1043
1044        try {
1045            session = openSession();
1046
1047            dynamicQuery.setLimit(start, end);
1048
1049            dynamicQuery.compile(session);
1050
1051            return dynamicQuery.list();
1052        }
1053        catch (Exception e) {
1054            throw processException(e);
1055        }
1056        finally {
1057            closeSession(session);
1058        }
1059    }
1060
1061    public List<SCProductScreenshot> findAll() throws SystemException {
1062        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1063    }
1064
1065    public List<SCProductScreenshot> findAll(int start, int end)
1066        throws SystemException {
1067        return findAll(start, end, null);
1068    }
1069
1070    public List<SCProductScreenshot> findAll(int start, int end,
1071        OrderByComparator obc) throws SystemException {
1072        Object[] finderArgs = new Object[] {
1073                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1074            };
1075
1076        List<SCProductScreenshot> list = (List<SCProductScreenshot>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1077                finderArgs, this);
1078
1079        if (list == null) {
1080            Session session = null;
1081
1082            try {
1083                session = openSession();
1084
1085                StringBuilder query = new StringBuilder();
1086
1087                query.append(
1088                    "FROM com.liferay.portlet.softwarecatalog.model.SCProductScreenshot ");
1089
1090                if (obc != null) {
1091                    query.append("ORDER BY ");
1092                    query.append(obc.getOrderBy());
1093                }
1094
1095                else {
1096                    query.append("ORDER BY ");
1097
1098                    query.append("productEntryId ASC, ");
1099                    query.append("priority ASC");
1100                }
1101
1102                Query q = session.createQuery(query.toString());
1103
1104                if (obc == null) {
1105                    list = (List<SCProductScreenshot>)QueryUtil.list(q,
1106                            getDialect(), start, end, false);
1107
1108                    Collections.sort(list);
1109                }
1110                else {
1111                    list = (List<SCProductScreenshot>)QueryUtil.list(q,
1112                            getDialect(), start, end);
1113                }
1114            }
1115            catch (Exception e) {
1116                throw processException(e);
1117            }
1118            finally {
1119                if (list == null) {
1120                    list = new ArrayList<SCProductScreenshot>();
1121                }
1122
1123                cacheResult(list);
1124
1125                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1126
1127                closeSession(session);
1128            }
1129        }
1130
1131        return list;
1132    }
1133
1134    public void removeByProductEntryId(long productEntryId)
1135        throws SystemException {
1136        for (SCProductScreenshot scProductScreenshot : findByProductEntryId(
1137                productEntryId)) {
1138            remove(scProductScreenshot);
1139        }
1140    }
1141
1142    public void removeByThumbnailId(long thumbnailId)
1143        throws NoSuchProductScreenshotException, SystemException {
1144        SCProductScreenshot scProductScreenshot = findByThumbnailId(thumbnailId);
1145
1146        remove(scProductScreenshot);
1147    }
1148
1149    public void removeByFullImageId(long fullImageId)
1150        throws NoSuchProductScreenshotException, SystemException {
1151        SCProductScreenshot scProductScreenshot = findByFullImageId(fullImageId);
1152
1153        remove(scProductScreenshot);
1154    }
1155
1156    public void removeByP_P(long productEntryId, int priority)
1157        throws NoSuchProductScreenshotException, SystemException {
1158        SCProductScreenshot scProductScreenshot = findByP_P(productEntryId,
1159                priority);
1160
1161        remove(scProductScreenshot);
1162    }
1163
1164    public void removeAll() throws SystemException {
1165        for (SCProductScreenshot scProductScreenshot : findAll()) {
1166            remove(scProductScreenshot);
1167        }
1168    }
1169
1170    public int countByProductEntryId(long productEntryId)
1171        throws SystemException {
1172        Object[] finderArgs = new Object[] { new Long(productEntryId) };
1173
1174        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_PRODUCTENTRYID,
1175                finderArgs, this);
1176
1177        if (count == null) {
1178            Session session = null;
1179
1180            try {
1181                session = openSession();
1182
1183                StringBuilder query = new StringBuilder();
1184
1185                query.append("SELECT COUNT(*) ");
1186                query.append(
1187                    "FROM com.liferay.portlet.softwarecatalog.model.SCProductScreenshot WHERE ");
1188
1189                query.append("productEntryId = ?");
1190
1191                query.append(" ");
1192
1193                Query q = session.createQuery(query.toString());
1194
1195                QueryPos qPos = QueryPos.getInstance(q);
1196
1197                qPos.add(productEntryId);
1198
1199                count = (Long)q.uniqueResult();
1200            }
1201            catch (Exception e) {
1202                throw processException(e);
1203            }
1204            finally {
1205                if (count == null) {
1206                    count = Long.valueOf(0);
1207                }
1208
1209                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_PRODUCTENTRYID,
1210                    finderArgs, count);
1211
1212                closeSession(session);
1213            }
1214        }
1215
1216        return count.intValue();
1217    }
1218
1219    public int countByThumbnailId(long thumbnailId) throws SystemException {
1220        Object[] finderArgs = new Object[] { new Long(thumbnailId) };
1221
1222        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_THUMBNAILID,
1223                finderArgs, this);
1224
1225        if (count == null) {
1226            Session session = null;
1227
1228            try {
1229                session = openSession();
1230
1231                StringBuilder query = new StringBuilder();
1232
1233                query.append("SELECT COUNT(*) ");
1234                query.append(
1235                    "FROM com.liferay.portlet.softwarecatalog.model.SCProductScreenshot WHERE ");
1236
1237                query.append("thumbnailId = ?");
1238
1239                query.append(" ");
1240
1241                Query q = session.createQuery(query.toString());
1242
1243                QueryPos qPos = QueryPos.getInstance(q);
1244
1245                qPos.add(thumbnailId);
1246
1247                count = (Long)q.uniqueResult();
1248            }
1249            catch (Exception e) {
1250                throw processException(e);
1251            }
1252            finally {
1253                if (count == null) {
1254                    count = Long.valueOf(0);
1255                }
1256
1257                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_THUMBNAILID,
1258                    finderArgs, count);
1259
1260                closeSession(session);
1261            }
1262        }
1263
1264        return count.intValue();
1265    }
1266
1267    public int countByFullImageId(long fullImageId) throws SystemException {
1268        Object[] finderArgs = new Object[] { new Long(fullImageId) };
1269
1270        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_FULLIMAGEID,
1271                finderArgs, this);
1272
1273        if (count == null) {
1274            Session session = null;
1275
1276            try {
1277                session = openSession();
1278
1279                StringBuilder query = new StringBuilder();
1280
1281                query.append("SELECT COUNT(*) ");
1282                query.append(
1283                    "FROM com.liferay.portlet.softwarecatalog.model.SCProductScreenshot WHERE ");
1284
1285                query.append("fullImageId = ?");
1286
1287                query.append(" ");
1288
1289                Query q = session.createQuery(query.toString());
1290
1291                QueryPos qPos = QueryPos.getInstance(q);
1292
1293                qPos.add(fullImageId);
1294
1295                count = (Long)q.uniqueResult();
1296            }
1297            catch (Exception e) {
1298                throw processException(e);
1299            }
1300            finally {
1301                if (count == null) {
1302                    count = Long.valueOf(0);
1303                }
1304
1305                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FULLIMAGEID,
1306                    finderArgs, count);
1307
1308                closeSession(session);
1309            }
1310        }
1311
1312        return count.intValue();
1313    }
1314
1315    public int countByP_P(long productEntryId, int priority)
1316        throws SystemException {
1317        Object[] finderArgs = new Object[] {
1318                new Long(productEntryId), new Integer(priority)
1319            };
1320
1321        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_P,
1322                finderArgs, this);
1323
1324        if (count == null) {
1325            Session session = null;
1326
1327            try {
1328                session = openSession();
1329
1330                StringBuilder query = new StringBuilder();
1331
1332                query.append("SELECT COUNT(*) ");
1333                query.append(
1334                    "FROM com.liferay.portlet.softwarecatalog.model.SCProductScreenshot WHERE ");
1335
1336                query.append("productEntryId = ?");
1337
1338                query.append(" AND ");
1339
1340                query.append("priority = ?");
1341
1342                query.append(" ");
1343
1344                Query q = session.createQuery(query.toString());
1345
1346                QueryPos qPos = QueryPos.getInstance(q);
1347
1348                qPos.add(productEntryId);
1349
1350                qPos.add(priority);
1351
1352                count = (Long)q.uniqueResult();
1353            }
1354            catch (Exception e) {
1355                throw processException(e);
1356            }
1357            finally {
1358                if (count == null) {
1359                    count = Long.valueOf(0);
1360                }
1361
1362                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_P, finderArgs,
1363                    count);
1364
1365                closeSession(session);
1366            }
1367        }
1368
1369        return count.intValue();
1370    }
1371
1372    public int countAll() throws SystemException {
1373        Object[] finderArgs = new Object[0];
1374
1375        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1376                finderArgs, this);
1377
1378        if (count == null) {
1379            Session session = null;
1380
1381            try {
1382                session = openSession();
1383
1384                Query q = session.createQuery(
1385                        "SELECT COUNT(*) FROM com.liferay.portlet.softwarecatalog.model.SCProductScreenshot");
1386
1387                count = (Long)q.uniqueResult();
1388            }
1389            catch (Exception e) {
1390                throw processException(e);
1391            }
1392            finally {
1393                if (count == null) {
1394                    count = Long.valueOf(0);
1395                }
1396
1397                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1398                    count);
1399
1400                closeSession(session);
1401            }
1402        }
1403
1404        return count.intValue();
1405    }
1406
1407    public void afterPropertiesSet() {
1408        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1409                    com.liferay.portal.util.PropsUtil.get(
1410                        "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot")));
1411
1412        if (listenerClassNames.length > 0) {
1413            try {
1414                List<ModelListener<SCProductScreenshot>> listenersList = new ArrayList<ModelListener<SCProductScreenshot>>();
1415
1416                for (String listenerClassName : listenerClassNames) {
1417                    listenersList.add((ModelListener<SCProductScreenshot>)Class.forName(
1418                            listenerClassName).newInstance());
1419                }
1420
1421                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1422            }
1423            catch (Exception e) {
1424                _log.error(e);
1425            }
1426        }
1427    }
1428
1429    @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCLicensePersistence.impl")
1430    protected com.liferay.portlet.softwarecatalog.service.persistence.SCLicensePersistence scLicensePersistence;
1431    @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCFrameworkVersionPersistence.impl")
1432    protected com.liferay.portlet.softwarecatalog.service.persistence.SCFrameworkVersionPersistence scFrameworkVersionPersistence;
1433    @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCProductEntryPersistence.impl")
1434    protected com.liferay.portlet.softwarecatalog.service.persistence.SCProductEntryPersistence scProductEntryPersistence;
1435    @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCProductScreenshotPersistence.impl")
1436    protected com.liferay.portlet.softwarecatalog.service.persistence.SCProductScreenshotPersistence scProductScreenshotPersistence;
1437    @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCProductVersionPersistence.impl")
1438    protected com.liferay.portlet.softwarecatalog.service.persistence.SCProductVersionPersistence scProductVersionPersistence;
1439    @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence.impl")
1440    protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
1441    private static Log _log = LogFactoryUtil.getLog(SCProductScreenshotPersistenceImpl.class);
1442}