001
014
015 package com.liferay.portlet.softwarecatalog.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.bean.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQuery;
021 import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
022 import com.liferay.portal.kernel.dao.jdbc.RowMapper;
023 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
024 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
025 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
026 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
027 import com.liferay.portal.kernel.dao.orm.FinderPath;
028 import com.liferay.portal.kernel.dao.orm.Query;
029 import com.liferay.portal.kernel.dao.orm.QueryPos;
030 import com.liferay.portal.kernel.dao.orm.QueryUtil;
031 import com.liferay.portal.kernel.dao.orm.SQLQuery;
032 import com.liferay.portal.kernel.dao.orm.Session;
033 import com.liferay.portal.kernel.exception.SystemException;
034 import com.liferay.portal.kernel.log.Log;
035 import com.liferay.portal.kernel.log.LogFactoryUtil;
036 import com.liferay.portal.kernel.util.GetterUtil;
037 import com.liferay.portal.kernel.util.InstanceFactory;
038 import com.liferay.portal.kernel.util.OrderByComparator;
039 import com.liferay.portal.kernel.util.SetUtil;
040 import com.liferay.portal.kernel.util.StringBundler;
041 import com.liferay.portal.kernel.util.StringPool;
042 import com.liferay.portal.kernel.util.StringUtil;
043 import com.liferay.portal.kernel.util.Validator;
044 import com.liferay.portal.model.CacheModel;
045 import com.liferay.portal.model.ModelListener;
046 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
047 import com.liferay.portal.service.persistence.BatchSessionUtil;
048 import com.liferay.portal.service.persistence.GroupPersistence;
049 import com.liferay.portal.service.persistence.ImagePersistence;
050 import com.liferay.portal.service.persistence.ResourcePersistence;
051 import com.liferay.portal.service.persistence.SubscriptionPersistence;
052 import com.liferay.portal.service.persistence.UserPersistence;
053 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
054
055 import com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence;
056 import com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence;
057 import com.liferay.portlet.softwarecatalog.NoSuchProductEntryException;
058 import com.liferay.portlet.softwarecatalog.model.SCProductEntry;
059 import com.liferay.portlet.softwarecatalog.model.impl.SCProductEntryImpl;
060 import com.liferay.portlet.softwarecatalog.model.impl.SCProductEntryModelImpl;
061
062 import java.io.Serializable;
063
064 import java.util.ArrayList;
065 import java.util.Collections;
066 import java.util.List;
067 import java.util.Set;
068
069
081 public class SCProductEntryPersistenceImpl extends BasePersistenceImpl<SCProductEntry>
082 implements SCProductEntryPersistence {
083
088 public static final String FINDER_CLASS_NAME_ENTITY = SCProductEntryImpl.class.getName();
089 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
090 ".List1";
091 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
092 ".List2";
093 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
094 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
095 SCProductEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
096 "findByGroupId",
097 new String[] {
098 Long.class.getName(),
099
100 "java.lang.Integer", "java.lang.Integer",
101 "com.liferay.portal.kernel.util.OrderByComparator"
102 });
103 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
104 new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
105 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
106 SCProductEntryImpl.class,
107 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
108 new String[] { Long.class.getName() },
109 SCProductEntryModelImpl.GROUPID_COLUMN_BITMASK);
110 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
111 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
112 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
113 new String[] { Long.class.getName() });
114 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
115 new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
116 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
117 SCProductEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
118 "findByCompanyId",
119 new String[] {
120 Long.class.getName(),
121
122 "java.lang.Integer", "java.lang.Integer",
123 "com.liferay.portal.kernel.util.OrderByComparator"
124 });
125 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
126 new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
127 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
128 SCProductEntryImpl.class,
129 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
130 new String[] { Long.class.getName() },
131 SCProductEntryModelImpl.COMPANYID_COLUMN_BITMASK);
132 public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
133 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
134 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId",
135 new String[] { Long.class.getName() });
136 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
137 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
138 SCProductEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
139 "findByG_U",
140 new String[] {
141 Long.class.getName(), Long.class.getName(),
142
143 "java.lang.Integer", "java.lang.Integer",
144 "com.liferay.portal.kernel.util.OrderByComparator"
145 });
146 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
147 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
148 SCProductEntryImpl.class,
149 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_U",
150 new String[] { Long.class.getName(), Long.class.getName() },
151 SCProductEntryModelImpl.GROUPID_COLUMN_BITMASK |
152 SCProductEntryModelImpl.USERID_COLUMN_BITMASK);
153 public static final FinderPath FINDER_PATH_COUNT_BY_G_U = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
154 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
155 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_U",
156 new String[] { Long.class.getName(), Long.class.getName() });
157 public static final FinderPath FINDER_PATH_FETCH_BY_RG_RA = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
158 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
159 SCProductEntryImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByRG_RA",
160 new String[] { String.class.getName(), String.class.getName() },
161 SCProductEntryModelImpl.REPOGROUPID_COLUMN_BITMASK |
162 SCProductEntryModelImpl.REPOARTIFACTID_COLUMN_BITMASK);
163 public static final FinderPath FINDER_PATH_COUNT_BY_RG_RA = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
164 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
165 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByRG_RA",
166 new String[] { String.class.getName(), String.class.getName() });
167 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
168 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
169 SCProductEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
170 "findAll", new String[0]);
171 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
172 SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
173 SCProductEntryImpl.class,
174 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
175 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
176 SCProductEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
177 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
178
179
184 public void cacheResult(SCProductEntry scProductEntry) {
185 EntityCacheUtil.putResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
186 SCProductEntryImpl.class, scProductEntry.getPrimaryKey(),
187 scProductEntry);
188
189 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
190 new Object[] {
191 scProductEntry.getRepoGroupId(),
192
193 scProductEntry.getRepoArtifactId()
194 }, scProductEntry);
195
196 scProductEntry.resetOriginalValues();
197 }
198
199
204 public void cacheResult(List<SCProductEntry> scProductEntries) {
205 for (SCProductEntry scProductEntry : scProductEntries) {
206 if (EntityCacheUtil.getResult(
207 SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
208 SCProductEntryImpl.class, scProductEntry.getPrimaryKey()) == null) {
209 cacheResult(scProductEntry);
210 }
211 else {
212 scProductEntry.resetOriginalValues();
213 }
214 }
215 }
216
217
224 @Override
225 public void clearCache() {
226 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
227 CacheRegistryUtil.clear(SCProductEntryImpl.class.getName());
228 }
229
230 EntityCacheUtil.clearCache(SCProductEntryImpl.class.getName());
231
232 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
233 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
234 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
235 }
236
237
244 @Override
245 public void clearCache(SCProductEntry scProductEntry) {
246 EntityCacheUtil.removeResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
247 SCProductEntryImpl.class, scProductEntry.getPrimaryKey());
248
249 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
250 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
251
252 clearUniqueFindersCache(scProductEntry);
253 }
254
255 @Override
256 public void clearCache(List<SCProductEntry> scProductEntries) {
257 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
258 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
259
260 for (SCProductEntry scProductEntry : scProductEntries) {
261 EntityCacheUtil.removeResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
262 SCProductEntryImpl.class, scProductEntry.getPrimaryKey());
263
264 clearUniqueFindersCache(scProductEntry);
265 }
266 }
267
268 protected void clearUniqueFindersCache(SCProductEntry scProductEntry) {
269 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_RG_RA,
270 new Object[] {
271 scProductEntry.getRepoGroupId(),
272
273 scProductEntry.getRepoArtifactId()
274 });
275 }
276
277
283 public SCProductEntry create(long productEntryId) {
284 SCProductEntry scProductEntry = new SCProductEntryImpl();
285
286 scProductEntry.setNew(true);
287 scProductEntry.setPrimaryKey(productEntryId);
288
289 return scProductEntry;
290 }
291
292
300 public SCProductEntry remove(long productEntryId)
301 throws NoSuchProductEntryException, SystemException {
302 return remove(Long.valueOf(productEntryId));
303 }
304
305
313 @Override
314 public SCProductEntry remove(Serializable primaryKey)
315 throws NoSuchProductEntryException, SystemException {
316 Session session = null;
317
318 try {
319 session = openSession();
320
321 SCProductEntry scProductEntry = (SCProductEntry)session.get(SCProductEntryImpl.class,
322 primaryKey);
323
324 if (scProductEntry == null) {
325 if (_log.isWarnEnabled()) {
326 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
327 }
328
329 throw new NoSuchProductEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
330 primaryKey);
331 }
332
333 return remove(scProductEntry);
334 }
335 catch (NoSuchProductEntryException nsee) {
336 throw nsee;
337 }
338 catch (Exception e) {
339 throw processException(e);
340 }
341 finally {
342 closeSession(session);
343 }
344 }
345
346 @Override
347 protected SCProductEntry removeImpl(SCProductEntry scProductEntry)
348 throws SystemException {
349 scProductEntry = toUnwrappedModel(scProductEntry);
350
351 try {
352 clearSCLicenses.clear(scProductEntry.getPrimaryKey());
353 }
354 catch (Exception e) {
355 throw processException(e);
356 }
357 finally {
358 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
359 }
360
361 Session session = null;
362
363 try {
364 session = openSession();
365
366 BatchSessionUtil.delete(session, scProductEntry);
367 }
368 catch (Exception e) {
369 throw processException(e);
370 }
371 finally {
372 closeSession(session);
373 }
374
375 clearCache(scProductEntry);
376
377 return scProductEntry;
378 }
379
380 @Override
381 public SCProductEntry updateImpl(
382 com.liferay.portlet.softwarecatalog.model.SCProductEntry scProductEntry,
383 boolean merge) throws SystemException {
384 scProductEntry = toUnwrappedModel(scProductEntry);
385
386 boolean isNew = scProductEntry.isNew();
387
388 SCProductEntryModelImpl scProductEntryModelImpl = (SCProductEntryModelImpl)scProductEntry;
389
390 Session session = null;
391
392 try {
393 session = openSession();
394
395 BatchSessionUtil.update(session, scProductEntry, merge);
396
397 scProductEntry.setNew(false);
398 }
399 catch (Exception e) {
400 throw processException(e);
401 }
402 finally {
403 closeSession(session);
404 }
405
406 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
407
408 if (isNew || !SCProductEntryModelImpl.COLUMN_BITMASK_ENABLED) {
409 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
410 }
411
412 else {
413 if ((scProductEntryModelImpl.getColumnBitmask() &
414 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
415 Object[] args = new Object[] {
416 Long.valueOf(scProductEntryModelImpl.getOriginalGroupId())
417 };
418
419 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
420 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
421 args);
422
423 args = new Object[] {
424 Long.valueOf(scProductEntryModelImpl.getGroupId())
425 };
426
427 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
428 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
429 args);
430 }
431
432 if ((scProductEntryModelImpl.getColumnBitmask() &
433 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
434 Object[] args = new Object[] {
435 Long.valueOf(scProductEntryModelImpl.getOriginalCompanyId())
436 };
437
438 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
439 args);
440 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
441 args);
442
443 args = new Object[] {
444 Long.valueOf(scProductEntryModelImpl.getCompanyId())
445 };
446
447 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
448 args);
449 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
450 args);
451 }
452
453 if ((scProductEntryModelImpl.getColumnBitmask() &
454 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U.getColumnBitmask()) != 0) {
455 Object[] args = new Object[] {
456 Long.valueOf(scProductEntryModelImpl.getOriginalGroupId()),
457 Long.valueOf(scProductEntryModelImpl.getOriginalUserId())
458 };
459
460 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U, args);
461 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U,
462 args);
463
464 args = new Object[] {
465 Long.valueOf(scProductEntryModelImpl.getGroupId()),
466 Long.valueOf(scProductEntryModelImpl.getUserId())
467 };
468
469 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_U, args);
470 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U,
471 args);
472 }
473 }
474
475 EntityCacheUtil.putResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
476 SCProductEntryImpl.class, scProductEntry.getPrimaryKey(),
477 scProductEntry);
478
479 if (isNew) {
480 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
481 new Object[] {
482 scProductEntry.getRepoGroupId(),
483
484 scProductEntry.getRepoArtifactId()
485 }, scProductEntry);
486 }
487 else {
488 if ((scProductEntryModelImpl.getColumnBitmask() &
489 FINDER_PATH_FETCH_BY_RG_RA.getColumnBitmask()) != 0) {
490 Object[] args = new Object[] {
491 scProductEntryModelImpl.getOriginalRepoGroupId(),
492
493 scProductEntryModelImpl.getOriginalRepoArtifactId()
494 };
495
496 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RG_RA, args);
497
498 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_RG_RA, args);
499
500 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
501 new Object[] {
502 scProductEntry.getRepoGroupId(),
503
504 scProductEntry.getRepoArtifactId()
505 }, scProductEntry);
506 }
507 }
508
509 return scProductEntry;
510 }
511
512 protected SCProductEntry toUnwrappedModel(SCProductEntry scProductEntry) {
513 if (scProductEntry instanceof SCProductEntryImpl) {
514 return scProductEntry;
515 }
516
517 SCProductEntryImpl scProductEntryImpl = new SCProductEntryImpl();
518
519 scProductEntryImpl.setNew(scProductEntry.isNew());
520 scProductEntryImpl.setPrimaryKey(scProductEntry.getPrimaryKey());
521
522 scProductEntryImpl.setProductEntryId(scProductEntry.getProductEntryId());
523 scProductEntryImpl.setGroupId(scProductEntry.getGroupId());
524 scProductEntryImpl.setCompanyId(scProductEntry.getCompanyId());
525 scProductEntryImpl.setUserId(scProductEntry.getUserId());
526 scProductEntryImpl.setUserName(scProductEntry.getUserName());
527 scProductEntryImpl.setCreateDate(scProductEntry.getCreateDate());
528 scProductEntryImpl.setModifiedDate(scProductEntry.getModifiedDate());
529 scProductEntryImpl.setName(scProductEntry.getName());
530 scProductEntryImpl.setType(scProductEntry.getType());
531 scProductEntryImpl.setTags(scProductEntry.getTags());
532 scProductEntryImpl.setShortDescription(scProductEntry.getShortDescription());
533 scProductEntryImpl.setLongDescription(scProductEntry.getLongDescription());
534 scProductEntryImpl.setPageURL(scProductEntry.getPageURL());
535 scProductEntryImpl.setAuthor(scProductEntry.getAuthor());
536 scProductEntryImpl.setRepoGroupId(scProductEntry.getRepoGroupId());
537 scProductEntryImpl.setRepoArtifactId(scProductEntry.getRepoArtifactId());
538
539 return scProductEntryImpl;
540 }
541
542
550 @Override
551 public SCProductEntry findByPrimaryKey(Serializable primaryKey)
552 throws NoSuchModelException, SystemException {
553 return findByPrimaryKey(((Long)primaryKey).longValue());
554 }
555
556
564 public SCProductEntry findByPrimaryKey(long productEntryId)
565 throws NoSuchProductEntryException, SystemException {
566 SCProductEntry scProductEntry = fetchByPrimaryKey(productEntryId);
567
568 if (scProductEntry == null) {
569 if (_log.isWarnEnabled()) {
570 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + productEntryId);
571 }
572
573 throw new NoSuchProductEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
574 productEntryId);
575 }
576
577 return scProductEntry;
578 }
579
580
587 @Override
588 public SCProductEntry fetchByPrimaryKey(Serializable primaryKey)
589 throws SystemException {
590 return fetchByPrimaryKey(((Long)primaryKey).longValue());
591 }
592
593
600 public SCProductEntry fetchByPrimaryKey(long productEntryId)
601 throws SystemException {
602 SCProductEntry scProductEntry = (SCProductEntry)EntityCacheUtil.getResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
603 SCProductEntryImpl.class, productEntryId);
604
605 if (scProductEntry == _nullSCProductEntry) {
606 return null;
607 }
608
609 if (scProductEntry == null) {
610 Session session = null;
611
612 boolean hasException = false;
613
614 try {
615 session = openSession();
616
617 scProductEntry = (SCProductEntry)session.get(SCProductEntryImpl.class,
618 Long.valueOf(productEntryId));
619 }
620 catch (Exception e) {
621 hasException = true;
622
623 throw processException(e);
624 }
625 finally {
626 if (scProductEntry != null) {
627 cacheResult(scProductEntry);
628 }
629 else if (!hasException) {
630 EntityCacheUtil.putResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
631 SCProductEntryImpl.class, productEntryId,
632 _nullSCProductEntry);
633 }
634
635 closeSession(session);
636 }
637 }
638
639 return scProductEntry;
640 }
641
642
649 public List<SCProductEntry> findByGroupId(long groupId)
650 throws SystemException {
651 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
652 }
653
654
667 public List<SCProductEntry> findByGroupId(long groupId, int start, int end)
668 throws SystemException {
669 return findByGroupId(groupId, start, end, null);
670 }
671
672
686 public List<SCProductEntry> findByGroupId(long groupId, int start, int end,
687 OrderByComparator orderByComparator) throws SystemException {
688 FinderPath finderPath = null;
689 Object[] finderArgs = null;
690
691 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
692 (orderByComparator == null)) {
693 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
694 finderArgs = new Object[] { groupId };
695 }
696 else {
697 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
698 finderArgs = new Object[] { groupId, start, end, orderByComparator };
699 }
700
701 List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(finderPath,
702 finderArgs, this);
703
704 if ((list != null) && !list.isEmpty()) {
705 for (SCProductEntry scProductEntry : list) {
706 if ((groupId != scProductEntry.getGroupId())) {
707 list = null;
708
709 break;
710 }
711 }
712 }
713
714 if (list == null) {
715 StringBundler query = null;
716
717 if (orderByComparator != null) {
718 query = new StringBundler(3 +
719 (orderByComparator.getOrderByFields().length * 3));
720 }
721 else {
722 query = new StringBundler(3);
723 }
724
725 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
726
727 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
728
729 if (orderByComparator != null) {
730 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
731 orderByComparator);
732 }
733
734 else {
735 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
736 }
737
738 String sql = query.toString();
739
740 Session session = null;
741
742 try {
743 session = openSession();
744
745 Query q = session.createQuery(sql);
746
747 QueryPos qPos = QueryPos.getInstance(q);
748
749 qPos.add(groupId);
750
751 list = (List<SCProductEntry>)QueryUtil.list(q, getDialect(),
752 start, end);
753 }
754 catch (Exception e) {
755 throw processException(e);
756 }
757 finally {
758 if (list == null) {
759 FinderCacheUtil.removeResult(finderPath, finderArgs);
760 }
761 else {
762 cacheResult(list);
763
764 FinderCacheUtil.putResult(finderPath, finderArgs, list);
765 }
766
767 closeSession(session);
768 }
769 }
770
771 return list;
772 }
773
774
783 public SCProductEntry findByGroupId_First(long groupId,
784 OrderByComparator orderByComparator)
785 throws NoSuchProductEntryException, SystemException {
786 SCProductEntry scProductEntry = fetchByGroupId_First(groupId,
787 orderByComparator);
788
789 if (scProductEntry != null) {
790 return scProductEntry;
791 }
792
793 StringBundler msg = new StringBundler(4);
794
795 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
796
797 msg.append("groupId=");
798 msg.append(groupId);
799
800 msg.append(StringPool.CLOSE_CURLY_BRACE);
801
802 throw new NoSuchProductEntryException(msg.toString());
803 }
804
805
813 public SCProductEntry fetchByGroupId_First(long groupId,
814 OrderByComparator orderByComparator) throws SystemException {
815 List<SCProductEntry> list = findByGroupId(groupId, 0, 1,
816 orderByComparator);
817
818 if (!list.isEmpty()) {
819 return list.get(0);
820 }
821
822 return null;
823 }
824
825
834 public SCProductEntry findByGroupId_Last(long groupId,
835 OrderByComparator orderByComparator)
836 throws NoSuchProductEntryException, SystemException {
837 SCProductEntry scProductEntry = fetchByGroupId_Last(groupId,
838 orderByComparator);
839
840 if (scProductEntry != null) {
841 return scProductEntry;
842 }
843
844 StringBundler msg = new StringBundler(4);
845
846 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
847
848 msg.append("groupId=");
849 msg.append(groupId);
850
851 msg.append(StringPool.CLOSE_CURLY_BRACE);
852
853 throw new NoSuchProductEntryException(msg.toString());
854 }
855
856
864 public SCProductEntry fetchByGroupId_Last(long groupId,
865 OrderByComparator orderByComparator) throws SystemException {
866 int count = countByGroupId(groupId);
867
868 List<SCProductEntry> list = findByGroupId(groupId, count - 1, count,
869 orderByComparator);
870
871 if (!list.isEmpty()) {
872 return list.get(0);
873 }
874
875 return null;
876 }
877
878
888 public SCProductEntry[] findByGroupId_PrevAndNext(long productEntryId,
889 long groupId, OrderByComparator orderByComparator)
890 throws NoSuchProductEntryException, SystemException {
891 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
892
893 Session session = null;
894
895 try {
896 session = openSession();
897
898 SCProductEntry[] array = new SCProductEntryImpl[3];
899
900 array[0] = getByGroupId_PrevAndNext(session, scProductEntry,
901 groupId, orderByComparator, true);
902
903 array[1] = scProductEntry;
904
905 array[2] = getByGroupId_PrevAndNext(session, scProductEntry,
906 groupId, orderByComparator, false);
907
908 return array;
909 }
910 catch (Exception e) {
911 throw processException(e);
912 }
913 finally {
914 closeSession(session);
915 }
916 }
917
918 protected SCProductEntry getByGroupId_PrevAndNext(Session session,
919 SCProductEntry scProductEntry, long groupId,
920 OrderByComparator orderByComparator, boolean previous) {
921 StringBundler query = null;
922
923 if (orderByComparator != null) {
924 query = new StringBundler(6 +
925 (orderByComparator.getOrderByFields().length * 6));
926 }
927 else {
928 query = new StringBundler(3);
929 }
930
931 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
932
933 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
934
935 if (orderByComparator != null) {
936 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
937
938 if (orderByConditionFields.length > 0) {
939 query.append(WHERE_AND);
940 }
941
942 for (int i = 0; i < orderByConditionFields.length; i++) {
943 query.append(_ORDER_BY_ENTITY_ALIAS);
944 query.append(orderByConditionFields[i]);
945
946 if ((i + 1) < orderByConditionFields.length) {
947 if (orderByComparator.isAscending() ^ previous) {
948 query.append(WHERE_GREATER_THAN_HAS_NEXT);
949 }
950 else {
951 query.append(WHERE_LESSER_THAN_HAS_NEXT);
952 }
953 }
954 else {
955 if (orderByComparator.isAscending() ^ previous) {
956 query.append(WHERE_GREATER_THAN);
957 }
958 else {
959 query.append(WHERE_LESSER_THAN);
960 }
961 }
962 }
963
964 query.append(ORDER_BY_CLAUSE);
965
966 String[] orderByFields = orderByComparator.getOrderByFields();
967
968 for (int i = 0; i < orderByFields.length; i++) {
969 query.append(_ORDER_BY_ENTITY_ALIAS);
970 query.append(orderByFields[i]);
971
972 if ((i + 1) < orderByFields.length) {
973 if (orderByComparator.isAscending() ^ previous) {
974 query.append(ORDER_BY_ASC_HAS_NEXT);
975 }
976 else {
977 query.append(ORDER_BY_DESC_HAS_NEXT);
978 }
979 }
980 else {
981 if (orderByComparator.isAscending() ^ previous) {
982 query.append(ORDER_BY_ASC);
983 }
984 else {
985 query.append(ORDER_BY_DESC);
986 }
987 }
988 }
989 }
990
991 else {
992 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
993 }
994
995 String sql = query.toString();
996
997 Query q = session.createQuery(sql);
998
999 q.setFirstResult(0);
1000 q.setMaxResults(2);
1001
1002 QueryPos qPos = QueryPos.getInstance(q);
1003
1004 qPos.add(groupId);
1005
1006 if (orderByComparator != null) {
1007 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
1008
1009 for (Object value : values) {
1010 qPos.add(value);
1011 }
1012 }
1013
1014 List<SCProductEntry> list = q.list();
1015
1016 if (list.size() == 2) {
1017 return list.get(1);
1018 }
1019 else {
1020 return null;
1021 }
1022 }
1023
1024
1031 public List<SCProductEntry> filterFindByGroupId(long groupId)
1032 throws SystemException {
1033 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1034 QueryUtil.ALL_POS, null);
1035 }
1036
1037
1050 public List<SCProductEntry> filterFindByGroupId(long groupId, int start,
1051 int end) throws SystemException {
1052 return filterFindByGroupId(groupId, start, end, null);
1053 }
1054
1055
1069 public List<SCProductEntry> filterFindByGroupId(long groupId, int start,
1070 int end, OrderByComparator orderByComparator) throws SystemException {
1071 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1072 return findByGroupId(groupId, start, end, orderByComparator);
1073 }
1074
1075 StringBundler query = null;
1076
1077 if (orderByComparator != null) {
1078 query = new StringBundler(3 +
1079 (orderByComparator.getOrderByFields().length * 3));
1080 }
1081 else {
1082 query = new StringBundler(3);
1083 }
1084
1085 if (getDB().isSupportsInlineDistinct()) {
1086 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1087 }
1088 else {
1089 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1);
1090 }
1091
1092 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1093
1094 if (!getDB().isSupportsInlineDistinct()) {
1095 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2);
1096 }
1097
1098 if (orderByComparator != null) {
1099 if (getDB().isSupportsInlineDistinct()) {
1100 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1101 orderByComparator);
1102 }
1103 else {
1104 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1105 orderByComparator);
1106 }
1107 }
1108
1109 else {
1110 if (getDB().isSupportsInlineDistinct()) {
1111 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1112 }
1113 else {
1114 query.append(SCProductEntryModelImpl.ORDER_BY_SQL);
1115 }
1116 }
1117
1118 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1119 SCProductEntry.class.getName(),
1120 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1121
1122 Session session = null;
1123
1124 try {
1125 session = openSession();
1126
1127 SQLQuery q = session.createSQLQuery(sql);
1128
1129 if (getDB().isSupportsInlineDistinct()) {
1130 q.addEntity(_FILTER_ENTITY_ALIAS, SCProductEntryImpl.class);
1131 }
1132 else {
1133 q.addEntity(_FILTER_ENTITY_TABLE, SCProductEntryImpl.class);
1134 }
1135
1136 QueryPos qPos = QueryPos.getInstance(q);
1137
1138 qPos.add(groupId);
1139
1140 return (List<SCProductEntry>)QueryUtil.list(q, getDialect(), start,
1141 end);
1142 }
1143 catch (Exception e) {
1144 throw processException(e);
1145 }
1146 finally {
1147 closeSession(session);
1148 }
1149 }
1150
1151
1161 public SCProductEntry[] filterFindByGroupId_PrevAndNext(
1162 long productEntryId, long groupId, OrderByComparator orderByComparator)
1163 throws NoSuchProductEntryException, SystemException {
1164 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1165 return findByGroupId_PrevAndNext(productEntryId, groupId,
1166 orderByComparator);
1167 }
1168
1169 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
1170
1171 Session session = null;
1172
1173 try {
1174 session = openSession();
1175
1176 SCProductEntry[] array = new SCProductEntryImpl[3];
1177
1178 array[0] = filterGetByGroupId_PrevAndNext(session, scProductEntry,
1179 groupId, orderByComparator, true);
1180
1181 array[1] = scProductEntry;
1182
1183 array[2] = filterGetByGroupId_PrevAndNext(session, scProductEntry,
1184 groupId, orderByComparator, false);
1185
1186 return array;
1187 }
1188 catch (Exception e) {
1189 throw processException(e);
1190 }
1191 finally {
1192 closeSession(session);
1193 }
1194 }
1195
1196 protected SCProductEntry filterGetByGroupId_PrevAndNext(Session session,
1197 SCProductEntry scProductEntry, long groupId,
1198 OrderByComparator orderByComparator, boolean previous) {
1199 StringBundler query = null;
1200
1201 if (orderByComparator != null) {
1202 query = new StringBundler(6 +
1203 (orderByComparator.getOrderByFields().length * 6));
1204 }
1205 else {
1206 query = new StringBundler(3);
1207 }
1208
1209 if (getDB().isSupportsInlineDistinct()) {
1210 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1211 }
1212 else {
1213 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1);
1214 }
1215
1216 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1217
1218 if (!getDB().isSupportsInlineDistinct()) {
1219 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2);
1220 }
1221
1222 if (orderByComparator != null) {
1223 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1224
1225 if (orderByConditionFields.length > 0) {
1226 query.append(WHERE_AND);
1227 }
1228
1229 for (int i = 0; i < orderByConditionFields.length; i++) {
1230 if (getDB().isSupportsInlineDistinct()) {
1231 query.append(_ORDER_BY_ENTITY_ALIAS);
1232 }
1233 else {
1234 query.append(_ORDER_BY_ENTITY_TABLE);
1235 }
1236
1237 query.append(orderByConditionFields[i]);
1238
1239 if ((i + 1) < orderByConditionFields.length) {
1240 if (orderByComparator.isAscending() ^ previous) {
1241 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1242 }
1243 else {
1244 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1245 }
1246 }
1247 else {
1248 if (orderByComparator.isAscending() ^ previous) {
1249 query.append(WHERE_GREATER_THAN);
1250 }
1251 else {
1252 query.append(WHERE_LESSER_THAN);
1253 }
1254 }
1255 }
1256
1257 query.append(ORDER_BY_CLAUSE);
1258
1259 String[] orderByFields = orderByComparator.getOrderByFields();
1260
1261 for (int i = 0; i < orderByFields.length; i++) {
1262 if (getDB().isSupportsInlineDistinct()) {
1263 query.append(_ORDER_BY_ENTITY_ALIAS);
1264 }
1265 else {
1266 query.append(_ORDER_BY_ENTITY_TABLE);
1267 }
1268
1269 query.append(orderByFields[i]);
1270
1271 if ((i + 1) < orderByFields.length) {
1272 if (orderByComparator.isAscending() ^ previous) {
1273 query.append(ORDER_BY_ASC_HAS_NEXT);
1274 }
1275 else {
1276 query.append(ORDER_BY_DESC_HAS_NEXT);
1277 }
1278 }
1279 else {
1280 if (orderByComparator.isAscending() ^ previous) {
1281 query.append(ORDER_BY_ASC);
1282 }
1283 else {
1284 query.append(ORDER_BY_DESC);
1285 }
1286 }
1287 }
1288 }
1289
1290 else {
1291 if (getDB().isSupportsInlineDistinct()) {
1292 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1293 }
1294 else {
1295 query.append(SCProductEntryModelImpl.ORDER_BY_SQL);
1296 }
1297 }
1298
1299 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1300 SCProductEntry.class.getName(),
1301 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1302
1303 SQLQuery q = session.createSQLQuery(sql);
1304
1305 q.setFirstResult(0);
1306 q.setMaxResults(2);
1307
1308 if (getDB().isSupportsInlineDistinct()) {
1309 q.addEntity(_FILTER_ENTITY_ALIAS, SCProductEntryImpl.class);
1310 }
1311 else {
1312 q.addEntity(_FILTER_ENTITY_TABLE, SCProductEntryImpl.class);
1313 }
1314
1315 QueryPos qPos = QueryPos.getInstance(q);
1316
1317 qPos.add(groupId);
1318
1319 if (orderByComparator != null) {
1320 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
1321
1322 for (Object value : values) {
1323 qPos.add(value);
1324 }
1325 }
1326
1327 List<SCProductEntry> list = q.list();
1328
1329 if (list.size() == 2) {
1330 return list.get(1);
1331 }
1332 else {
1333 return null;
1334 }
1335 }
1336
1337
1344 public List<SCProductEntry> findByCompanyId(long companyId)
1345 throws SystemException {
1346 return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1347 null);
1348 }
1349
1350
1363 public List<SCProductEntry> findByCompanyId(long companyId, int start,
1364 int end) throws SystemException {
1365 return findByCompanyId(companyId, start, end, null);
1366 }
1367
1368
1382 public List<SCProductEntry> findByCompanyId(long companyId, int start,
1383 int end, OrderByComparator orderByComparator) throws SystemException {
1384 FinderPath finderPath = null;
1385 Object[] finderArgs = null;
1386
1387 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1388 (orderByComparator == null)) {
1389 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
1390 finderArgs = new Object[] { companyId };
1391 }
1392 else {
1393 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
1394 finderArgs = new Object[] { companyId, start, end, orderByComparator };
1395 }
1396
1397 List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(finderPath,
1398 finderArgs, this);
1399
1400 if ((list != null) && !list.isEmpty()) {
1401 for (SCProductEntry scProductEntry : list) {
1402 if ((companyId != scProductEntry.getCompanyId())) {
1403 list = null;
1404
1405 break;
1406 }
1407 }
1408 }
1409
1410 if (list == null) {
1411 StringBundler query = null;
1412
1413 if (orderByComparator != null) {
1414 query = new StringBundler(3 +
1415 (orderByComparator.getOrderByFields().length * 3));
1416 }
1417 else {
1418 query = new StringBundler(3);
1419 }
1420
1421 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1422
1423 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1424
1425 if (orderByComparator != null) {
1426 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1427 orderByComparator);
1428 }
1429
1430 else {
1431 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1432 }
1433
1434 String sql = query.toString();
1435
1436 Session session = null;
1437
1438 try {
1439 session = openSession();
1440
1441 Query q = session.createQuery(sql);
1442
1443 QueryPos qPos = QueryPos.getInstance(q);
1444
1445 qPos.add(companyId);
1446
1447 list = (List<SCProductEntry>)QueryUtil.list(q, getDialect(),
1448 start, end);
1449 }
1450 catch (Exception e) {
1451 throw processException(e);
1452 }
1453 finally {
1454 if (list == null) {
1455 FinderCacheUtil.removeResult(finderPath, finderArgs);
1456 }
1457 else {
1458 cacheResult(list);
1459
1460 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1461 }
1462
1463 closeSession(session);
1464 }
1465 }
1466
1467 return list;
1468 }
1469
1470
1479 public SCProductEntry findByCompanyId_First(long companyId,
1480 OrderByComparator orderByComparator)
1481 throws NoSuchProductEntryException, SystemException {
1482 SCProductEntry scProductEntry = fetchByCompanyId_First(companyId,
1483 orderByComparator);
1484
1485 if (scProductEntry != null) {
1486 return scProductEntry;
1487 }
1488
1489 StringBundler msg = new StringBundler(4);
1490
1491 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1492
1493 msg.append("companyId=");
1494 msg.append(companyId);
1495
1496 msg.append(StringPool.CLOSE_CURLY_BRACE);
1497
1498 throw new NoSuchProductEntryException(msg.toString());
1499 }
1500
1501
1509 public SCProductEntry fetchByCompanyId_First(long companyId,
1510 OrderByComparator orderByComparator) throws SystemException {
1511 List<SCProductEntry> list = findByCompanyId(companyId, 0, 1,
1512 orderByComparator);
1513
1514 if (!list.isEmpty()) {
1515 return list.get(0);
1516 }
1517
1518 return null;
1519 }
1520
1521
1530 public SCProductEntry findByCompanyId_Last(long companyId,
1531 OrderByComparator orderByComparator)
1532 throws NoSuchProductEntryException, SystemException {
1533 SCProductEntry scProductEntry = fetchByCompanyId_Last(companyId,
1534 orderByComparator);
1535
1536 if (scProductEntry != null) {
1537 return scProductEntry;
1538 }
1539
1540 StringBundler msg = new StringBundler(4);
1541
1542 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1543
1544 msg.append("companyId=");
1545 msg.append(companyId);
1546
1547 msg.append(StringPool.CLOSE_CURLY_BRACE);
1548
1549 throw new NoSuchProductEntryException(msg.toString());
1550 }
1551
1552
1560 public SCProductEntry fetchByCompanyId_Last(long companyId,
1561 OrderByComparator orderByComparator) throws SystemException {
1562 int count = countByCompanyId(companyId);
1563
1564 List<SCProductEntry> list = findByCompanyId(companyId, count - 1,
1565 count, orderByComparator);
1566
1567 if (!list.isEmpty()) {
1568 return list.get(0);
1569 }
1570
1571 return null;
1572 }
1573
1574
1584 public SCProductEntry[] findByCompanyId_PrevAndNext(long productEntryId,
1585 long companyId, OrderByComparator orderByComparator)
1586 throws NoSuchProductEntryException, SystemException {
1587 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
1588
1589 Session session = null;
1590
1591 try {
1592 session = openSession();
1593
1594 SCProductEntry[] array = new SCProductEntryImpl[3];
1595
1596 array[0] = getByCompanyId_PrevAndNext(session, scProductEntry,
1597 companyId, orderByComparator, true);
1598
1599 array[1] = scProductEntry;
1600
1601 array[2] = getByCompanyId_PrevAndNext(session, scProductEntry,
1602 companyId, orderByComparator, false);
1603
1604 return array;
1605 }
1606 catch (Exception e) {
1607 throw processException(e);
1608 }
1609 finally {
1610 closeSession(session);
1611 }
1612 }
1613
1614 protected SCProductEntry getByCompanyId_PrevAndNext(Session session,
1615 SCProductEntry scProductEntry, long companyId,
1616 OrderByComparator orderByComparator, boolean previous) {
1617 StringBundler query = null;
1618
1619 if (orderByComparator != null) {
1620 query = new StringBundler(6 +
1621 (orderByComparator.getOrderByFields().length * 6));
1622 }
1623 else {
1624 query = new StringBundler(3);
1625 }
1626
1627 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1628
1629 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1630
1631 if (orderByComparator != null) {
1632 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1633
1634 if (orderByConditionFields.length > 0) {
1635 query.append(WHERE_AND);
1636 }
1637
1638 for (int i = 0; i < orderByConditionFields.length; i++) {
1639 query.append(_ORDER_BY_ENTITY_ALIAS);
1640 query.append(orderByConditionFields[i]);
1641
1642 if ((i + 1) < orderByConditionFields.length) {
1643 if (orderByComparator.isAscending() ^ previous) {
1644 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1645 }
1646 else {
1647 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1648 }
1649 }
1650 else {
1651 if (orderByComparator.isAscending() ^ previous) {
1652 query.append(WHERE_GREATER_THAN);
1653 }
1654 else {
1655 query.append(WHERE_LESSER_THAN);
1656 }
1657 }
1658 }
1659
1660 query.append(ORDER_BY_CLAUSE);
1661
1662 String[] orderByFields = orderByComparator.getOrderByFields();
1663
1664 for (int i = 0; i < orderByFields.length; i++) {
1665 query.append(_ORDER_BY_ENTITY_ALIAS);
1666 query.append(orderByFields[i]);
1667
1668 if ((i + 1) < orderByFields.length) {
1669 if (orderByComparator.isAscending() ^ previous) {
1670 query.append(ORDER_BY_ASC_HAS_NEXT);
1671 }
1672 else {
1673 query.append(ORDER_BY_DESC_HAS_NEXT);
1674 }
1675 }
1676 else {
1677 if (orderByComparator.isAscending() ^ previous) {
1678 query.append(ORDER_BY_ASC);
1679 }
1680 else {
1681 query.append(ORDER_BY_DESC);
1682 }
1683 }
1684 }
1685 }
1686
1687 else {
1688 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1689 }
1690
1691 String sql = query.toString();
1692
1693 Query q = session.createQuery(sql);
1694
1695 q.setFirstResult(0);
1696 q.setMaxResults(2);
1697
1698 QueryPos qPos = QueryPos.getInstance(q);
1699
1700 qPos.add(companyId);
1701
1702 if (orderByComparator != null) {
1703 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
1704
1705 for (Object value : values) {
1706 qPos.add(value);
1707 }
1708 }
1709
1710 List<SCProductEntry> list = q.list();
1711
1712 if (list.size() == 2) {
1713 return list.get(1);
1714 }
1715 else {
1716 return null;
1717 }
1718 }
1719
1720
1728 public List<SCProductEntry> findByG_U(long groupId, long userId)
1729 throws SystemException {
1730 return findByG_U(groupId, userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1731 null);
1732 }
1733
1734
1748 public List<SCProductEntry> findByG_U(long groupId, long userId, int start,
1749 int end) throws SystemException {
1750 return findByG_U(groupId, userId, start, end, null);
1751 }
1752
1753
1768 public List<SCProductEntry> findByG_U(long groupId, long userId, int start,
1769 int end, OrderByComparator orderByComparator) throws SystemException {
1770 FinderPath finderPath = null;
1771 Object[] finderArgs = null;
1772
1773 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1774 (orderByComparator == null)) {
1775 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_U;
1776 finderArgs = new Object[] { groupId, userId };
1777 }
1778 else {
1779 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_U;
1780 finderArgs = new Object[] {
1781 groupId, userId,
1782
1783 start, end, orderByComparator
1784 };
1785 }
1786
1787 List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(finderPath,
1788 finderArgs, this);
1789
1790 if ((list != null) && !list.isEmpty()) {
1791 for (SCProductEntry scProductEntry : list) {
1792 if ((groupId != scProductEntry.getGroupId()) ||
1793 (userId != scProductEntry.getUserId())) {
1794 list = null;
1795
1796 break;
1797 }
1798 }
1799 }
1800
1801 if (list == null) {
1802 StringBundler query = null;
1803
1804 if (orderByComparator != null) {
1805 query = new StringBundler(4 +
1806 (orderByComparator.getOrderByFields().length * 3));
1807 }
1808 else {
1809 query = new StringBundler(4);
1810 }
1811
1812 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
1813
1814 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1815
1816 query.append(_FINDER_COLUMN_G_U_USERID_2);
1817
1818 if (orderByComparator != null) {
1819 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1820 orderByComparator);
1821 }
1822
1823 else {
1824 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
1825 }
1826
1827 String sql = query.toString();
1828
1829 Session session = null;
1830
1831 try {
1832 session = openSession();
1833
1834 Query q = session.createQuery(sql);
1835
1836 QueryPos qPos = QueryPos.getInstance(q);
1837
1838 qPos.add(groupId);
1839
1840 qPos.add(userId);
1841
1842 list = (List<SCProductEntry>)QueryUtil.list(q, getDialect(),
1843 start, end);
1844 }
1845 catch (Exception e) {
1846 throw processException(e);
1847 }
1848 finally {
1849 if (list == null) {
1850 FinderCacheUtil.removeResult(finderPath, finderArgs);
1851 }
1852 else {
1853 cacheResult(list);
1854
1855 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1856 }
1857
1858 closeSession(session);
1859 }
1860 }
1861
1862 return list;
1863 }
1864
1865
1875 public SCProductEntry findByG_U_First(long groupId, long userId,
1876 OrderByComparator orderByComparator)
1877 throws NoSuchProductEntryException, SystemException {
1878 SCProductEntry scProductEntry = fetchByG_U_First(groupId, userId,
1879 orderByComparator);
1880
1881 if (scProductEntry != null) {
1882 return scProductEntry;
1883 }
1884
1885 StringBundler msg = new StringBundler(6);
1886
1887 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1888
1889 msg.append("groupId=");
1890 msg.append(groupId);
1891
1892 msg.append(", userId=");
1893 msg.append(userId);
1894
1895 msg.append(StringPool.CLOSE_CURLY_BRACE);
1896
1897 throw new NoSuchProductEntryException(msg.toString());
1898 }
1899
1900
1909 public SCProductEntry fetchByG_U_First(long groupId, long userId,
1910 OrderByComparator orderByComparator) throws SystemException {
1911 List<SCProductEntry> list = findByG_U(groupId, userId, 0, 1,
1912 orderByComparator);
1913
1914 if (!list.isEmpty()) {
1915 return list.get(0);
1916 }
1917
1918 return null;
1919 }
1920
1921
1931 public SCProductEntry findByG_U_Last(long groupId, long userId,
1932 OrderByComparator orderByComparator)
1933 throws NoSuchProductEntryException, SystemException {
1934 SCProductEntry scProductEntry = fetchByG_U_Last(groupId, userId,
1935 orderByComparator);
1936
1937 if (scProductEntry != null) {
1938 return scProductEntry;
1939 }
1940
1941 StringBundler msg = new StringBundler(6);
1942
1943 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1944
1945 msg.append("groupId=");
1946 msg.append(groupId);
1947
1948 msg.append(", userId=");
1949 msg.append(userId);
1950
1951 msg.append(StringPool.CLOSE_CURLY_BRACE);
1952
1953 throw new NoSuchProductEntryException(msg.toString());
1954 }
1955
1956
1965 public SCProductEntry fetchByG_U_Last(long groupId, long userId,
1966 OrderByComparator orderByComparator) throws SystemException {
1967 int count = countByG_U(groupId, userId);
1968
1969 List<SCProductEntry> list = findByG_U(groupId, userId, count - 1,
1970 count, orderByComparator);
1971
1972 if (!list.isEmpty()) {
1973 return list.get(0);
1974 }
1975
1976 return null;
1977 }
1978
1979
1990 public SCProductEntry[] findByG_U_PrevAndNext(long productEntryId,
1991 long groupId, long userId, OrderByComparator orderByComparator)
1992 throws NoSuchProductEntryException, SystemException {
1993 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
1994
1995 Session session = null;
1996
1997 try {
1998 session = openSession();
1999
2000 SCProductEntry[] array = new SCProductEntryImpl[3];
2001
2002 array[0] = getByG_U_PrevAndNext(session, scProductEntry, groupId,
2003 userId, orderByComparator, true);
2004
2005 array[1] = scProductEntry;
2006
2007 array[2] = getByG_U_PrevAndNext(session, scProductEntry, groupId,
2008 userId, orderByComparator, false);
2009
2010 return array;
2011 }
2012 catch (Exception e) {
2013 throw processException(e);
2014 }
2015 finally {
2016 closeSession(session);
2017 }
2018 }
2019
2020 protected SCProductEntry getByG_U_PrevAndNext(Session session,
2021 SCProductEntry scProductEntry, long groupId, long userId,
2022 OrderByComparator orderByComparator, boolean previous) {
2023 StringBundler query = null;
2024
2025 if (orderByComparator != null) {
2026 query = new StringBundler(6 +
2027 (orderByComparator.getOrderByFields().length * 6));
2028 }
2029 else {
2030 query = new StringBundler(3);
2031 }
2032
2033 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
2034
2035 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2036
2037 query.append(_FINDER_COLUMN_G_U_USERID_2);
2038
2039 if (orderByComparator != null) {
2040 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2041
2042 if (orderByConditionFields.length > 0) {
2043 query.append(WHERE_AND);
2044 }
2045
2046 for (int i = 0; i < orderByConditionFields.length; i++) {
2047 query.append(_ORDER_BY_ENTITY_ALIAS);
2048 query.append(orderByConditionFields[i]);
2049
2050 if ((i + 1) < orderByConditionFields.length) {
2051 if (orderByComparator.isAscending() ^ previous) {
2052 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2053 }
2054 else {
2055 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2056 }
2057 }
2058 else {
2059 if (orderByComparator.isAscending() ^ previous) {
2060 query.append(WHERE_GREATER_THAN);
2061 }
2062 else {
2063 query.append(WHERE_LESSER_THAN);
2064 }
2065 }
2066 }
2067
2068 query.append(ORDER_BY_CLAUSE);
2069
2070 String[] orderByFields = orderByComparator.getOrderByFields();
2071
2072 for (int i = 0; i < orderByFields.length; i++) {
2073 query.append(_ORDER_BY_ENTITY_ALIAS);
2074 query.append(orderByFields[i]);
2075
2076 if ((i + 1) < orderByFields.length) {
2077 if (orderByComparator.isAscending() ^ previous) {
2078 query.append(ORDER_BY_ASC_HAS_NEXT);
2079 }
2080 else {
2081 query.append(ORDER_BY_DESC_HAS_NEXT);
2082 }
2083 }
2084 else {
2085 if (orderByComparator.isAscending() ^ previous) {
2086 query.append(ORDER_BY_ASC);
2087 }
2088 else {
2089 query.append(ORDER_BY_DESC);
2090 }
2091 }
2092 }
2093 }
2094
2095 else {
2096 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
2097 }
2098
2099 String sql = query.toString();
2100
2101 Query q = session.createQuery(sql);
2102
2103 q.setFirstResult(0);
2104 q.setMaxResults(2);
2105
2106 QueryPos qPos = QueryPos.getInstance(q);
2107
2108 qPos.add(groupId);
2109
2110 qPos.add(userId);
2111
2112 if (orderByComparator != null) {
2113 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
2114
2115 for (Object value : values) {
2116 qPos.add(value);
2117 }
2118 }
2119
2120 List<SCProductEntry> list = q.list();
2121
2122 if (list.size() == 2) {
2123 return list.get(1);
2124 }
2125 else {
2126 return null;
2127 }
2128 }
2129
2130
2138 public List<SCProductEntry> filterFindByG_U(long groupId, long userId)
2139 throws SystemException {
2140 return filterFindByG_U(groupId, userId, QueryUtil.ALL_POS,
2141 QueryUtil.ALL_POS, null);
2142 }
2143
2144
2158 public List<SCProductEntry> filterFindByG_U(long groupId, long userId,
2159 int start, int end) throws SystemException {
2160 return filterFindByG_U(groupId, userId, start, end, null);
2161 }
2162
2163
2178 public List<SCProductEntry> filterFindByG_U(long groupId, long userId,
2179 int start, int end, OrderByComparator orderByComparator)
2180 throws SystemException {
2181 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2182 return findByG_U(groupId, userId, start, end, orderByComparator);
2183 }
2184
2185 StringBundler query = null;
2186
2187 if (orderByComparator != null) {
2188 query = new StringBundler(4 +
2189 (orderByComparator.getOrderByFields().length * 3));
2190 }
2191 else {
2192 query = new StringBundler(4);
2193 }
2194
2195 if (getDB().isSupportsInlineDistinct()) {
2196 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE);
2197 }
2198 else {
2199 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1);
2200 }
2201
2202 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2203
2204 query.append(_FINDER_COLUMN_G_U_USERID_2);
2205
2206 if (!getDB().isSupportsInlineDistinct()) {
2207 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2);
2208 }
2209
2210 if (orderByComparator != null) {
2211 if (getDB().isSupportsInlineDistinct()) {
2212 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2213 orderByComparator);
2214 }
2215 else {
2216 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2217 orderByComparator);
2218 }
2219 }
2220
2221 else {
2222 if (getDB().isSupportsInlineDistinct()) {
2223 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
2224 }
2225 else {
2226 query.append(SCProductEntryModelImpl.ORDER_BY_SQL);
2227 }
2228 }
2229
2230 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2231 SCProductEntry.class.getName(),
2232 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2233
2234 Session session = null;
2235
2236 try {
2237 session = openSession();
2238
2239 SQLQuery q = session.createSQLQuery(sql);
2240
2241 if (getDB().isSupportsInlineDistinct()) {
2242 q.addEntity(_FILTER_ENTITY_ALIAS, SCProductEntryImpl.class);
2243 }
2244 else {
2245 q.addEntity(_FILTER_ENTITY_TABLE, SCProductEntryImpl.class);
2246 }
2247
2248 QueryPos qPos = QueryPos.getInstance(q);
2249
2250 qPos.add(groupId);
2251
2252 qPos.add(userId);
2253
2254 return (List<SCProductEntry>)QueryUtil.list(q, getDialect(), start,
2255 end);
2256 }
2257 catch (Exception e) {
2258 throw processException(e);
2259 }
2260 finally {
2261 closeSession(session);
2262 }
2263 }
2264
2265
2276 public SCProductEntry[] filterFindByG_U_PrevAndNext(long productEntryId,
2277 long groupId, long userId, OrderByComparator orderByComparator)
2278 throws NoSuchProductEntryException, SystemException {
2279 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2280 return findByG_U_PrevAndNext(productEntryId, groupId, userId,
2281 orderByComparator);
2282 }
2283
2284 SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
2285
2286 Session session = null;
2287
2288 try {
2289 session = openSession();
2290
2291 SCProductEntry[] array = new SCProductEntryImpl[3];
2292
2293 array[0] = filterGetByG_U_PrevAndNext(session, scProductEntry,
2294 groupId, userId, orderByComparator, true);
2295
2296 array[1] = scProductEntry;
2297
2298 array[2] = filterGetByG_U_PrevAndNext(session, scProductEntry,
2299 groupId, userId, orderByComparator, false);
2300
2301 return array;
2302 }
2303 catch (Exception e) {
2304 throw processException(e);
2305 }
2306 finally {
2307 closeSession(session);
2308 }
2309 }
2310
2311 protected SCProductEntry filterGetByG_U_PrevAndNext(Session session,
2312 SCProductEntry scProductEntry, long groupId, long userId,
2313 OrderByComparator orderByComparator, boolean previous) {
2314 StringBundler query = null;
2315
2316 if (orderByComparator != null) {
2317 query = new StringBundler(6 +
2318 (orderByComparator.getOrderByFields().length * 6));
2319 }
2320 else {
2321 query = new StringBundler(3);
2322 }
2323
2324 if (getDB().isSupportsInlineDistinct()) {
2325 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE);
2326 }
2327 else {
2328 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1);
2329 }
2330
2331 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2332
2333 query.append(_FINDER_COLUMN_G_U_USERID_2);
2334
2335 if (!getDB().isSupportsInlineDistinct()) {
2336 query.append(_FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2);
2337 }
2338
2339 if (orderByComparator != null) {
2340 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2341
2342 if (orderByConditionFields.length > 0) {
2343 query.append(WHERE_AND);
2344 }
2345
2346 for (int i = 0; i < orderByConditionFields.length; i++) {
2347 if (getDB().isSupportsInlineDistinct()) {
2348 query.append(_ORDER_BY_ENTITY_ALIAS);
2349 }
2350 else {
2351 query.append(_ORDER_BY_ENTITY_TABLE);
2352 }
2353
2354 query.append(orderByConditionFields[i]);
2355
2356 if ((i + 1) < orderByConditionFields.length) {
2357 if (orderByComparator.isAscending() ^ previous) {
2358 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2359 }
2360 else {
2361 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2362 }
2363 }
2364 else {
2365 if (orderByComparator.isAscending() ^ previous) {
2366 query.append(WHERE_GREATER_THAN);
2367 }
2368 else {
2369 query.append(WHERE_LESSER_THAN);
2370 }
2371 }
2372 }
2373
2374 query.append(ORDER_BY_CLAUSE);
2375
2376 String[] orderByFields = orderByComparator.getOrderByFields();
2377
2378 for (int i = 0; i < orderByFields.length; i++) {
2379 if (getDB().isSupportsInlineDistinct()) {
2380 query.append(_ORDER_BY_ENTITY_ALIAS);
2381 }
2382 else {
2383 query.append(_ORDER_BY_ENTITY_TABLE);
2384 }
2385
2386 query.append(orderByFields[i]);
2387
2388 if ((i + 1) < orderByFields.length) {
2389 if (orderByComparator.isAscending() ^ previous) {
2390 query.append(ORDER_BY_ASC_HAS_NEXT);
2391 }
2392 else {
2393 query.append(ORDER_BY_DESC_HAS_NEXT);
2394 }
2395 }
2396 else {
2397 if (orderByComparator.isAscending() ^ previous) {
2398 query.append(ORDER_BY_ASC);
2399 }
2400 else {
2401 query.append(ORDER_BY_DESC);
2402 }
2403 }
2404 }
2405 }
2406
2407 else {
2408 if (getDB().isSupportsInlineDistinct()) {
2409 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
2410 }
2411 else {
2412 query.append(SCProductEntryModelImpl.ORDER_BY_SQL);
2413 }
2414 }
2415
2416 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2417 SCProductEntry.class.getName(),
2418 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2419
2420 SQLQuery q = session.createSQLQuery(sql);
2421
2422 q.setFirstResult(0);
2423 q.setMaxResults(2);
2424
2425 if (getDB().isSupportsInlineDistinct()) {
2426 q.addEntity(_FILTER_ENTITY_ALIAS, SCProductEntryImpl.class);
2427 }
2428 else {
2429 q.addEntity(_FILTER_ENTITY_TABLE, SCProductEntryImpl.class);
2430 }
2431
2432 QueryPos qPos = QueryPos.getInstance(q);
2433
2434 qPos.add(groupId);
2435
2436 qPos.add(userId);
2437
2438 if (orderByComparator != null) {
2439 Object[] values = orderByComparator.getOrderByConditionValues(scProductEntry);
2440
2441 for (Object value : values) {
2442 qPos.add(value);
2443 }
2444 }
2445
2446 List<SCProductEntry> list = q.list();
2447
2448 if (list.size() == 2) {
2449 return list.get(1);
2450 }
2451 else {
2452 return null;
2453 }
2454 }
2455
2456
2465 public SCProductEntry findByRG_RA(String repoGroupId, String repoArtifactId)
2466 throws NoSuchProductEntryException, SystemException {
2467 SCProductEntry scProductEntry = fetchByRG_RA(repoGroupId, repoArtifactId);
2468
2469 if (scProductEntry == null) {
2470 StringBundler msg = new StringBundler(6);
2471
2472 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2473
2474 msg.append("repoGroupId=");
2475 msg.append(repoGroupId);
2476
2477 msg.append(", repoArtifactId=");
2478 msg.append(repoArtifactId);
2479
2480 msg.append(StringPool.CLOSE_CURLY_BRACE);
2481
2482 if (_log.isWarnEnabled()) {
2483 _log.warn(msg.toString());
2484 }
2485
2486 throw new NoSuchProductEntryException(msg.toString());
2487 }
2488
2489 return scProductEntry;
2490 }
2491
2492
2500 public SCProductEntry fetchByRG_RA(String repoGroupId, String repoArtifactId)
2501 throws SystemException {
2502 return fetchByRG_RA(repoGroupId, repoArtifactId, true);
2503 }
2504
2505
2514 public SCProductEntry fetchByRG_RA(String repoGroupId,
2515 String repoArtifactId, boolean retrieveFromCache)
2516 throws SystemException {
2517 Object[] finderArgs = new Object[] { repoGroupId, repoArtifactId };
2518
2519 Object result = null;
2520
2521 if (retrieveFromCache) {
2522 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_RG_RA,
2523 finderArgs, this);
2524 }
2525
2526 if (result instanceof SCProductEntry) {
2527 SCProductEntry scProductEntry = (SCProductEntry)result;
2528
2529 if (!Validator.equals(repoGroupId, scProductEntry.getRepoGroupId()) ||
2530 !Validator.equals(repoArtifactId,
2531 scProductEntry.getRepoArtifactId())) {
2532 result = null;
2533 }
2534 }
2535
2536 if (result == null) {
2537 StringBundler query = new StringBundler(4);
2538
2539 query.append(_SQL_SELECT_SCPRODUCTENTRY_WHERE);
2540
2541 if (repoGroupId == null) {
2542 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_1);
2543 }
2544 else {
2545 if (repoGroupId.equals(StringPool.BLANK)) {
2546 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_3);
2547 }
2548 else {
2549 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_2);
2550 }
2551 }
2552
2553 if (repoArtifactId == null) {
2554 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_1);
2555 }
2556 else {
2557 if (repoArtifactId.equals(StringPool.BLANK)) {
2558 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_3);
2559 }
2560 else {
2561 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_2);
2562 }
2563 }
2564
2565 query.append(SCProductEntryModelImpl.ORDER_BY_JPQL);
2566
2567 String sql = query.toString();
2568
2569 Session session = null;
2570
2571 try {
2572 session = openSession();
2573
2574 Query q = session.createQuery(sql);
2575
2576 QueryPos qPos = QueryPos.getInstance(q);
2577
2578 if (repoGroupId != null) {
2579 qPos.add(repoGroupId);
2580 }
2581
2582 if (repoArtifactId != null) {
2583 qPos.add(repoArtifactId);
2584 }
2585
2586 List<SCProductEntry> list = q.list();
2587
2588 result = list;
2589
2590 SCProductEntry scProductEntry = null;
2591
2592 if (list.isEmpty()) {
2593 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
2594 finderArgs, list);
2595 }
2596 else {
2597 scProductEntry = list.get(0);
2598
2599 cacheResult(scProductEntry);
2600
2601 if ((scProductEntry.getRepoGroupId() == null) ||
2602 !scProductEntry.getRepoGroupId().equals(repoGroupId) ||
2603 (scProductEntry.getRepoArtifactId() == null) ||
2604 !scProductEntry.getRepoArtifactId()
2605 .equals(repoArtifactId)) {
2606 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
2607 finderArgs, scProductEntry);
2608 }
2609 }
2610
2611 return scProductEntry;
2612 }
2613 catch (Exception e) {
2614 throw processException(e);
2615 }
2616 finally {
2617 if (result == null) {
2618 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_RG_RA,
2619 finderArgs);
2620 }
2621
2622 closeSession(session);
2623 }
2624 }
2625 else {
2626 if (result instanceof List<?>) {
2627 return null;
2628 }
2629 else {
2630 return (SCProductEntry)result;
2631 }
2632 }
2633 }
2634
2635
2641 public List<SCProductEntry> findAll() throws SystemException {
2642 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2643 }
2644
2645
2657 public List<SCProductEntry> findAll(int start, int end)
2658 throws SystemException {
2659 return findAll(start, end, null);
2660 }
2661
2662
2675 public List<SCProductEntry> findAll(int start, int end,
2676 OrderByComparator orderByComparator) throws SystemException {
2677 FinderPath finderPath = null;
2678 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2679
2680 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2681 (orderByComparator == null)) {
2682 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2683 finderArgs = FINDER_ARGS_EMPTY;
2684 }
2685 else {
2686 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2687 finderArgs = new Object[] { start, end, orderByComparator };
2688 }
2689
2690 List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(finderPath,
2691 finderArgs, this);
2692
2693 if (list == null) {
2694 StringBundler query = null;
2695 String sql = null;
2696
2697 if (orderByComparator != null) {
2698 query = new StringBundler(2 +
2699 (orderByComparator.getOrderByFields().length * 3));
2700
2701 query.append(_SQL_SELECT_SCPRODUCTENTRY);
2702
2703 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2704 orderByComparator);
2705
2706 sql = query.toString();
2707 }
2708 else {
2709 sql = _SQL_SELECT_SCPRODUCTENTRY.concat(SCProductEntryModelImpl.ORDER_BY_JPQL);
2710 }
2711
2712 Session session = null;
2713
2714 try {
2715 session = openSession();
2716
2717 Query q = session.createQuery(sql);
2718
2719 if (orderByComparator == null) {
2720 list = (List<SCProductEntry>)QueryUtil.list(q,
2721 getDialect(), start, end, false);
2722
2723 Collections.sort(list);
2724 }
2725 else {
2726 list = (List<SCProductEntry>)QueryUtil.list(q,
2727 getDialect(), start, end);
2728 }
2729 }
2730 catch (Exception e) {
2731 throw processException(e);
2732 }
2733 finally {
2734 if (list == null) {
2735 FinderCacheUtil.removeResult(finderPath, finderArgs);
2736 }
2737 else {
2738 cacheResult(list);
2739
2740 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2741 }
2742
2743 closeSession(session);
2744 }
2745 }
2746
2747 return list;
2748 }
2749
2750
2756 public void removeByGroupId(long groupId) throws SystemException {
2757 for (SCProductEntry scProductEntry : findByGroupId(groupId)) {
2758 remove(scProductEntry);
2759 }
2760 }
2761
2762
2768 public void removeByCompanyId(long companyId) throws SystemException {
2769 for (SCProductEntry scProductEntry : findByCompanyId(companyId)) {
2770 remove(scProductEntry);
2771 }
2772 }
2773
2774
2781 public void removeByG_U(long groupId, long userId)
2782 throws SystemException {
2783 for (SCProductEntry scProductEntry : findByG_U(groupId, userId)) {
2784 remove(scProductEntry);
2785 }
2786 }
2787
2788
2796 public SCProductEntry removeByRG_RA(String repoGroupId,
2797 String repoArtifactId)
2798 throws NoSuchProductEntryException, SystemException {
2799 SCProductEntry scProductEntry = findByRG_RA(repoGroupId, repoArtifactId);
2800
2801 return remove(scProductEntry);
2802 }
2803
2804
2809 public void removeAll() throws SystemException {
2810 for (SCProductEntry scProductEntry : findAll()) {
2811 remove(scProductEntry);
2812 }
2813 }
2814
2815
2822 public int countByGroupId(long groupId) throws SystemException {
2823 Object[] finderArgs = new Object[] { groupId };
2824
2825 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2826 finderArgs, this);
2827
2828 if (count == null) {
2829 StringBundler query = new StringBundler(2);
2830
2831 query.append(_SQL_COUNT_SCPRODUCTENTRY_WHERE);
2832
2833 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2834
2835 String sql = query.toString();
2836
2837 Session session = null;
2838
2839 try {
2840 session = openSession();
2841
2842 Query q = session.createQuery(sql);
2843
2844 QueryPos qPos = QueryPos.getInstance(q);
2845
2846 qPos.add(groupId);
2847
2848 count = (Long)q.uniqueResult();
2849 }
2850 catch (Exception e) {
2851 throw processException(e);
2852 }
2853 finally {
2854 if (count == null) {
2855 count = Long.valueOf(0);
2856 }
2857
2858 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2859 finderArgs, count);
2860
2861 closeSession(session);
2862 }
2863 }
2864
2865 return count.intValue();
2866 }
2867
2868
2875 public int filterCountByGroupId(long groupId) throws SystemException {
2876 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2877 return countByGroupId(groupId);
2878 }
2879
2880 StringBundler query = new StringBundler(2);
2881
2882 query.append(_FILTER_SQL_COUNT_SCPRODUCTENTRY_WHERE);
2883
2884 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2885
2886 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2887 SCProductEntry.class.getName(),
2888 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2889
2890 Session session = null;
2891
2892 try {
2893 session = openSession();
2894
2895 SQLQuery q = session.createSQLQuery(sql);
2896
2897 q.addScalar(COUNT_COLUMN_NAME,
2898 com.liferay.portal.kernel.dao.orm.Type.LONG);
2899
2900 QueryPos qPos = QueryPos.getInstance(q);
2901
2902 qPos.add(groupId);
2903
2904 Long count = (Long)q.uniqueResult();
2905
2906 return count.intValue();
2907 }
2908 catch (Exception e) {
2909 throw processException(e);
2910 }
2911 finally {
2912 closeSession(session);
2913 }
2914 }
2915
2916
2923 public int countByCompanyId(long companyId) throws SystemException {
2924 Object[] finderArgs = new Object[] { companyId };
2925
2926 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2927 finderArgs, this);
2928
2929 if (count == null) {
2930 StringBundler query = new StringBundler(2);
2931
2932 query.append(_SQL_COUNT_SCPRODUCTENTRY_WHERE);
2933
2934 query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
2935
2936 String sql = query.toString();
2937
2938 Session session = null;
2939
2940 try {
2941 session = openSession();
2942
2943 Query q = session.createQuery(sql);
2944
2945 QueryPos qPos = QueryPos.getInstance(q);
2946
2947 qPos.add(companyId);
2948
2949 count = (Long)q.uniqueResult();
2950 }
2951 catch (Exception e) {
2952 throw processException(e);
2953 }
2954 finally {
2955 if (count == null) {
2956 count = Long.valueOf(0);
2957 }
2958
2959 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2960 finderArgs, count);
2961
2962 closeSession(session);
2963 }
2964 }
2965
2966 return count.intValue();
2967 }
2968
2969
2977 public int countByG_U(long groupId, long userId) throws SystemException {
2978 Object[] finderArgs = new Object[] { groupId, userId };
2979
2980 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U,
2981 finderArgs, this);
2982
2983 if (count == null) {
2984 StringBundler query = new StringBundler(3);
2985
2986 query.append(_SQL_COUNT_SCPRODUCTENTRY_WHERE);
2987
2988 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
2989
2990 query.append(_FINDER_COLUMN_G_U_USERID_2);
2991
2992 String sql = query.toString();
2993
2994 Session session = null;
2995
2996 try {
2997 session = openSession();
2998
2999 Query q = session.createQuery(sql);
3000
3001 QueryPos qPos = QueryPos.getInstance(q);
3002
3003 qPos.add(groupId);
3004
3005 qPos.add(userId);
3006
3007 count = (Long)q.uniqueResult();
3008 }
3009 catch (Exception e) {
3010 throw processException(e);
3011 }
3012 finally {
3013 if (count == null) {
3014 count = Long.valueOf(0);
3015 }
3016
3017 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U, finderArgs,
3018 count);
3019
3020 closeSession(session);
3021 }
3022 }
3023
3024 return count.intValue();
3025 }
3026
3027
3035 public int filterCountByG_U(long groupId, long userId)
3036 throws SystemException {
3037 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3038 return countByG_U(groupId, userId);
3039 }
3040
3041 StringBundler query = new StringBundler(3);
3042
3043 query.append(_FILTER_SQL_COUNT_SCPRODUCTENTRY_WHERE);
3044
3045 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
3046
3047 query.append(_FINDER_COLUMN_G_U_USERID_2);
3048
3049 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3050 SCProductEntry.class.getName(),
3051 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
3052
3053 Session session = null;
3054
3055 try {
3056 session = openSession();
3057
3058 SQLQuery q = session.createSQLQuery(sql);
3059
3060 q.addScalar(COUNT_COLUMN_NAME,
3061 com.liferay.portal.kernel.dao.orm.Type.LONG);
3062
3063 QueryPos qPos = QueryPos.getInstance(q);
3064
3065 qPos.add(groupId);
3066
3067 qPos.add(userId);
3068
3069 Long count = (Long)q.uniqueResult();
3070
3071 return count.intValue();
3072 }
3073 catch (Exception e) {
3074 throw processException(e);
3075 }
3076 finally {
3077 closeSession(session);
3078 }
3079 }
3080
3081
3089 public int countByRG_RA(String repoGroupId, String repoArtifactId)
3090 throws SystemException {
3091 Object[] finderArgs = new Object[] { repoGroupId, repoArtifactId };
3092
3093 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_RG_RA,
3094 finderArgs, this);
3095
3096 if (count == null) {
3097 StringBundler query = new StringBundler(3);
3098
3099 query.append(_SQL_COUNT_SCPRODUCTENTRY_WHERE);
3100
3101 if (repoGroupId == null) {
3102 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_1);
3103 }
3104 else {
3105 if (repoGroupId.equals(StringPool.BLANK)) {
3106 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_3);
3107 }
3108 else {
3109 query.append(_FINDER_COLUMN_RG_RA_REPOGROUPID_2);
3110 }
3111 }
3112
3113 if (repoArtifactId == null) {
3114 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_1);
3115 }
3116 else {
3117 if (repoArtifactId.equals(StringPool.BLANK)) {
3118 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_3);
3119 }
3120 else {
3121 query.append(_FINDER_COLUMN_RG_RA_REPOARTIFACTID_2);
3122 }
3123 }
3124
3125 String sql = query.toString();
3126
3127 Session session = null;
3128
3129 try {
3130 session = openSession();
3131
3132 Query q = session.createQuery(sql);
3133
3134 QueryPos qPos = QueryPos.getInstance(q);
3135
3136 if (repoGroupId != null) {
3137 qPos.add(repoGroupId);
3138 }
3139
3140 if (repoArtifactId != null) {
3141 qPos.add(repoArtifactId);
3142 }
3143
3144 count = (Long)q.uniqueResult();
3145 }
3146 catch (Exception e) {
3147 throw processException(e);
3148 }
3149 finally {
3150 if (count == null) {
3151 count = Long.valueOf(0);
3152 }
3153
3154 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RG_RA,
3155 finderArgs, count);
3156
3157 closeSession(session);
3158 }
3159 }
3160
3161 return count.intValue();
3162 }
3163
3164
3170 public int countAll() throws SystemException {
3171 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3172 FINDER_ARGS_EMPTY, this);
3173
3174 if (count == null) {
3175 Session session = null;
3176
3177 try {
3178 session = openSession();
3179
3180 Query q = session.createQuery(_SQL_COUNT_SCPRODUCTENTRY);
3181
3182 count = (Long)q.uniqueResult();
3183 }
3184 catch (Exception e) {
3185 throw processException(e);
3186 }
3187 finally {
3188 if (count == null) {
3189 count = Long.valueOf(0);
3190 }
3191
3192 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3193 FINDER_ARGS_EMPTY, count);
3194
3195 closeSession(session);
3196 }
3197 }
3198
3199 return count.intValue();
3200 }
3201
3202
3209 public List<com.liferay.portlet.softwarecatalog.model.SCLicense> getSCLicenses(
3210 long pk) throws SystemException {
3211 return getSCLicenses(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
3212 }
3213
3214
3227 public List<com.liferay.portlet.softwarecatalog.model.SCLicense> getSCLicenses(
3228 long pk, int start, int end) throws SystemException {
3229 return getSCLicenses(pk, start, end, null);
3230 }
3231
3232 public static final FinderPath FINDER_PATH_GET_SCLICENSES = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
3233 SCProductEntryModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES,
3234 com.liferay.portlet.softwarecatalog.model.impl.SCLicenseImpl.class,
3235 SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME,
3236 "getSCLicenses",
3237 new String[] {
3238 Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
3239 "com.liferay.portal.kernel.util.OrderByComparator"
3240 });
3241
3242 static {
3243 FINDER_PATH_GET_SCLICENSES.setCacheKeyGeneratorCacheName(null);
3244 }
3245
3246
3260 public List<com.liferay.portlet.softwarecatalog.model.SCLicense> getSCLicenses(
3261 long pk, int start, int end, OrderByComparator orderByComparator)
3262 throws SystemException {
3263 Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };
3264
3265 List<com.liferay.portlet.softwarecatalog.model.SCLicense> list = (List<com.liferay.portlet.softwarecatalog.model.SCLicense>)FinderCacheUtil.getResult(FINDER_PATH_GET_SCLICENSES,
3266 finderArgs, this);
3267
3268 if (list == null) {
3269 Session session = null;
3270
3271 try {
3272 session = openSession();
3273
3274 String sql = null;
3275
3276 if (orderByComparator != null) {
3277 sql = _SQL_GETSCLICENSES.concat(ORDER_BY_CLAUSE)
3278 .concat(orderByComparator.getOrderBy());
3279 }
3280 else {
3281 sql = _SQL_GETSCLICENSES.concat(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ORDER_BY_SQL);
3282 }
3283
3284 SQLQuery q = session.createSQLQuery(sql);
3285
3286 q.addEntity("SCLicense",
3287 com.liferay.portlet.softwarecatalog.model.impl.SCLicenseImpl.class);
3288
3289 QueryPos qPos = QueryPos.getInstance(q);
3290
3291 qPos.add(pk);
3292
3293 list = (List<com.liferay.portlet.softwarecatalog.model.SCLicense>)QueryUtil.list(q,
3294 getDialect(), start, end);
3295 }
3296 catch (Exception e) {
3297 throw processException(e);
3298 }
3299 finally {
3300 if (list == null) {
3301 FinderCacheUtil.removeResult(FINDER_PATH_GET_SCLICENSES,
3302 finderArgs);
3303 }
3304 else {
3305 scLicensePersistence.cacheResult(list);
3306
3307 FinderCacheUtil.putResult(FINDER_PATH_GET_SCLICENSES,
3308 finderArgs, list);
3309 }
3310
3311 closeSession(session);
3312 }
3313 }
3314
3315 return list;
3316 }
3317
3318 public static final FinderPath FINDER_PATH_GET_SCLICENSES_SIZE = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
3319 SCProductEntryModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES,
3320 Long.class,
3321 SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME,
3322 "getSCLicensesSize", new String[] { Long.class.getName() });
3323
3324 static {
3325 FINDER_PATH_GET_SCLICENSES_SIZE.setCacheKeyGeneratorCacheName(null);
3326 }
3327
3328
3335 public int getSCLicensesSize(long pk) throws SystemException {
3336 Object[] finderArgs = new Object[] { pk };
3337
3338 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_SCLICENSES_SIZE,
3339 finderArgs, this);
3340
3341 if (count == null) {
3342 Session session = null;
3343
3344 try {
3345 session = openSession();
3346
3347 SQLQuery q = session.createSQLQuery(_SQL_GETSCLICENSESSIZE);
3348
3349 q.addScalar(COUNT_COLUMN_NAME,
3350 com.liferay.portal.kernel.dao.orm.Type.LONG);
3351
3352 QueryPos qPos = QueryPos.getInstance(q);
3353
3354 qPos.add(pk);
3355
3356 count = (Long)q.uniqueResult();
3357 }
3358 catch (Exception e) {
3359 throw processException(e);
3360 }
3361 finally {
3362 if (count == null) {
3363 count = Long.valueOf(0);
3364 }
3365
3366 FinderCacheUtil.putResult(FINDER_PATH_GET_SCLICENSES_SIZE,
3367 finderArgs, count);
3368
3369 closeSession(session);
3370 }
3371 }
3372
3373 return count.intValue();
3374 }
3375
3376 public static final FinderPath FINDER_PATH_CONTAINS_SCLICENSE = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
3377 SCProductEntryModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES,
3378 Boolean.class,
3379 SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME,
3380 "containsSCLicense",
3381 new String[] { Long.class.getName(), Long.class.getName() });
3382
3383
3391 public boolean containsSCLicense(long pk, long scLicensePK)
3392 throws SystemException {
3393 Object[] finderArgs = new Object[] { pk, scLicensePK };
3394
3395 Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_SCLICENSE,
3396 finderArgs, this);
3397
3398 if (value == null) {
3399 try {
3400 value = Boolean.valueOf(containsSCLicense.contains(pk,
3401 scLicensePK));
3402 }
3403 catch (Exception e) {
3404 throw processException(e);
3405 }
3406 finally {
3407 if (value == null) {
3408 value = Boolean.FALSE;
3409 }
3410
3411 FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_SCLICENSE,
3412 finderArgs, value);
3413 }
3414 }
3415
3416 return value.booleanValue();
3417 }
3418
3419
3426 public boolean containsSCLicenses(long pk) throws SystemException {
3427 if (getSCLicensesSize(pk) > 0) {
3428 return true;
3429 }
3430 else {
3431 return false;
3432 }
3433 }
3434
3435
3442 public void addSCLicense(long pk, long scLicensePK)
3443 throws SystemException {
3444 try {
3445 addSCLicense.add(pk, scLicensePK);
3446 }
3447 catch (Exception e) {
3448 throw processException(e);
3449 }
3450 finally {
3451 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3452 }
3453 }
3454
3455
3462 public void addSCLicense(long pk,
3463 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense)
3464 throws SystemException {
3465 try {
3466 addSCLicense.add(pk, scLicense.getPrimaryKey());
3467 }
3468 catch (Exception e) {
3469 throw processException(e);
3470 }
3471 finally {
3472 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3473 }
3474 }
3475
3476
3483 public void addSCLicenses(long pk, long[] scLicensePKs)
3484 throws SystemException {
3485 try {
3486 for (long scLicensePK : scLicensePKs) {
3487 addSCLicense.add(pk, scLicensePK);
3488 }
3489 }
3490 catch (Exception e) {
3491 throw processException(e);
3492 }
3493 finally {
3494 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3495 }
3496 }
3497
3498
3505 public void addSCLicenses(long pk,
3506 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses)
3507 throws SystemException {
3508 try {
3509 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3510 addSCLicense.add(pk, scLicense.getPrimaryKey());
3511 }
3512 }
3513 catch (Exception e) {
3514 throw processException(e);
3515 }
3516 finally {
3517 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3518 }
3519 }
3520
3521
3527 public void clearSCLicenses(long pk) throws SystemException {
3528 try {
3529 clearSCLicenses.clear(pk);
3530 }
3531 catch (Exception e) {
3532 throw processException(e);
3533 }
3534 finally {
3535 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3536 }
3537 }
3538
3539
3546 public void removeSCLicense(long pk, long scLicensePK)
3547 throws SystemException {
3548 try {
3549 removeSCLicense.remove(pk, scLicensePK);
3550 }
3551 catch (Exception e) {
3552 throw processException(e);
3553 }
3554 finally {
3555 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3556 }
3557 }
3558
3559
3566 public void removeSCLicense(long pk,
3567 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense)
3568 throws SystemException {
3569 try {
3570 removeSCLicense.remove(pk, scLicense.getPrimaryKey());
3571 }
3572 catch (Exception e) {
3573 throw processException(e);
3574 }
3575 finally {
3576 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3577 }
3578 }
3579
3580
3587 public void removeSCLicenses(long pk, long[] scLicensePKs)
3588 throws SystemException {
3589 try {
3590 for (long scLicensePK : scLicensePKs) {
3591 removeSCLicense.remove(pk, scLicensePK);
3592 }
3593 }
3594 catch (Exception e) {
3595 throw processException(e);
3596 }
3597 finally {
3598 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3599 }
3600 }
3601
3602
3609 public void removeSCLicenses(long pk,
3610 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses)
3611 throws SystemException {
3612 try {
3613 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3614 removeSCLicense.remove(pk, scLicense.getPrimaryKey());
3615 }
3616 }
3617 catch (Exception e) {
3618 throw processException(e);
3619 }
3620 finally {
3621 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3622 }
3623 }
3624
3625
3632 public void setSCLicenses(long pk, long[] scLicensePKs)
3633 throws SystemException {
3634 try {
3635 Set<Long> scLicensePKSet = SetUtil.fromArray(scLicensePKs);
3636
3637 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses =
3638 getSCLicenses(pk);
3639
3640 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3641 if (!scLicensePKSet.remove(scLicense.getPrimaryKey())) {
3642 removeSCLicense.remove(pk, scLicense.getPrimaryKey());
3643 }
3644 }
3645
3646 for (Long scLicensePK : scLicensePKSet) {
3647 addSCLicense.add(pk, scLicensePK);
3648 }
3649 }
3650 catch (Exception e) {
3651 throw processException(e);
3652 }
3653 finally {
3654 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3655 }
3656 }
3657
3658
3665 public void setSCLicenses(long pk,
3666 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses)
3667 throws SystemException {
3668 try {
3669 long[] scLicensePKs = new long[scLicenses.size()];
3670
3671 for (int i = 0; i < scLicenses.size(); i++) {
3672 com.liferay.portlet.softwarecatalog.model.SCLicense scLicense = scLicenses.get(i);
3673
3674 scLicensePKs[i] = scLicense.getPrimaryKey();
3675 }
3676
3677 setSCLicenses(pk, scLicensePKs);
3678 }
3679 catch (Exception e) {
3680 throw processException(e);
3681 }
3682 finally {
3683 FinderCacheUtil.clearCache(SCProductEntryModelImpl.MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME);
3684 }
3685 }
3686
3687
3690 public void afterPropertiesSet() {
3691 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3692 com.liferay.portal.util.PropsUtil.get(
3693 "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCProductEntry")));
3694
3695 if (listenerClassNames.length > 0) {
3696 try {
3697 List<ModelListener<SCProductEntry>> listenersList = new ArrayList<ModelListener<SCProductEntry>>();
3698
3699 for (String listenerClassName : listenerClassNames) {
3700 listenersList.add((ModelListener<SCProductEntry>)InstanceFactory.newInstance(
3701 listenerClassName));
3702 }
3703
3704 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3705 }
3706 catch (Exception e) {
3707 _log.error(e);
3708 }
3709 }
3710
3711 containsSCLicense = new ContainsSCLicense();
3712
3713 addSCLicense = new AddSCLicense();
3714 clearSCLicenses = new ClearSCLicenses();
3715 removeSCLicense = new RemoveSCLicense();
3716 }
3717
3718 public void destroy() {
3719 EntityCacheUtil.removeCache(SCProductEntryImpl.class.getName());
3720 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3721 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3722 }
3723
3724 @BeanReference(type = SCFrameworkVersionPersistence.class)
3725 protected SCFrameworkVersionPersistence scFrameworkVersionPersistence;
3726 @BeanReference(type = SCLicensePersistence.class)
3727 protected SCLicensePersistence scLicensePersistence;
3728 @BeanReference(type = SCProductEntryPersistence.class)
3729 protected SCProductEntryPersistence scProductEntryPersistence;
3730 @BeanReference(type = SCProductScreenshotPersistence.class)
3731 protected SCProductScreenshotPersistence scProductScreenshotPersistence;
3732 @BeanReference(type = SCProductVersionPersistence.class)
3733 protected SCProductVersionPersistence scProductVersionPersistence;
3734 @BeanReference(type = GroupPersistence.class)
3735 protected GroupPersistence groupPersistence;
3736 @BeanReference(type = ImagePersistence.class)
3737 protected ImagePersistence imagePersistence;
3738 @BeanReference(type = ResourcePersistence.class)
3739 protected ResourcePersistence resourcePersistence;
3740 @BeanReference(type = SubscriptionPersistence.class)
3741 protected SubscriptionPersistence subscriptionPersistence;
3742 @BeanReference(type = UserPersistence.class)
3743 protected UserPersistence userPersistence;
3744 @BeanReference(type = MBMessagePersistence.class)
3745 protected MBMessagePersistence mbMessagePersistence;
3746 @BeanReference(type = RatingsStatsPersistence.class)
3747 protected RatingsStatsPersistence ratingsStatsPersistence;
3748 protected ContainsSCLicense containsSCLicense;
3749 protected AddSCLicense addSCLicense;
3750 protected ClearSCLicenses clearSCLicenses;
3751 protected RemoveSCLicense removeSCLicense;
3752
3753 protected class ContainsSCLicense {
3754 protected ContainsSCLicense() {
3755 _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
3756 _SQL_CONTAINSSCLICENSE,
3757 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
3758 RowMapper.COUNT);
3759 }
3760
3761 protected boolean contains(long productEntryId, long licenseId) {
3762 List<Integer> results = _mappingSqlQuery.execute(new Object[] {
3763 new Long(productEntryId), new Long(licenseId)
3764 });
3765
3766 if (results.size() > 0) {
3767 Integer count = results.get(0);
3768
3769 if (count.intValue() > 0) {
3770 return true;
3771 }
3772 }
3773
3774 return false;
3775 }
3776
3777 private MappingSqlQuery<Integer> _mappingSqlQuery;
3778 }
3779
3780 protected class AddSCLicense {
3781 protected AddSCLicense() {
3782 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
3783 "INSERT INTO SCLicenses_SCProductEntries (productEntryId, licenseId) VALUES (?, ?)",
3784 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
3785 }
3786
3787 protected void add(long productEntryId, long licenseId)
3788 throws SystemException {
3789 if (!containsSCLicense.contains(productEntryId, licenseId)) {
3790 ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense>[] scLicenseListeners =
3791 scLicensePersistence.getListeners();
3792
3793 for (ModelListener<SCProductEntry> listener : listeners) {
3794 listener.onBeforeAddAssociation(productEntryId,
3795 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3796 licenseId);
3797 }
3798
3799 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3800 listener.onBeforeAddAssociation(licenseId,
3801 SCProductEntry.class.getName(), productEntryId);
3802 }
3803
3804 _sqlUpdate.update(new Object[] {
3805 new Long(productEntryId), new Long(licenseId)
3806 });
3807
3808 for (ModelListener<SCProductEntry> listener : listeners) {
3809 listener.onAfterAddAssociation(productEntryId,
3810 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3811 licenseId);
3812 }
3813
3814 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3815 listener.onAfterAddAssociation(licenseId,
3816 SCProductEntry.class.getName(), productEntryId);
3817 }
3818 }
3819 }
3820
3821 private SqlUpdate _sqlUpdate;
3822 }
3823
3824 protected class ClearSCLicenses {
3825 protected ClearSCLicenses() {
3826 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
3827 "DELETE FROM SCLicenses_SCProductEntries WHERE productEntryId = ?",
3828 new int[] { java.sql.Types.BIGINT });
3829 }
3830
3831 protected void clear(long productEntryId) throws SystemException {
3832 ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense>[] scLicenseListeners =
3833 scLicensePersistence.getListeners();
3834
3835 List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses =
3836 null;
3837
3838 if ((listeners.length > 0) || (scLicenseListeners.length > 0)) {
3839 scLicenses = getSCLicenses(productEntryId);
3840
3841 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3842 for (ModelListener<SCProductEntry> listener : listeners) {
3843 listener.onBeforeRemoveAssociation(productEntryId,
3844 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3845 scLicense.getPrimaryKey());
3846 }
3847
3848 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3849 listener.onBeforeRemoveAssociation(scLicense.getPrimaryKey(),
3850 SCProductEntry.class.getName(), productEntryId);
3851 }
3852 }
3853 }
3854
3855 _sqlUpdate.update(new Object[] { new Long(productEntryId) });
3856
3857 if ((listeners.length > 0) || (scLicenseListeners.length > 0)) {
3858 for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
3859 for (ModelListener<SCProductEntry> listener : listeners) {
3860 listener.onAfterRemoveAssociation(productEntryId,
3861 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3862 scLicense.getPrimaryKey());
3863 }
3864
3865 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3866 listener.onAfterRemoveAssociation(scLicense.getPrimaryKey(),
3867 SCProductEntry.class.getName(), productEntryId);
3868 }
3869 }
3870 }
3871 }
3872
3873 private SqlUpdate _sqlUpdate;
3874 }
3875
3876 protected class RemoveSCLicense {
3877 protected RemoveSCLicense() {
3878 _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
3879 "DELETE FROM SCLicenses_SCProductEntries WHERE productEntryId = ? AND licenseId = ?",
3880 new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
3881 }
3882
3883 protected void remove(long productEntryId, long licenseId)
3884 throws SystemException {
3885 if (containsSCLicense.contains(productEntryId, licenseId)) {
3886 ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense>[] scLicenseListeners =
3887 scLicensePersistence.getListeners();
3888
3889 for (ModelListener<SCProductEntry> listener : listeners) {
3890 listener.onBeforeRemoveAssociation(productEntryId,
3891 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3892 licenseId);
3893 }
3894
3895 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3896 listener.onBeforeRemoveAssociation(licenseId,
3897 SCProductEntry.class.getName(), productEntryId);
3898 }
3899
3900 _sqlUpdate.update(new Object[] {
3901 new Long(productEntryId), new Long(licenseId)
3902 });
3903
3904 for (ModelListener<SCProductEntry> listener : listeners) {
3905 listener.onAfterRemoveAssociation(productEntryId,
3906 com.liferay.portlet.softwarecatalog.model.SCLicense.class.getName(),
3907 licenseId);
3908 }
3909
3910 for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCLicense> listener : scLicenseListeners) {
3911 listener.onAfterRemoveAssociation(licenseId,
3912 SCProductEntry.class.getName(), productEntryId);
3913 }
3914 }
3915 }
3916
3917 private SqlUpdate _sqlUpdate;
3918 }
3919
3920 private static final String _SQL_SELECT_SCPRODUCTENTRY = "SELECT scProductEntry FROM SCProductEntry scProductEntry";
3921 private static final String _SQL_SELECT_SCPRODUCTENTRY_WHERE = "SELECT scProductEntry FROM SCProductEntry scProductEntry WHERE ";
3922 private static final String _SQL_COUNT_SCPRODUCTENTRY = "SELECT COUNT(scProductEntry) FROM SCProductEntry scProductEntry";
3923 private static final String _SQL_COUNT_SCPRODUCTENTRY_WHERE = "SELECT COUNT(scProductEntry) FROM SCProductEntry scProductEntry WHERE ";
3924 private static final String _SQL_GETSCLICENSES = "SELECT {SCLicense.*} FROM SCLicense INNER JOIN SCLicenses_SCProductEntries ON (SCLicenses_SCProductEntries.licenseId = SCLicense.licenseId) WHERE (SCLicenses_SCProductEntries.productEntryId = ?)";
3925 private static final String _SQL_GETSCLICENSESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCLicenses_SCProductEntries WHERE productEntryId = ?";
3926 private static final String _SQL_CONTAINSSCLICENSE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCLicenses_SCProductEntries WHERE productEntryId = ? AND licenseId = ?";
3927 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "scProductEntry.groupId = ?";
3928 private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "scProductEntry.companyId = ?";
3929 private static final String _FINDER_COLUMN_G_U_GROUPID_2 = "scProductEntry.groupId = ? AND ";
3930 private static final String _FINDER_COLUMN_G_U_USERID_2 = "scProductEntry.userId = ?";
3931 private static final String _FINDER_COLUMN_RG_RA_REPOGROUPID_1 = "scProductEntry.repoGroupId IS NULL AND ";
3932 private static final String _FINDER_COLUMN_RG_RA_REPOGROUPID_2 = "lower(scProductEntry.repoGroupId) = lower(CAST_TEXT(?)) AND ";
3933 private static final String _FINDER_COLUMN_RG_RA_REPOGROUPID_3 = "(scProductEntry.repoGroupId IS NULL OR lower(scProductEntry.repoGroupId) = lower(CAST_TEXT(?))) AND ";
3934 private static final String _FINDER_COLUMN_RG_RA_REPOARTIFACTID_1 = "scProductEntry.repoArtifactId IS NULL";
3935 private static final String _FINDER_COLUMN_RG_RA_REPOARTIFACTID_2 = "lower(scProductEntry.repoArtifactId) = lower(CAST_TEXT(?))";
3936 private static final String _FINDER_COLUMN_RG_RA_REPOARTIFACTID_3 = "(scProductEntry.repoArtifactId IS NULL OR lower(scProductEntry.repoArtifactId) = lower(CAST_TEXT(?)))";
3937 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "scProductEntry.productEntryId";
3938 private static final String _FILTER_SQL_SELECT_SCPRODUCTENTRY_WHERE = "SELECT DISTINCT {scProductEntry.*} FROM SCProductEntry scProductEntry WHERE ";
3939 private static final String _FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_1 =
3940 "SELECT {SCProductEntry.*} FROM (SELECT DISTINCT scProductEntry.productEntryId FROM SCProductEntry scProductEntry WHERE ";
3941 private static final String _FILTER_SQL_SELECT_SCPRODUCTENTRY_NO_INLINE_DISTINCT_WHERE_2 =
3942 ") TEMP_TABLE INNER JOIN SCProductEntry ON TEMP_TABLE.productEntryId = SCProductEntry.productEntryId";
3943 private static final String _FILTER_SQL_COUNT_SCPRODUCTENTRY_WHERE = "SELECT COUNT(DISTINCT scProductEntry.productEntryId) AS COUNT_VALUE FROM SCProductEntry scProductEntry WHERE ";
3944 private static final String _FILTER_ENTITY_ALIAS = "scProductEntry";
3945 private static final String _FILTER_ENTITY_TABLE = "SCProductEntry";
3946 private static final String _ORDER_BY_ENTITY_ALIAS = "scProductEntry.";
3947 private static final String _ORDER_BY_ENTITY_TABLE = "SCProductEntry.";
3948 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SCProductEntry exists with the primary key ";
3949 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SCProductEntry exists with the key {";
3950 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3951 private static Log _log = LogFactoryUtil.getLog(SCProductEntryPersistenceImpl.class);
3952 private static SCProductEntry _nullSCProductEntry = new SCProductEntryImpl() {
3953 @Override
3954 public Object clone() {
3955 return this;
3956 }
3957
3958 @Override
3959 public CacheModel<SCProductEntry> toCacheModel() {
3960 return _nullSCProductEntryCacheModel;
3961 }
3962 };
3963
3964 private static CacheModel<SCProductEntry> _nullSCProductEntryCacheModel = new CacheModel<SCProductEntry>() {
3965 public SCProductEntry toEntityModel() {
3966 return _nullSCProductEntry;
3967 }
3968 };
3969 }