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