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