@Test public void determineGetEntityTest() { try { assertEquals(JPQLContextType.JOIN_SINGLE, builder.determineJPQLContextType(mockURIInfoWithListener(true), UriInfoType.GetEntity)); } catch (ODataException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } }
public JPQLContextType determineJPQLContextType(UriInfo uriParserResultView, UriInfoType type) { JPQLContextType contextType = null; if (uriParserResultView.getNavigationSegments() != null && !uriParserResultView.getNavigationSegments().isEmpty()) { if (type == UriInfoType.GetEntitySet) { contextType = JPQLContextType.JOIN; } else if (type == UriInfoType.Delete || type == UriInfoType.GetEntity || type == UriInfoType.PutMergePatch) { contextType = JPQLContextType.JOIN_SINGLE; } else if (type == UriInfoType.GetEntitySetCount || type == UriInfoType.GetEntityCount) { contextType = JPQLContextType.JOIN_COUNT; } } else { if (type == UriInfoType.GetEntitySet) { contextType = JPQLContextType.SELECT; } else if (type == UriInfoType.Delete || type == UriInfoType.GetEntity || type == UriInfoType.PutMergePatch) { contextType = JPQLContextType.SELECT_SINGLE; } else if (type == UriInfoType.GetEntitySetCount || type == UriInfoType.GetEntityCount) { contextType = JPQLContextType.SELECT_COUNT; } } return contextType; }
JPAQueryBuilder { public JPQLContextType determineJPQLContextType(UriInfo uriParserResultView, UriInfoType type) { JPQLContextType contextType = null; if (uriParserResultView.getNavigationSegments() != null && !uriParserResultView.getNavigationSegments().isEmpty()) { if (type == UriInfoType.GetEntitySet) { contextType = JPQLContextType.JOIN; } else if (type == UriInfoType.Delete || type == UriInfoType.GetEntity || type == UriInfoType.PutMergePatch) { contextType = JPQLContextType.JOIN_SINGLE; } else if (type == UriInfoType.GetEntitySetCount || type == UriInfoType.GetEntityCount) { contextType = JPQLContextType.JOIN_COUNT; } } else { if (type == UriInfoType.GetEntitySet) { contextType = JPQLContextType.SELECT; } else if (type == UriInfoType.Delete || type == UriInfoType.GetEntity || type == UriInfoType.PutMergePatch) { contextType = JPQLContextType.SELECT_SINGLE; } else if (type == UriInfoType.GetEntitySetCount || type == UriInfoType.GetEntityCount) { contextType = JPQLContextType.SELECT_COUNT; } } return contextType; } }
JPAQueryBuilder { public JPQLContextType determineJPQLContextType(UriInfo uriParserResultView, UriInfoType type) { JPQLContextType contextType = null; if (uriParserResultView.getNavigationSegments() != null && !uriParserResultView.getNavigationSegments().isEmpty()) { if (type == UriInfoType.GetEntitySet) { contextType = JPQLContextType.JOIN; } else if (type == UriInfoType.Delete || type == UriInfoType.GetEntity || type == UriInfoType.PutMergePatch) { contextType = JPQLContextType.JOIN_SINGLE; } else if (type == UriInfoType.GetEntitySetCount || type == UriInfoType.GetEntityCount) { contextType = JPQLContextType.JOIN_COUNT; } } else { if (type == UriInfoType.GetEntitySet) { contextType = JPQLContextType.SELECT; } else if (type == UriInfoType.Delete || type == UriInfoType.GetEntity || type == UriInfoType.PutMergePatch) { contextType = JPQLContextType.SELECT_SINGLE; } else if (type == UriInfoType.GetEntitySetCount || type == UriInfoType.GetEntityCount) { contextType = JPQLContextType.SELECT_COUNT; } } return contextType; } JPAQueryBuilder(ODataJPAContext odataJPAContext); }
JPAQueryBuilder { public JPQLContextType determineJPQLContextType(UriInfo uriParserResultView, UriInfoType type) { JPQLContextType contextType = null; if (uriParserResultView.getNavigationSegments() != null && !uriParserResultView.getNavigationSegments().isEmpty()) { if (type == UriInfoType.GetEntitySet) { contextType = JPQLContextType.JOIN; } else if (type == UriInfoType.Delete || type == UriInfoType.GetEntity || type == UriInfoType.PutMergePatch) { contextType = JPQLContextType.JOIN_SINGLE; } else if (type == UriInfoType.GetEntitySetCount || type == UriInfoType.GetEntityCount) { contextType = JPQLContextType.JOIN_COUNT; } } else { if (type == UriInfoType.GetEntitySet) { contextType = JPQLContextType.SELECT; } else if (type == UriInfoType.Delete || type == UriInfoType.GetEntity || type == UriInfoType.PutMergePatch) { contextType = JPQLContextType.SELECT_SINGLE; } else if (type == UriInfoType.GetEntitySetCount || type == UriInfoType.GetEntityCount) { contextType = JPQLContextType.SELECT_COUNT; } } return contextType; } JPAQueryBuilder(ODataJPAContext odataJPAContext); JPAQueryInfo build(GetEntitySetUriInfo uriInfo); void getCount(GetEntitySetUriInfo uriInfo); Query build(GetEntityUriInfo uriInfo); Query build(GetEntitySetCountUriInfo uriInfo); Query build(GetEntityCountUriInfo uriInfo); Query build(DeleteUriInfo uriInfo); Query build(PutMergePatchUriInfo uriInfo); ODataJPAQueryExtensionEntityListener getODataJPAQueryEntityListener(UriInfo uriInfo); ODataJPATombstoneEntityListener getODataJPATombstoneEntityListener(UriInfo uriParserResultView); JPQLContext buildJPQLContext(JPQLContextType contextType, UriInfo uriParserResultView); JPQLContextType determineJPQLContextType(UriInfo uriParserResultView, UriInfoType type); }
JPAQueryBuilder { public JPQLContextType determineJPQLContextType(UriInfo uriParserResultView, UriInfoType type) { JPQLContextType contextType = null; if (uriParserResultView.getNavigationSegments() != null && !uriParserResultView.getNavigationSegments().isEmpty()) { if (type == UriInfoType.GetEntitySet) { contextType = JPQLContextType.JOIN; } else if (type == UriInfoType.Delete || type == UriInfoType.GetEntity || type == UriInfoType.PutMergePatch) { contextType = JPQLContextType.JOIN_SINGLE; } else if (type == UriInfoType.GetEntitySetCount || type == UriInfoType.GetEntityCount) { contextType = JPQLContextType.JOIN_COUNT; } } else { if (type == UriInfoType.GetEntitySet) { contextType = JPQLContextType.SELECT; } else if (type == UriInfoType.Delete || type == UriInfoType.GetEntity || type == UriInfoType.PutMergePatch) { contextType = JPQLContextType.SELECT_SINGLE; } else if (type == UriInfoType.GetEntitySetCount || type == UriInfoType.GetEntityCount) { contextType = JPQLContextType.SELECT_COUNT; } } return contextType; } JPAQueryBuilder(ODataJPAContext odataJPAContext); JPAQueryInfo build(GetEntitySetUriInfo uriInfo); void getCount(GetEntitySetUriInfo uriInfo); Query build(GetEntityUriInfo uriInfo); Query build(GetEntitySetCountUriInfo uriInfo); Query build(GetEntityCountUriInfo uriInfo); Query build(DeleteUriInfo uriInfo); Query build(PutMergePatchUriInfo uriInfo); ODataJPAQueryExtensionEntityListener getODataJPAQueryEntityListener(UriInfo uriInfo); ODataJPATombstoneEntityListener getODataJPATombstoneEntityListener(UriInfo uriParserResultView); JPQLContext buildJPQLContext(JPQLContextType contextType, UriInfo uriParserResultView); JPQLContextType determineJPQLContextType(UriInfo uriParserResultView, UriInfoType type);  }