@Test public void checkGetKeyBoundaryEmptyBoundaryNoTopOrSkip() throws ODataJPAModelException, ODataJPAQueryException { cut = new JPAExpandQueryResult(queryResult, null, helper.getJPAEntityType("Organizations"), Collections.emptyList()); final Optional<JPAKeyBoundary> act = cut.getKeyBoundary(requestContext, hops); assertFalse(act.isPresent()); }
@Override public Optional<JPAKeyBoundary> getKeyBoundary(final JPAODataRequestContextAccess requestContext, final List<JPANavigationProptertyInfo> hops) throws ODataJPAQueryException { try { if (!jpaResult.get(ROOT_RESULT_KEY).isEmpty() && (requestContext.getUriInfo().getExpandOption() != null || collectionPropertyRequested(requestContext)) && (requestContext.getUriInfo().getTopOption() != null || requestContext.getUriInfo().getSkipOption() != null)) { final JPAKeyPair boundary = new JPAKeyPair(jpaEntityType.getKey()); for (final Tuple tuple : jpaResult.get(ROOT_RESULT_KEY)) { Map<JPAAttribute, Comparable> key = createKey(tuple); boundary.setValue(key); } return Optional.of(new JPAKeyBoundary(hops.size(), boundary)); } } catch (ODataJPAModelException e) { throw new ODataJPAQueryException(e, HttpStatusCode.INTERNAL_SERVER_ERROR); } return JPAConvertableResult.super.getKeyBoundary(requestContext, hops); }
JPAExpandQueryResult implements JPAExpandResult, JPAConvertableResult { @Override public Optional<JPAKeyBoundary> getKeyBoundary(final JPAODataRequestContextAccess requestContext, final List<JPANavigationProptertyInfo> hops) throws ODataJPAQueryException { try { if (!jpaResult.get(ROOT_RESULT_KEY).isEmpty() && (requestContext.getUriInfo().getExpandOption() != null || collectionPropertyRequested(requestContext)) && (requestContext.getUriInfo().getTopOption() != null || requestContext.getUriInfo().getSkipOption() != null)) { final JPAKeyPair boundary = new JPAKeyPair(jpaEntityType.getKey()); for (final Tuple tuple : jpaResult.get(ROOT_RESULT_KEY)) { Map<JPAAttribute, Comparable> key = createKey(tuple); boundary.setValue(key); } return Optional.of(new JPAKeyBoundary(hops.size(), boundary)); } } catch (ODataJPAModelException e) { throw new ODataJPAQueryException(e, HttpStatusCode.INTERNAL_SERVER_ERROR); } return JPAConvertableResult.super.getKeyBoundary(requestContext, hops); } }
JPAExpandQueryResult implements JPAExpandResult, JPAConvertableResult { @Override public Optional<JPAKeyBoundary> getKeyBoundary(final JPAODataRequestContextAccess requestContext, final List<JPANavigationProptertyInfo> hops) throws ODataJPAQueryException { try { if (!jpaResult.get(ROOT_RESULT_KEY).isEmpty() && (requestContext.getUriInfo().getExpandOption() != null || collectionPropertyRequested(requestContext)) && (requestContext.getUriInfo().getTopOption() != null || requestContext.getUriInfo().getSkipOption() != null)) { final JPAKeyPair boundary = new JPAKeyPair(jpaEntityType.getKey()); for (final Tuple tuple : jpaResult.get(ROOT_RESULT_KEY)) { Map<JPAAttribute, Comparable> key = createKey(tuple); boundary.setValue(key); } return Optional.of(new JPAKeyBoundary(hops.size(), boundary)); } } catch (ODataJPAModelException e) { throw new ODataJPAQueryException(e, HttpStatusCode.INTERNAL_SERVER_ERROR); } return JPAConvertableResult.super.getKeyBoundary(requestContext, hops); } JPAExpandQueryResult(final JPAEntityType jpaEntityType, final Collection<JPAPath> selectionPath);  JPAExpandQueryResult(final Map<String, List<Tuple>> result, final Map<String, Long> counts,
      @Nonnull final JPAEntityType jpaEntityType, final Collection<JPAPath> selectionPath); }
JPAExpandQueryResult implements JPAExpandResult, JPAConvertableResult { @Override public Optional<JPAKeyBoundary> getKeyBoundary(final JPAODataRequestContextAccess requestContext, final List<JPANavigationProptertyInfo> hops) throws ODataJPAQueryException { try { if (!jpaResult.get(ROOT_RESULT_KEY).isEmpty() && (requestContext.getUriInfo().getExpandOption() != null || collectionPropertyRequested(requestContext)) && (requestContext.getUriInfo().getTopOption() != null || requestContext.getUriInfo().getSkipOption() != null)) { final JPAKeyPair boundary = new JPAKeyPair(jpaEntityType.getKey()); for (final Tuple tuple : jpaResult.get(ROOT_RESULT_KEY)) { Map<JPAAttribute, Comparable> key = createKey(tuple); boundary.setValue(key); } return Optional.of(new JPAKeyBoundary(hops.size(), boundary)); } } catch (ODataJPAModelException e) { throw new ODataJPAQueryException(e, HttpStatusCode.INTERNAL_SERVER_ERROR); } return JPAConvertableResult.super.getKeyBoundary(requestContext, hops); } JPAExpandQueryResult(final JPAEntityType jpaEntityType, final Collection<JPAPath> selectionPath);  JPAExpandQueryResult(final Map<String, List<Tuple>> result, final Map<String, Long> counts,
      @Nonnull final JPAEntityType jpaEntityType, final Collection<JPAPath> selectionPath); @Override Map<String, EntityCollection> asEntityCollection(final JPATupleChildConverter converter); @Override void convert(final JPATupleChildConverter converter); @Override JPAExpandResult getChild(JPAAssociationPath associationPath); @Override Map<JPAAssociationPath, JPAExpandResult> getChildren(); @Override Long getCount(final String key); @Override JPAEntityType getEntityType(); long getNoResults(); long getNoResultsDeep(); @Override List<Tuple> getResult(final String key); @Override boolean hasCount(); @Override void putChildren(final Map<JPAAssociationPath, JPAExpandResult> childResults); @Override Map<String, List<Tuple>> getResults(); @Override EntityCollection getEntityCollection(final String key); @Override Optional<JPAKeyBoundary> getKeyBoundary(final JPAODataRequestContextAccess requestContext,
      final List<JPANavigationProptertyInfo> hops); }
JPAExpandQueryResult implements JPAExpandResult, JPAConvertableResult { @Override public Optional<JPAKeyBoundary> getKeyBoundary(final JPAODataRequestContextAccess requestContext, final List<JPANavigationProptertyInfo> hops) throws ODataJPAQueryException { try { if (!jpaResult.get(ROOT_RESULT_KEY).isEmpty() && (requestContext.getUriInfo().getExpandOption() != null || collectionPropertyRequested(requestContext)) && (requestContext.getUriInfo().getTopOption() != null || requestContext.getUriInfo().getSkipOption() != null)) { final JPAKeyPair boundary = new JPAKeyPair(jpaEntityType.getKey()); for (final Tuple tuple : jpaResult.get(ROOT_RESULT_KEY)) { Map<JPAAttribute, Comparable> key = createKey(tuple); boundary.setValue(key); } return Optional.of(new JPAKeyBoundary(hops.size(), boundary)); } } catch (ODataJPAModelException e) { throw new ODataJPAQueryException(e, HttpStatusCode.INTERNAL_SERVER_ERROR); } return JPAConvertableResult.super.getKeyBoundary(requestContext, hops); } JPAExpandQueryResult(final JPAEntityType jpaEntityType, final Collection<JPAPath> selectionPath);  JPAExpandQueryResult(final Map<String, List<Tuple>> result, final Map<String, Long> counts,
      @Nonnull final JPAEntityType jpaEntityType, final Collection<JPAPath> selectionPath); @Override Map<String, EntityCollection> asEntityCollection(final JPATupleChildConverter converter); @Override void convert(final JPATupleChildConverter converter); @Override JPAExpandResult getChild(JPAAssociationPath associationPath); @Override Map<JPAAssociationPath, JPAExpandResult> getChildren(); @Override Long getCount(final String key); @Override JPAEntityType getEntityType(); long getNoResults(); long getNoResultsDeep(); @Override List<Tuple> getResult(final String key); @Override boolean hasCount(); @Override void putChildren(final Map<JPAAssociationPath, JPAExpandResult> childResults); @Override Map<String, List<Tuple>> getResults(); @Override EntityCollection getEntityCollection(final String key); @Override Optional<JPAKeyBoundary> getKeyBoundary(final JPAODataRequestContextAccess requestContext,
      final List<JPANavigationProptertyInfo> hops);  }