1   /**
2    * Copyright (c) 2000-2010 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   *
12   * 
13   */
14  
15  package com.liferay.portlet.softwarecatalog.service.persistence;
16  
17  import com.liferay.portal.NoSuchModelException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.kernel.annotation.BeanReference;
20  import com.liferay.portal.kernel.cache.CacheRegistry;
21  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
22  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
23  import com.liferay.portal.kernel.dao.orm.FinderPath;
24  import com.liferay.portal.kernel.dao.orm.Query;
25  import com.liferay.portal.kernel.dao.orm.QueryPos;
26  import com.liferay.portal.kernel.dao.orm.QueryUtil;
27  import com.liferay.portal.kernel.dao.orm.Session;
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     /**
276      * @deprecated Use {@link BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)}.
277      */
278     public SCProductScreenshot update(SCProductScreenshot scProductScreenshot)
279         throws SystemException {
280         if (_log.isWarnEnabled()) {
281             _log.warn(
282                 "Using the deprecated update(SCProductScreenshot scProductScreenshot) method. Use update(SCProductScreenshot scProductScreenshot, boolean merge) instead.");
283         }
284 
285         return update(scProductScreenshot, false);
286     }
287 
288     public SCProductScreenshot updateImpl(
289         com.liferay.portlet.softwarecatalog.model.SCProductScreenshot scProductScreenshot,
290         boolean merge) throws SystemException {
291         scProductScreenshot = toUnwrappedModel(scProductScreenshot);
292 
293         boolean isNew = scProductScreenshot.isNew();
294 
295         SCProductScreenshotModelImpl scProductScreenshotModelImpl = (SCProductScreenshotModelImpl)scProductScreenshot;
296 
297         Session session = null;
298 
299         try {
300             session = openSession();
301 
302             BatchSessionUtil.update(session, scProductScreenshot, merge);
303 
304             scProductScreenshot.setNew(false);
305         }
306         catch (Exception e) {
307             throw processException(e);
308         }
309         finally {
310             closeSession(session);
311         }
312 
313         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
314 
315         EntityCacheUtil.putResult(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
316             SCProductScreenshotImpl.class, scProductScreenshot.getPrimaryKey(),
317             scProductScreenshot);
318 
319         if (!isNew &&
320                 (scProductScreenshot.getThumbnailId() != scProductScreenshotModelImpl.getOriginalThumbnailId())) {
321             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
322                 new Object[] {
323                     new Long(scProductScreenshotModelImpl.getOriginalThumbnailId())
324                 });
325         }
326 
327         if (isNew ||
328                 (scProductScreenshot.getThumbnailId() != scProductScreenshotModelImpl.getOriginalThumbnailId())) {
329             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
330                 new Object[] { new Long(scProductScreenshot.getThumbnailId()) },
331                 scProductScreenshot);
332         }
333 
334         if (!isNew &&
335                 (scProductScreenshot.getFullImageId() != scProductScreenshotModelImpl.getOriginalFullImageId())) {
336             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
337                 new Object[] {
338                     new Long(scProductScreenshotModelImpl.getOriginalFullImageId())
339                 });
340         }
341 
342         if (isNew ||
343                 (scProductScreenshot.getFullImageId() != scProductScreenshotModelImpl.getOriginalFullImageId())) {
344             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
345                 new Object[] { new Long(scProductScreenshot.getFullImageId()) },
346                 scProductScreenshot);
347         }
348 
349         if (!isNew &&
350                 ((scProductScreenshot.getProductEntryId() != scProductScreenshotModelImpl.getOriginalProductEntryId()) ||
351                 (scProductScreenshot.getPriority() != scProductScreenshotModelImpl.getOriginalPriority()))) {
352             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_P_P,
353                 new Object[] {
354                     new Long(scProductScreenshotModelImpl.getOriginalProductEntryId()),
355                     new Integer(scProductScreenshotModelImpl.getOriginalPriority())
356                 });
357         }
358 
359         if (isNew ||
360                 ((scProductScreenshot.getProductEntryId() != scProductScreenshotModelImpl.getOriginalProductEntryId()) ||
361                 (scProductScreenshot.getPriority() != scProductScreenshotModelImpl.getOriginalPriority()))) {
362             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_P,
363                 new Object[] {
364                     new Long(scProductScreenshot.getProductEntryId()),
365                     new Integer(scProductScreenshot.getPriority())
366                 }, scProductScreenshot);
367         }
368 
369         return scProductScreenshot;
370     }
371 
372     protected SCProductScreenshot toUnwrappedModel(
373         SCProductScreenshot scProductScreenshot) {
374         if (scProductScreenshot instanceof SCProductScreenshotImpl) {
375             return scProductScreenshot;
376         }
377 
378         SCProductScreenshotImpl scProductScreenshotImpl = new SCProductScreenshotImpl();
379 
380         scProductScreenshotImpl.setNew(scProductScreenshot.isNew());
381         scProductScreenshotImpl.setPrimaryKey(scProductScreenshot.getPrimaryKey());
382 
383         scProductScreenshotImpl.setProductScreenshotId(scProductScreenshot.getProductScreenshotId());
384         scProductScreenshotImpl.setCompanyId(scProductScreenshot.getCompanyId());
385         scProductScreenshotImpl.setGroupId(scProductScreenshot.getGroupId());
386         scProductScreenshotImpl.setProductEntryId(scProductScreenshot.getProductEntryId());
387         scProductScreenshotImpl.setThumbnailId(scProductScreenshot.getThumbnailId());
388         scProductScreenshotImpl.setFullImageId(scProductScreenshot.getFullImageId());
389         scProductScreenshotImpl.setPriority(scProductScreenshot.getPriority());
390 
391         return scProductScreenshotImpl;
392     }
393 
394     public SCProductScreenshot findByPrimaryKey(Serializable primaryKey)
395         throws NoSuchModelException, SystemException {
396         return findByPrimaryKey(((Long)primaryKey).longValue());
397     }
398 
399     public SCProductScreenshot findByPrimaryKey(long productScreenshotId)
400         throws NoSuchProductScreenshotException, SystemException {
401         SCProductScreenshot scProductScreenshot = fetchByPrimaryKey(productScreenshotId);
402 
403         if (scProductScreenshot == null) {
404             if (_log.isWarnEnabled()) {
405                 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
406                     productScreenshotId);
407             }
408 
409             throw new NoSuchProductScreenshotException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
410                 productScreenshotId);
411         }
412 
413         return scProductScreenshot;
414     }
415 
416     public SCProductScreenshot fetchByPrimaryKey(Serializable primaryKey)
417         throws SystemException {
418         return fetchByPrimaryKey(((Long)primaryKey).longValue());
419     }
420 
421     public SCProductScreenshot fetchByPrimaryKey(long productScreenshotId)
422         throws SystemException {
423         SCProductScreenshot scProductScreenshot = (SCProductScreenshot)EntityCacheUtil.getResult(SCProductScreenshotModelImpl.ENTITY_CACHE_ENABLED,
424                 SCProductScreenshotImpl.class, productScreenshotId, this);
425 
426         if (scProductScreenshot == null) {
427             Session session = null;
428 
429             try {
430                 session = openSession();
431 
432                 scProductScreenshot = (SCProductScreenshot)session.get(SCProductScreenshotImpl.class,
433                         new Long(productScreenshotId));
434             }
435             catch (Exception e) {
436                 throw processException(e);
437             }
438             finally {
439                 if (scProductScreenshot != null) {
440                     cacheResult(scProductScreenshot);
441                 }
442 
443                 closeSession(session);
444             }
445         }
446 
447         return scProductScreenshot;
448     }
449 
450     public List<SCProductScreenshot> findByProductEntryId(long productEntryId)
451         throws SystemException {
452         Object[] finderArgs = new Object[] { new Long(productEntryId) };
453 
454         List<SCProductScreenshot> list = (List<SCProductScreenshot>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_PRODUCTENTRYID,
455                 finderArgs, this);
456 
457         if (list == null) {
458             Session session = null;
459 
460             try {
461                 session = openSession();
462 
463                 StringBundler query = new StringBundler(3);
464 
465                 query.append(_SQL_SELECT_SCPRODUCTSCREENSHOT_WHERE);
466 
467                 query.append(_FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2);
468 
469                 query.append(SCProductScreenshotModelImpl.ORDER_BY_JPQL);
470 
471                 String sql = query.toString();
472 
473                 Query q = session.createQuery(sql);
474 
475                 QueryPos qPos = QueryPos.getInstance(q);
476 
477                 qPos.add(productEntryId);
478 
479                 list = q.list();
480             }
481             catch (Exception e) {
482                 throw processException(e);
483             }
484             finally {
485                 if (list == null) {
486                     list = new ArrayList<SCProductScreenshot>();
487                 }
488 
489                 cacheResult(list);
490 
491                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_PRODUCTENTRYID,
492                     finderArgs, list);
493 
494                 closeSession(session);
495             }
496         }
497 
498         return list;
499     }
500 
501     public List<SCProductScreenshot> findByProductEntryId(long productEntryId,
502         int start, int end) throws SystemException {
503         return findByProductEntryId(productEntryId, start, end, null);
504     }
505 
506     public List<SCProductScreenshot> findByProductEntryId(long productEntryId,
507         int start, int end, OrderByComparator orderByComparator)
508         throws SystemException {
509         Object[] finderArgs = new Object[] {
510                 new Long(productEntryId),
511                 
512                 String.valueOf(start), String.valueOf(end),
513                 String.valueOf(orderByComparator)
514             };
515 
516         List<SCProductScreenshot> list = (List<SCProductScreenshot>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_PRODUCTENTRYID,
517                 finderArgs, this);
518 
519         if (list == null) {
520             Session session = null;
521 
522             try {
523                 session = openSession();
524 
525                 StringBundler query = null;
526 
527                 if (orderByComparator != null) {
528                     query = new StringBundler(3 +
529                             (orderByComparator.getOrderByFields().length * 3));
530                 }
531                 else {
532                     query = new StringBundler(3);
533                 }
534 
535                 query.append(_SQL_SELECT_SCPRODUCTSCREENSHOT_WHERE);
536 
537                 query.append(_FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2);
538 
539                 if (orderByComparator != null) {
540                     appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
541                         orderByComparator);
542                 }
543 
544                 else {
545                     query.append(SCProductScreenshotModelImpl.ORDER_BY_JPQL);
546                 }
547 
548                 String sql = query.toString();
549 
550                 Query q = session.createQuery(sql);
551 
552                 QueryPos qPos = QueryPos.getInstance(q);
553 
554                 qPos.add(productEntryId);
555 
556                 list = (List<SCProductScreenshot>)QueryUtil.list(q,
557                         getDialect(), start, end);
558             }
559             catch (Exception e) {
560                 throw processException(e);
561             }
562             finally {
563                 if (list == null) {
564                     list = new ArrayList<SCProductScreenshot>();
565                 }
566 
567                 cacheResult(list);
568 
569                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_PRODUCTENTRYID,
570                     finderArgs, list);
571 
572                 closeSession(session);
573             }
574         }
575 
576         return list;
577     }
578 
579     public SCProductScreenshot findByProductEntryId_First(long productEntryId,
580         OrderByComparator orderByComparator)
581         throws NoSuchProductScreenshotException, SystemException {
582         List<SCProductScreenshot> list = findByProductEntryId(productEntryId,
583                 0, 1, orderByComparator);
584 
585         if (list.isEmpty()) {
586             StringBundler msg = new StringBundler(4);
587 
588             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
589 
590             msg.append("productEntryId=");
591             msg.append(productEntryId);
592 
593             msg.append(StringPool.CLOSE_CURLY_BRACE);
594 
595             throw new NoSuchProductScreenshotException(msg.toString());
596         }
597         else {
598             return list.get(0);
599         }
600     }
601 
602     public SCProductScreenshot findByProductEntryId_Last(long productEntryId,
603         OrderByComparator orderByComparator)
604         throws NoSuchProductScreenshotException, SystemException {
605         int count = countByProductEntryId(productEntryId);
606 
607         List<SCProductScreenshot> list = findByProductEntryId(productEntryId,
608                 count - 1, count, orderByComparator);
609 
610         if (list.isEmpty()) {
611             StringBundler msg = new StringBundler(4);
612 
613             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
614 
615             msg.append("productEntryId=");
616             msg.append(productEntryId);
617 
618             msg.append(StringPool.CLOSE_CURLY_BRACE);
619 
620             throw new NoSuchProductScreenshotException(msg.toString());
621         }
622         else {
623             return list.get(0);
624         }
625     }
626 
627     public SCProductScreenshot[] findByProductEntryId_PrevAndNext(
628         long productScreenshotId, long productEntryId,
629         OrderByComparator orderByComparator)
630         throws NoSuchProductScreenshotException, SystemException {
631         SCProductScreenshot scProductScreenshot = findByPrimaryKey(productScreenshotId);
632 
633         int count = countByProductEntryId(productEntryId);
634 
635         Session session = null;
636 
637         try {
638             session = openSession();
639 
640             StringBundler query = null;
641 
642             if (orderByComparator != null) {
643                 query = new StringBundler(3 +
644                         (orderByComparator.getOrderByFields().length * 3));
645             }
646             else {
647                 query = new StringBundler(3);
648             }
649 
650             query.append(_SQL_SELECT_SCPRODUCTSCREENSHOT_WHERE);
651 
652             query.append(_FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2);
653 
654             if (orderByComparator != null) {
655                 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
656                     orderByComparator);
657             }
658 
659             else {
660                 query.append(SCProductScreenshotModelImpl.ORDER_BY_JPQL);
661             }
662 
663             String sql = query.toString();
664 
665             Query q = session.createQuery(sql);
666 
667             QueryPos qPos = QueryPos.getInstance(q);
668 
669             qPos.add(productEntryId);
670 
671             Object[] objArray = QueryUtil.getPrevAndNext(q, count,
672                     orderByComparator, scProductScreenshot);
673 
674             SCProductScreenshot[] array = new SCProductScreenshotImpl[3];
675 
676             array[0] = (SCProductScreenshot)objArray[0];
677             array[1] = (SCProductScreenshot)objArray[1];
678             array[2] = (SCProductScreenshot)objArray[2];
679 
680             return array;
681         }
682         catch (Exception e) {
683             throw processException(e);
684         }
685         finally {
686             closeSession(session);
687         }
688     }
689 
690     public SCProductScreenshot findByThumbnailId(long thumbnailId)
691         throws NoSuchProductScreenshotException, SystemException {
692         SCProductScreenshot scProductScreenshot = fetchByThumbnailId(thumbnailId);
693 
694         if (scProductScreenshot == null) {
695             StringBundler msg = new StringBundler(4);
696 
697             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
698 
699             msg.append("thumbnailId=");
700             msg.append(thumbnailId);
701 
702             msg.append(StringPool.CLOSE_CURLY_BRACE);
703 
704             if (_log.isWarnEnabled()) {
705                 _log.warn(msg.toString());
706             }
707 
708             throw new NoSuchProductScreenshotException(msg.toString());
709         }
710 
711         return scProductScreenshot;
712     }
713 
714     public SCProductScreenshot fetchByThumbnailId(long thumbnailId)
715         throws SystemException {
716         return fetchByThumbnailId(thumbnailId, true);
717     }
718 
719     public SCProductScreenshot fetchByThumbnailId(long thumbnailId,
720         boolean retrieveFromCache) throws SystemException {
721         Object[] finderArgs = new Object[] { new Long(thumbnailId) };
722 
723         Object result = null;
724 
725         if (retrieveFromCache) {
726             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
727                     finderArgs, this);
728         }
729 
730         if (result == null) {
731             Session session = null;
732 
733             try {
734                 session = openSession();
735 
736                 StringBundler query = new StringBundler(3);
737 
738                 query.append(_SQL_SELECT_SCPRODUCTSCREENSHOT_WHERE);
739 
740                 query.append(_FINDER_COLUMN_THUMBNAILID_THUMBNAILID_2);
741 
742                 query.append(SCProductScreenshotModelImpl.ORDER_BY_JPQL);
743 
744                 String sql = query.toString();
745 
746                 Query q = session.createQuery(sql);
747 
748                 QueryPos qPos = QueryPos.getInstance(q);
749 
750                 qPos.add(thumbnailId);
751 
752                 List<SCProductScreenshot> list = q.list();
753 
754                 result = list;
755 
756                 SCProductScreenshot scProductScreenshot = null;
757 
758                 if (list.isEmpty()) {
759                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
760                         finderArgs, list);
761                 }
762                 else {
763                     scProductScreenshot = list.get(0);
764 
765                     cacheResult(scProductScreenshot);
766 
767                     if ((scProductScreenshot.getThumbnailId() != thumbnailId)) {
768                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
769                             finderArgs, scProductScreenshot);
770                     }
771                 }
772 
773                 return scProductScreenshot;
774             }
775             catch (Exception e) {
776                 throw processException(e);
777             }
778             finally {
779                 if (result == null) {
780                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_THUMBNAILID,
781                         finderArgs, new ArrayList<SCProductScreenshot>());
782                 }
783 
784                 closeSession(session);
785             }
786         }
787         else {
788             if (result instanceof List<?>) {
789                 return null;
790             }
791             else {
792                 return (SCProductScreenshot)result;
793             }
794         }
795     }
796 
797     public SCProductScreenshot findByFullImageId(long fullImageId)
798         throws NoSuchProductScreenshotException, SystemException {
799         SCProductScreenshot scProductScreenshot = fetchByFullImageId(fullImageId);
800 
801         if (scProductScreenshot == null) {
802             StringBundler msg = new StringBundler(4);
803 
804             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
805 
806             msg.append("fullImageId=");
807             msg.append(fullImageId);
808 
809             msg.append(StringPool.CLOSE_CURLY_BRACE);
810 
811             if (_log.isWarnEnabled()) {
812                 _log.warn(msg.toString());
813             }
814 
815             throw new NoSuchProductScreenshotException(msg.toString());
816         }
817 
818         return scProductScreenshot;
819     }
820 
821     public SCProductScreenshot fetchByFullImageId(long fullImageId)
822         throws SystemException {
823         return fetchByFullImageId(fullImageId, true);
824     }
825 
826     public SCProductScreenshot fetchByFullImageId(long fullImageId,
827         boolean retrieveFromCache) throws SystemException {
828         Object[] finderArgs = new Object[] { new Long(fullImageId) };
829 
830         Object result = null;
831 
832         if (retrieveFromCache) {
833             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
834                     finderArgs, this);
835         }
836 
837         if (result == null) {
838             Session session = null;
839 
840             try {
841                 session = openSession();
842 
843                 StringBundler query = new StringBundler(3);
844 
845                 query.append(_SQL_SELECT_SCPRODUCTSCREENSHOT_WHERE);
846 
847                 query.append(_FINDER_COLUMN_FULLIMAGEID_FULLIMAGEID_2);
848 
849                 query.append(SCProductScreenshotModelImpl.ORDER_BY_JPQL);
850 
851                 String sql = query.toString();
852 
853                 Query q = session.createQuery(sql);
854 
855                 QueryPos qPos = QueryPos.getInstance(q);
856 
857                 qPos.add(fullImageId);
858 
859                 List<SCProductScreenshot> list = q.list();
860 
861                 result = list;
862 
863                 SCProductScreenshot scProductScreenshot = null;
864 
865                 if (list.isEmpty()) {
866                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
867                         finderArgs, list);
868                 }
869                 else {
870                     scProductScreenshot = list.get(0);
871 
872                     cacheResult(scProductScreenshot);
873 
874                     if ((scProductScreenshot.getFullImageId() != fullImageId)) {
875                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
876                             finderArgs, scProductScreenshot);
877                     }
878                 }
879 
880                 return scProductScreenshot;
881             }
882             catch (Exception e) {
883                 throw processException(e);
884             }
885             finally {
886                 if (result == null) {
887                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_FULLIMAGEID,
888                         finderArgs, new ArrayList<SCProductScreenshot>());
889                 }
890 
891                 closeSession(session);
892             }
893         }
894         else {
895             if (result instanceof List<?>) {
896                 return null;
897             }
898             else {
899                 return (SCProductScreenshot)result;
900             }
901         }
902     }
903 
904     public SCProductScreenshot findByP_P(long productEntryId, int priority)
905         throws NoSuchProductScreenshotException, SystemException {
906         SCProductScreenshot scProductScreenshot = fetchByP_P(productEntryId,
907                 priority);
908 
909         if (scProductScreenshot == null) {
910             StringBundler msg = new StringBundler(6);
911 
912             msg.append(_NO_SUCH_ENTITY_WITH_KEY);
913 
914             msg.append("productEntryId=");
915             msg.append(productEntryId);
916 
917             msg.append(", priority=");
918             msg.append(priority);
919 
920             msg.append(StringPool.CLOSE_CURLY_BRACE);
921 
922             if (_log.isWarnEnabled()) {
923                 _log.warn(msg.toString());
924             }
925 
926             throw new NoSuchProductScreenshotException(msg.toString());
927         }
928 
929         return scProductScreenshot;
930     }
931 
932     public SCProductScreenshot fetchByP_P(long productEntryId, int priority)
933         throws SystemException {
934         return fetchByP_P(productEntryId, priority, true);
935     }
936 
937     public SCProductScreenshot fetchByP_P(long productEntryId, int priority,
938         boolean retrieveFromCache) throws SystemException {
939         Object[] finderArgs = new Object[] {
940                 new Long(productEntryId), new Integer(priority)
941             };
942 
943         Object result = null;
944 
945         if (retrieveFromCache) {
946             result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_P_P,
947                     finderArgs, this);
948         }
949 
950         if (result == null) {
951             Session session = null;
952 
953             try {
954                 session = openSession();
955 
956                 StringBundler query = new StringBundler(4);
957 
958                 query.append(_SQL_SELECT_SCPRODUCTSCREENSHOT_WHERE);
959 
960                 query.append(_FINDER_COLUMN_P_P_PRODUCTENTRYID_2);
961 
962                 query.append(_FINDER_COLUMN_P_P_PRIORITY_2);
963 
964                 query.append(SCProductScreenshotModelImpl.ORDER_BY_JPQL);
965 
966                 String sql = query.toString();
967 
968                 Query q = session.createQuery(sql);
969 
970                 QueryPos qPos = QueryPos.getInstance(q);
971 
972                 qPos.add(productEntryId);
973 
974                 qPos.add(priority);
975 
976                 List<SCProductScreenshot> list = q.list();
977 
978                 result = list;
979 
980                 SCProductScreenshot scProductScreenshot = null;
981 
982                 if (list.isEmpty()) {
983                     FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_P,
984                         finderArgs, list);
985                 }
986                 else {
987                     scProductScreenshot = list.get(0);
988 
989                     cacheResult(scProductScreenshot);
990 
991                     if ((scProductScreenshot.getProductEntryId() != productEntryId) ||
992                             (scProductScreenshot.getPriority() != priority)) {
993                         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_P,
994                             finderArgs, scProductScreenshot);
995                     }
996                 }
997 
998                 return scProductScreenshot;
999             }
1000            catch (Exception e) {
1001                throw processException(e);
1002            }
1003            finally {
1004                if (result == null) {
1005                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_P_P,
1006                        finderArgs, new ArrayList<SCProductScreenshot>());
1007                }
1008
1009                closeSession(session);
1010            }
1011        }
1012        else {
1013            if (result instanceof List<?>) {
1014                return null;
1015            }
1016            else {
1017                return (SCProductScreenshot)result;
1018            }
1019        }
1020    }
1021
1022    public List<SCProductScreenshot> findAll() throws SystemException {
1023        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1024    }
1025
1026    public List<SCProductScreenshot> findAll(int start, int end)
1027        throws SystemException {
1028        return findAll(start, end, null);
1029    }
1030
1031    public List<SCProductScreenshot> findAll(int start, int end,
1032        OrderByComparator orderByComparator) throws SystemException {
1033        Object[] finderArgs = new Object[] {
1034                String.valueOf(start), String.valueOf(end),
1035                String.valueOf(orderByComparator)
1036            };
1037
1038        List<SCProductScreenshot> list = (List<SCProductScreenshot>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1039                finderArgs, this);
1040
1041        if (list == null) {
1042            Session session = null;
1043
1044            try {
1045                session = openSession();
1046
1047                StringBundler query = null;
1048                String sql = null;
1049
1050                if (orderByComparator != null) {
1051                    query = new StringBundler(2 +
1052                            (orderByComparator.getOrderByFields().length * 3));
1053
1054                    query.append(_SQL_SELECT_SCPRODUCTSCREENSHOT);
1055
1056                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1057                        orderByComparator);
1058
1059                    sql = query.toString();
1060                }
1061
1062                else {
1063                    sql = _SQL_SELECT_SCPRODUCTSCREENSHOT.concat(SCProductScreenshotModelImpl.ORDER_BY_JPQL);
1064                }
1065
1066                Query q = session.createQuery(sql);
1067
1068                if (orderByComparator == null) {
1069                    list = (List<SCProductScreenshot>)QueryUtil.list(q,
1070                            getDialect(), start, end, false);
1071
1072                    Collections.sort(list);
1073                }
1074                else {
1075                    list = (List<SCProductScreenshot>)QueryUtil.list(q,
1076                            getDialect(), start, end);
1077                }
1078            }
1079            catch (Exception e) {
1080                throw processException(e);
1081            }
1082            finally {
1083                if (list == null) {
1084                    list = new ArrayList<SCProductScreenshot>();
1085                }
1086
1087                cacheResult(list);
1088
1089                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1090
1091                closeSession(session);
1092            }
1093        }
1094
1095        return list;
1096    }
1097
1098    public void removeByProductEntryId(long productEntryId)
1099        throws SystemException {
1100        for (SCProductScreenshot scProductScreenshot : findByProductEntryId(
1101                productEntryId)) {
1102            remove(scProductScreenshot);
1103        }
1104    }
1105
1106    public void removeByThumbnailId(long thumbnailId)
1107        throws NoSuchProductScreenshotException, SystemException {
1108        SCProductScreenshot scProductScreenshot = findByThumbnailId(thumbnailId);
1109
1110        remove(scProductScreenshot);
1111    }
1112
1113    public void removeByFullImageId(long fullImageId)
1114        throws NoSuchProductScreenshotException, SystemException {
1115        SCProductScreenshot scProductScreenshot = findByFullImageId(fullImageId);
1116
1117        remove(scProductScreenshot);
1118    }
1119
1120    public void removeByP_P(long productEntryId, int priority)
1121        throws NoSuchProductScreenshotException, SystemException {
1122        SCProductScreenshot scProductScreenshot = findByP_P(productEntryId,
1123                priority);
1124
1125        remove(scProductScreenshot);
1126    }
1127
1128    public void removeAll() throws SystemException {
1129        for (SCProductScreenshot scProductScreenshot : findAll()) {
1130            remove(scProductScreenshot);
1131        }
1132    }
1133
1134    public int countByProductEntryId(long productEntryId)
1135        throws SystemException {
1136        Object[] finderArgs = new Object[] { new Long(productEntryId) };
1137
1138        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_PRODUCTENTRYID,
1139                finderArgs, this);
1140
1141        if (count == null) {
1142            Session session = null;
1143
1144            try {
1145                session = openSession();
1146
1147                StringBundler query = new StringBundler(2);
1148
1149                query.append(_SQL_COUNT_SCPRODUCTSCREENSHOT_WHERE);
1150
1151                query.append(_FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2);
1152
1153                String sql = query.toString();
1154
1155                Query q = session.createQuery(sql);
1156
1157                QueryPos qPos = QueryPos.getInstance(q);
1158
1159                qPos.add(productEntryId);
1160
1161                count = (Long)q.uniqueResult();
1162            }
1163            catch (Exception e) {
1164                throw processException(e);
1165            }
1166            finally {
1167                if (count == null) {
1168                    count = Long.valueOf(0);
1169                }
1170
1171                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_PRODUCTENTRYID,
1172                    finderArgs, count);
1173
1174                closeSession(session);
1175            }
1176        }
1177
1178        return count.intValue();
1179    }
1180
1181    public int countByThumbnailId(long thumbnailId) throws SystemException {
1182        Object[] finderArgs = new Object[] { new Long(thumbnailId) };
1183
1184        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_THUMBNAILID,
1185                finderArgs, this);
1186
1187        if (count == null) {
1188            Session session = null;
1189
1190            try {
1191                session = openSession();
1192
1193                StringBundler query = new StringBundler(2);
1194
1195                query.append(_SQL_COUNT_SCPRODUCTSCREENSHOT_WHERE);
1196
1197                query.append(_FINDER_COLUMN_THUMBNAILID_THUMBNAILID_2);
1198
1199                String sql = query.toString();
1200
1201                Query q = session.createQuery(sql);
1202
1203                QueryPos qPos = QueryPos.getInstance(q);
1204
1205                qPos.add(thumbnailId);
1206
1207                count = (Long)q.uniqueResult();
1208            }
1209            catch (Exception e) {
1210                throw processException(e);
1211            }
1212            finally {
1213                if (count == null) {
1214                    count = Long.valueOf(0);
1215                }
1216
1217                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_THUMBNAILID,
1218                    finderArgs, count);
1219
1220                closeSession(session);
1221            }
1222        }
1223
1224        return count.intValue();
1225    }
1226
1227    public int countByFullImageId(long fullImageId) throws SystemException {
1228        Object[] finderArgs = new Object[] { new Long(fullImageId) };
1229
1230        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_FULLIMAGEID,
1231                finderArgs, this);
1232
1233        if (count == null) {
1234            Session session = null;
1235
1236            try {
1237                session = openSession();
1238
1239                StringBundler query = new StringBundler(2);
1240
1241                query.append(_SQL_COUNT_SCPRODUCTSCREENSHOT_WHERE);
1242
1243                query.append(_FINDER_COLUMN_FULLIMAGEID_FULLIMAGEID_2);
1244
1245                String sql = query.toString();
1246
1247                Query q = session.createQuery(sql);
1248
1249                QueryPos qPos = QueryPos.getInstance(q);
1250
1251                qPos.add(fullImageId);
1252
1253                count = (Long)q.uniqueResult();
1254            }
1255            catch (Exception e) {
1256                throw processException(e);
1257            }
1258            finally {
1259                if (count == null) {
1260                    count = Long.valueOf(0);
1261                }
1262
1263                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_FULLIMAGEID,
1264                    finderArgs, count);
1265
1266                closeSession(session);
1267            }
1268        }
1269
1270        return count.intValue();
1271    }
1272
1273    public int countByP_P(long productEntryId, int priority)
1274        throws SystemException {
1275        Object[] finderArgs = new Object[] {
1276                new Long(productEntryId), new Integer(priority)
1277            };
1278
1279        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_P_P,
1280                finderArgs, this);
1281
1282        if (count == null) {
1283            Session session = null;
1284
1285            try {
1286                session = openSession();
1287
1288                StringBundler query = new StringBundler(3);
1289
1290                query.append(_SQL_COUNT_SCPRODUCTSCREENSHOT_WHERE);
1291
1292                query.append(_FINDER_COLUMN_P_P_PRODUCTENTRYID_2);
1293
1294                query.append(_FINDER_COLUMN_P_P_PRIORITY_2);
1295
1296                String sql = query.toString();
1297
1298                Query q = session.createQuery(sql);
1299
1300                QueryPos qPos = QueryPos.getInstance(q);
1301
1302                qPos.add(productEntryId);
1303
1304                qPos.add(priority);
1305
1306                count = (Long)q.uniqueResult();
1307            }
1308            catch (Exception e) {
1309                throw processException(e);
1310            }
1311            finally {
1312                if (count == null) {
1313                    count = Long.valueOf(0);
1314                }
1315
1316                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_P_P, finderArgs,
1317                    count);
1318
1319                closeSession(session);
1320            }
1321        }
1322
1323        return count.intValue();
1324    }
1325
1326    public int countAll() throws SystemException {
1327        Object[] finderArgs = new Object[0];
1328
1329        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1330                finderArgs, this);
1331
1332        if (count == null) {
1333            Session session = null;
1334
1335            try {
1336                session = openSession();
1337
1338                Query q = session.createQuery(_SQL_COUNT_SCPRODUCTSCREENSHOT);
1339
1340                count = (Long)q.uniqueResult();
1341            }
1342            catch (Exception e) {
1343                throw processException(e);
1344            }
1345            finally {
1346                if (count == null) {
1347                    count = Long.valueOf(0);
1348                }
1349
1350                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1351                    count);
1352
1353                closeSession(session);
1354            }
1355        }
1356
1357        return count.intValue();
1358    }
1359
1360    public void afterPropertiesSet() {
1361        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1362                    com.liferay.portal.util.PropsUtil.get(
1363                        "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCProductScreenshot")));
1364
1365        if (listenerClassNames.length > 0) {
1366            try {
1367                List<ModelListener<SCProductScreenshot>> listenersList = new ArrayList<ModelListener<SCProductScreenshot>>();
1368
1369                for (String listenerClassName : listenerClassNames) {
1370                    listenersList.add((ModelListener<SCProductScreenshot>)Class.forName(
1371                            listenerClassName).newInstance());
1372                }
1373
1374                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1375            }
1376            catch (Exception e) {
1377                _log.error(e);
1378            }
1379        }
1380    }
1381
1382    @BeanReference(type = SCLicensePersistence.class)
1383    protected SCLicensePersistence scLicensePersistence;
1384    @BeanReference(type = SCFrameworkVersionPersistence.class)
1385    protected SCFrameworkVersionPersistence scFrameworkVersionPersistence;
1386    @BeanReference(type = SCProductEntryPersistence.class)
1387    protected SCProductEntryPersistence scProductEntryPersistence;
1388    @BeanReference(type = SCProductScreenshotPersistence.class)
1389    protected SCProductScreenshotPersistence scProductScreenshotPersistence;
1390    @BeanReference(type = SCProductVersionPersistence.class)
1391    protected SCProductVersionPersistence scProductVersionPersistence;
1392    @BeanReference(type = ImagePersistence.class)
1393    protected ImagePersistence imagePersistence;
1394    @BeanReference(type = ResourcePersistence.class)
1395    protected ResourcePersistence resourcePersistence;
1396    @BeanReference(type = UserPersistence.class)
1397    protected UserPersistence userPersistence;
1398    private static final String _SQL_SELECT_SCPRODUCTSCREENSHOT = "SELECT scProductScreenshot FROM SCProductScreenshot scProductScreenshot";
1399    private static final String _SQL_SELECT_SCPRODUCTSCREENSHOT_WHERE = "SELECT scProductScreenshot FROM SCProductScreenshot scProductScreenshot WHERE ";
1400    private static final String _SQL_COUNT_SCPRODUCTSCREENSHOT = "SELECT COUNT(scProductScreenshot) FROM SCProductScreenshot scProductScreenshot";
1401    private static final String _SQL_COUNT_SCPRODUCTSCREENSHOT_WHERE = "SELECT COUNT(scProductScreenshot) FROM SCProductScreenshot scProductScreenshot WHERE ";
1402    private static final String _FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2 = "scProductScreenshot.productEntryId = ?";
1403    private static final String _FINDER_COLUMN_THUMBNAILID_THUMBNAILID_2 = "scProductScreenshot.thumbnailId = ?";
1404    private static final String _FINDER_COLUMN_FULLIMAGEID_FULLIMAGEID_2 = "scProductScreenshot.fullImageId = ?";
1405    private static final String _FINDER_COLUMN_P_P_PRODUCTENTRYID_2 = "scProductScreenshot.productEntryId = ? AND ";
1406    private static final String _FINDER_COLUMN_P_P_PRIORITY_2 = "scProductScreenshot.priority = ?";
1407    private static final String _ORDER_BY_ENTITY_ALIAS = "scProductScreenshot.";
1408    private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SCProductScreenshot exists with the primary key ";
1409    private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SCProductScreenshot exists with the key {";
1410    private static Log _log = LogFactoryUtil.getLog(SCProductScreenshotPersistenceImpl.class);
1411}