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