+ @Transactional(readOnly = true)
+ public Pager<Registration> page(Optional<Reference> reference, Collection<RegistrationStatus> includedStatus,
+ Integer pageSize, Integer pageIndex, List<String> propertyPaths) {
+
+ if( !userHelper.userIsAutheticated() || userHelper.userIsAnnonymous() ) {
+ includedStatus = Arrays.asList(RegistrationStatus.PUBLISHED);
+ }
+
+ long numberOfResults = dao.count(reference, includedStatus);
+
+ List<Registration> results = new ArrayList<>();
+ Integer [] limitStart = AbstractPagerImpl.limitStartforRange(numberOfResults, pageIndex, pageSize);
+ if(limitStart != null) {
+ results = dao.list(reference, includedStatus, limitStart[0], limitStart[1], propertyPaths);
+ }
+
+ return new DefaultPagerImpl<>(pageIndex, numberOfResults, pageSize, results);
+ }
+
+
+
+ @Override
+ @Transactional(readOnly = true)
+ public Pager<Registration> page(UUID submitterUuid, Collection<RegistrationStatus> includedStatus,
+ String identifierFilterPattern, String taxonNameFilterPattern, String referenceFilterPattern,
+ Collection<UUID> typeDesignationStatusUuids, Integer pageSize, Integer pageIndex, List<OrderHint> orderHints, List<String> propertyPaths) {
+
+ if( !userHelper.userIsAutheticated() || userHelper.userIsAnnonymous() ) {
+ includedStatus = Arrays.asList(RegistrationStatus.PUBLISHED);
+ }
+
+ //Logger.getLogger("org.hibernate.SQL").setLevel(Level.DEBUG);
+ long numberOfResults = dao.count(submitterUuid, includedStatus, identifierFilterPattern, taxonNameFilterPattern, referenceFilterPattern, typeDesignationStatusUuids);
+ //Logger.getLogger("org.hibernate.SQL").setLevel(Level.WARN);
+
+ List<Registration> results = new ArrayList<>();
+ if(pageIndex == null){
+ pageIndex = 0;
+ }
+ Integer [] limitStart = AbstractPagerImpl.limitStartforRange(numberOfResults, pageIndex, pageSize);
+ if(limitStart != null) {
+ results = dao.list(submitterUuid, includedStatus, identifierFilterPattern, taxonNameFilterPattern, referenceFilterPattern, typeDesignationStatusUuids,
+ limitStart[0], limitStart[1], orderHints, propertyPaths);
+ }
+
+ return new DefaultPagerImpl<>(pageIndex, numberOfResults, pageSize, results);
+ }
+
+ @Override
+ @Transactional(readOnly = true)
+ public Pager<Registration> pageTaxomicInclusion(UUID submitterUuid, Collection<RegistrationStatus> includedStatus,
+ String taxonNameFilterPattern, MatchMode matchMode,
+ Integer pageSize, Integer pageIndex, List<OrderHint> orderHints, List<String> propertyPaths) {
+
+ List<TaxonName> includedNames = taxonGraphService.listIncludedNames(taxonNameFilterPattern, matchMode);
+ Set<UUID> includedNamesUuids = includedNames.stream().map(TaxonName::getUuid).collect(Collectors.toSet());
+
+ if(includedNames.size() > 0){
+ return page(submitterUuid, includedStatus, includedNamesUuids, pageSize, pageIndex, orderHints, propertyPaths);
+ } else {
+ return new DefaultPagerImpl<>(pageIndex, 0l, pageSize, new ArrayList<Registration>());
+ }
+ }
+
+ @Override
+ @Transactional(readOnly = true)
+ public Pager<Registration> page(UUID submitterUuid, Collection<RegistrationStatus> includedStatus,
+ Collection<UUID> taxonNameUUIDs,
+ Integer pageSize, Integer pageIndex, List<OrderHint> orderHints, List<String> propertyPaths) {
+
+ if( !userHelper.userIsAutheticated() || userHelper.userIsAnnonymous() ) {
+ includedStatus = Arrays.asList(RegistrationStatus.PUBLISHED);
+ }
+
+ long numberOfResults = dao.count(submitterUuid, includedStatus, taxonNameUUIDs);
+
+ List<Registration> results = new ArrayList<>();
+ if(pageIndex == null){
+ pageIndex = 0;
+ }
+ Integer [] limitStart = AbstractPagerImpl.limitStartforRange(numberOfResults, pageIndex, pageSize);
+ if(limitStart != null) {
+ results = dao.list(submitterUuid, includedStatus, taxonNameUUIDs, limitStart[0], limitStart[1], orderHints, propertyPaths);
+ }
+
+ return new DefaultPagerImpl<>(pageIndex, numberOfResults, pageSize, results);
+ }
+
+ /**
+ * @param identifier
+ * @param validateUniqueness
+ * @param response
+ * @return
+ * @throws IOException
+ */
+ @Override
+ @Transactional(readOnly = true)
+ public Pager<Registration> pageByIdentifier(String identifier, Integer pageIndex, Integer pageSize, List<String> propertyPaths) throws IOException {