@Test public void testOrderByNavigationCountDefault() throws ODataException { cut = new JPAOrderByBuilder(jpaOrgEntity, orgTarget, cb, groups); final List<UriResource> pathParts = createOrderByClause(null); final UriResourceNavigation navigationPart = mock(UriResourceNavigation.class); final UriResourceCount countPart = mock(UriResourceCount.class); final EdmNavigationProperty navigationProperty = mock(EdmNavigationProperty.class); pathParts.add(navigationPart); pathParts.add(countPart); when(navigationPart.getProperty()).thenReturn(navigationProperty); when(navigationProperty.getName()).thenReturn("Roles"); joinTables.put("Roles", cb.createQuery().from(getHelper().getEntityType(BusinessPartnerRole.class))); final List<Order> act = cut.createOrderByList(joinTables, uriResource); assertEquals(1, act.size()); assertTrue(act.get(0).isAscending()); assertEquals("COUNT", ((FunctionExpressionImpl<?>) act.get(0).getExpression()).getOperation()); }
@Nonnull List<Order> createOrderByList(@Nonnull final Map<String, From<?, ?>> joinTables, @Nonnull final UriInfoResource uriResource) throws ODataApplicationException { final List<Order> result = new ArrayList<>(); try { if (uriResource.getOrderByOption() != null) { addOrderByFromUriResource(joinTables, result, uriResource.getOrderByOption()); } if (uriResource.getTopOption() != null || uriResource.getSkipOption() != null) { addOrderByPrimaryKey(result); } } catch (final ODataJPAModelException e) { throw new ODataJPAQueryException(e, BAD_REQUEST); } return result; }
JPAOrderByBuilder { @Nonnull List<Order> createOrderByList(@Nonnull final Map<String, From<?, ?>> joinTables, @Nonnull final UriInfoResource uriResource) throws ODataApplicationException { final List<Order> result = new ArrayList<>(); try { if (uriResource.getOrderByOption() != null) { addOrderByFromUriResource(joinTables, result, uriResource.getOrderByOption()); } if (uriResource.getTopOption() != null || uriResource.getSkipOption() != null) { addOrderByPrimaryKey(result); } } catch (final ODataJPAModelException e) { throw new ODataJPAQueryException(e, BAD_REQUEST); } return result; } }
JPAOrderByBuilder { @Nonnull List<Order> createOrderByList(@Nonnull final Map<String, From<?, ?>> joinTables, @Nonnull final UriInfoResource uriResource) throws ODataApplicationException { final List<Order> result = new ArrayList<>(); try { if (uriResource.getOrderByOption() != null) { addOrderByFromUriResource(joinTables, result, uriResource.getOrderByOption()); } if (uriResource.getTopOption() != null || uriResource.getSkipOption() != null) { addOrderByPrimaryKey(result); } } catch (final ODataJPAModelException e) { throw new ODataJPAQueryException(e, BAD_REQUEST); } return result; } JPAOrderByBuilder(final JPAEntityType jpaEntity, final From<?, ?> target, final CriteriaBuilder cb,
      final List<String> groups); }
JPAOrderByBuilder { @Nonnull List<Order> createOrderByList(@Nonnull final Map<String, From<?, ?>> joinTables, @Nonnull final UriInfoResource uriResource) throws ODataApplicationException { final List<Order> result = new ArrayList<>(); try { if (uriResource.getOrderByOption() != null) { addOrderByFromUriResource(joinTables, result, uriResource.getOrderByOption()); } if (uriResource.getTopOption() != null || uriResource.getSkipOption() != null) { addOrderByPrimaryKey(result); } } catch (final ODataJPAModelException e) { throw new ODataJPAQueryException(e, BAD_REQUEST); } return result; } JPAOrderByBuilder(final JPAEntityType jpaEntity, final From<?, ?> target, final CriteriaBuilder cb,
      final List<String> groups);  }
JPAOrderByBuilder { @Nonnull List<Order> createOrderByList(@Nonnull final Map<String, From<?, ?>> joinTables, @Nonnull final UriInfoResource uriResource) throws ODataApplicationException { final List<Order> result = new ArrayList<>(); try { if (uriResource.getOrderByOption() != null) { addOrderByFromUriResource(joinTables, result, uriResource.getOrderByOption()); } if (uriResource.getTopOption() != null || uriResource.getSkipOption() != null) { addOrderByPrimaryKey(result); } } catch (final ODataJPAModelException e) { throw new ODataJPAQueryException(e, BAD_REQUEST); } return result; } JPAOrderByBuilder(final JPAEntityType jpaEntity, final From<?, ?> target, final CriteriaBuilder cb,
      final List<String> groups);   }