Class JPAAbstractJoinQuery
java.lang.Object
com.sap.olingo.jpa.processor.core.query.JPAAbstractQuery
com.sap.olingo.jpa.processor.core.query.JPAAbstractJoinQuery
- All Implemented Interfaces:
JPAQuery
- Direct Known Subclasses:
JPACollectionJoinQuery,JPAExpandJoinQuery,JPAExpandSubQuery,JPAJoinQuery
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static Stringprotected JPAODataCRUDContextAccessprotected javax.persistence.criteria.CriteriaQuery<javax.persistence.Tuple>protected JPANavigationProptertyInfoprotected List<JPANavigationProptertyInfo>protected JPAODataPageprotected JPAODataRequestContextAccessprotected javax.persistence.criteria.Root<?>protected javax.persistence.criteria.From<?,?>protected org.apache.olingo.server.api.uri.UriInfoResourceFields inherited from class com.sap.olingo.jpa.processor.core.query.JPAAbstractQuery
cb, claimsProvider, debugger, em, groups, jpaEntity, locale, odata, sd, SELECT_ALL, SELECT_ITEM_SEPERATOR -
Constructor Summary
ConstructorsModifierConstructorDescriptionJPAAbstractJoinQuery(org.apache.olingo.server.api.OData odata, JPAODataCRUDContextAccess sessionContext, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType jpaEntityType, JPAODataRequestContextAccess requestContext, Map<String,List<String>> requestHeaders, List<JPANavigationProptertyInfo> navigationInfo)protectedJPAAbstractJoinQuery(org.apache.olingo.server.api.OData odata, JPAODataCRUDContextAccess sessionContext, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType jpaEntityType, org.apache.olingo.server.api.uri.UriInfoResource uriInfo, JPAODataRequestContextAccess requestContext, Map<String,List<String>> requestHeaders, List<JPANavigationProptertyInfo> navigationInfo) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddTopSkip(javax.persistence.TypedQuery<javax.persistence.Tuple> tq)Applies the $skip and $top options of the OData request to the query.protected List<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath>buildEntityPathList(com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType jpaEntity)protected voidbuildSelectionAddNavigationAndSelect(org.apache.olingo.server.api.uri.UriInfoResource uriResource, Set<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> jpaPathList, org.apache.olingo.server.api.uri.queryoption.SelectOption select)protected Set<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath>buildSelectionPathList(org.apache.olingo.server.api.uri.UriInfoResource uriResource)Creates the path to all properties that need to be selected from the database.protected <Y extends Comparable<? super Y>>
javax.persistence.criteria.Expression<Boolean>createBoundary(List<JPANavigationProptertyInfo> info, Optional<JPAKeyBoundary> keyBoundary)createFromClause(List<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAAssociationPath> orderByTarget, Collection<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> selectionPath, javax.persistence.criteria.CriteriaQuery<?> query, JPANavigationProptertyInfo lastInfo)protected javax.persistence.criteria.Expression<Boolean>protected javax.persistence.criteria.Expression<Boolean>createProtectionWhere(Optional<JPAODataClaimProvider> claimsProvider)protected List<javax.persistence.criteria.Selection<?>>createSelectClause(Map<String,javax.persistence.criteria.From<?,?>> joinTables, Collection<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> requestedProperties, javax.persistence.criteria.From<?,?> target, List<String> groups)The value of the $select query option is a comma-separated list of properties, qualified action names, qualified function names, the star operator (*), or the star operator prefixed with the namespace or alias of the schema in order to specify all operations defined in the schema.protected javax.persistence.criteria.Expression<Boolean>createWhere(org.apache.olingo.server.api.uri.UriInfoResource uriInfo, List<JPANavigationProptertyInfo> navigationInfo)protected com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAAssociationPathdetermineAssoziation(org.apache.olingo.server.api.uri.UriResourcePartTyped naviStart, StringBuilder associationName)protected JPANavigationProptertyInfodetermineLastInfo(List<JPANavigationProptertyInfo> naviInfo)protected booleandetermineTargetIsCollection(org.apache.olingo.server.api.uri.UriInfoResource uriResource)protected voidexpandPath(com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType jpaEntity, Collection<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> jpaPathList, String selectItem, boolean targetIsCollection)protected List<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath>extractDescriptionAttributes(Collection<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> jpaPathList)protected voidgenerateCollectionAttributeJoin(Map<String,javax.persistence.criteria.From<?,?>> joinTables, Collection<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> jpaPathList, JPANavigationProptertyInfo lastInfo)protected Localejavax.persistence.criteria.AbstractQuery<?>getQuery()javax.persistence.criteria.From<?,?>getRoot()Methods inherited from class com.sap.olingo.jpa.processor.core.query.JPAAbstractQuery
addWhereClause, createJoinFromPath, createProtectionWhereForEntityType, createWhereByKey, generateDesciptionJoin, getDebugger, orWhereClause
-
Field Details
-
ALIAS_SEPERATOR
- See Also:
- Constant Field Values
-
uriResource
protected final org.apache.olingo.server.api.uri.UriInfoResource uriResource -
cq
protected final javax.persistence.criteria.CriteriaQuery<javax.persistence.Tuple> cq -
root
protected javax.persistence.criteria.Root<?> root -
target
protected javax.persistence.criteria.From<?,?> target -
context
-
page
-
lastInfo
-
requestContext
-
-
Constructor Details
-
JPAAbstractJoinQuery
public JPAAbstractJoinQuery(org.apache.olingo.server.api.OData odata, JPAODataCRUDContextAccess sessionContext, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType jpaEntityType, JPAODataRequestContextAccess requestContext, Map<String,List<String>> requestHeaders, List<JPANavigationProptertyInfo> navigationInfo) throws org.apache.olingo.commons.api.ex.ODataException- Throws:
org.apache.olingo.commons.api.ex.ODataException
-
JPAAbstractJoinQuery
protected JPAAbstractJoinQuery(org.apache.olingo.server.api.OData odata, JPAODataCRUDContextAccess sessionContext, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType jpaEntityType, org.apache.olingo.server.api.uri.UriInfoResource uriInfo, JPAODataRequestContextAccess requestContext, Map<String,List<String>> requestHeaders, List<JPANavigationProptertyInfo> navigationInfo) throws org.apache.olingo.commons.api.ex.ODataException- Throws:
org.apache.olingo.commons.api.ex.ODataException
-
-
Method Details
-
getQuery
public javax.persistence.criteria.AbstractQuery<?> getQuery()- Specified by:
getQueryin classJPAAbstractQuery
-
getRoot
public javax.persistence.criteria.From<?,?> getRoot()- Specified by:
getRootin classJPAAbstractQuery
-
addTopSkip
protected void addTopSkip(javax.persistence.TypedQuery<javax.persistence.Tuple> tq) throws org.apache.olingo.server.api.ODataApplicationExceptionApplies the $skip and $top options of the OData request to the query. The values are defined as follows:- The $top system query option specifies a non-negative integer n that limits the number of items returned from a collection.
- The $skip system query option specifies a non-negative integer n that excludes the first n items of the queried collection from the result.
For details see: OData Version 4.0 Part 1 - 11.2.5.3 System Query Option $top and OData Version 4.0 Part 1 - 11.2.5.7 Server-Driven Paging
- Throws:
org.apache.olingo.server.api.ODataApplicationException
-
buildEntityPathList
protected List<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> buildEntityPathList(com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType jpaEntity) throws org.apache.olingo.server.api.ODataApplicationException- Throws:
org.apache.olingo.server.api.ODataApplicationException
-
buildSelectionPathList
protected Set<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> buildSelectionPathList(org.apache.olingo.server.api.uri.UriInfoResource uriResource) throws org.apache.olingo.server.api.ODataApplicationExceptionCreates the path to all properties that need to be selected from the database. A Property can be included for the following reasons:- It is a key in order to be able to build the links
- It is part of the $select system query option
- It is the result of a navigation, which my be restricted by a $select
- If is required to link $expand with result with the parent result
- A stream is requested and the property contains the mime type>
- Parameters:
uriResource-- Returns:
- Throws:
org.apache.olingo.server.api.ODataApplicationException
-
createKeyWhere
protected final javax.persistence.criteria.Expression<Boolean> createKeyWhere(List<JPANavigationProptertyInfo> info) throws org.apache.olingo.server.api.ODataApplicationException- Throws:
org.apache.olingo.server.api.ODataApplicationException
-
createProtectionWhere
protected javax.persistence.criteria.Expression<Boolean> createProtectionWhere(Optional<JPAODataClaimProvider> claimsProvider) throws ODataJPAQueryException- Throws:
ODataJPAQueryException
-
createSelectClause
protected List<javax.persistence.criteria.Selection<?>> createSelectClause(Map<String,javax.persistence.criteria.From<?,?>> joinTables, Collection<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> requestedProperties, javax.persistence.criteria.From<?,?> target, List<String> groups) throws org.apache.olingo.server.api.ODataApplicationExceptionThe value of the $select query option is a comma-separated list of properties, qualified action names, qualified function names, the star operator (*), or the star operator prefixed with the namespace or alias of the schema in order to specify all operations defined in the schema. See: OData Version 4.0 Part 1 - 11.2.4.1 System Query Option $selectSee also: OData Version 4.0 Part 2 - 5.1.3 System Query Option $select
- Parameters:
joinTables-requestedProperties-optional-- Returns:
- Throws:
org.apache.olingo.server.api.ODataApplicationException
-
createWhere
protected javax.persistence.criteria.Expression<Boolean> createWhere(org.apache.olingo.server.api.uri.UriInfoResource uriInfo, List<JPANavigationProptertyInfo> navigationInfo) throws org.apache.olingo.server.api.ODataApplicationException- Throws:
org.apache.olingo.server.api.ODataApplicationException
-
determineAssoziation
protected com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAAssociationPath determineAssoziation(org.apache.olingo.server.api.uri.UriResourcePartTyped naviStart, StringBuilder associationName) throws org.apache.olingo.server.api.ODataApplicationException- Throws:
org.apache.olingo.server.api.ODataApplicationException
-
determineLastInfo
-
determineTargetIsCollection
protected final boolean determineTargetIsCollection(org.apache.olingo.server.api.uri.UriInfoResource uriResource) -
expandPath
protected void expandPath(com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType jpaEntity, Collection<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> jpaPathList, String selectItem, boolean targetIsCollection) throws com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException, ODataJPAQueryException- Throws:
com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelExceptionODataJPAQueryException
-
extractDescriptionAttributes
protected List<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> extractDescriptionAttributes(Collection<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> jpaPathList) -
getLocale
- Specified by:
getLocalein classJPAAbstractQuery
-
createBoundary
protected <Y extends Comparable<? super Y>> javax.persistence.criteria.Expression<Boolean> createBoundary(List<JPANavigationProptertyInfo> info, Optional<JPAKeyBoundary> keyBoundary) throws ODataJPAQueryException- Throws:
ODataJPAQueryException
-