Class UriParserImpl
java.lang.Object
org.apache.olingo.odata2.api.uri.UriParser
org.apache.olingo.odata2.core.uri.UriParserImpl
Parser for the OData part of the URL.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildExpandSelectTree(List<SelectItem> select, List<ArrayList<NavigationPropertySegment>> expand) Creates an optimized expression tree out of $expand and $select expressions.protected PathSegmentCreates an path segment object.getKeyFromEntityLink(EdmEntitySet entitySet, String entityLink, URI serviceRoot) Retrieves the key predicates from a canonical link to an entity.Parse the URI part after an OData service root, already splitted into path segments and query parameters.Deprecated.Parses path segments and query parameters.parseFilterString(EdmEntityType entityType, String expression) Parses a $filter expression string and create an expression tree.parseOrderByString(EdmEntityType entityType, String expression) Parses a $orderby expression string and creates an expression tree.Methods inherited from class org.apache.olingo.odata2.api.uri.UriParser
createExpandSelectTree, createPathSegment, getKeyPredicatesFromEntityLink, parse, parse, parseFilter, parseOrderBy
-
Constructor Details
-
UriParserImpl
-
-
Method Details
-
parse
public UriInfo parse(List<PathSegment> pathSegments, Map<String, String> queryParameters) throws UriSyntaxException, UriNotMatchingException, EdmExceptionParse the URI part after an OData service root, already splitted into path segments and query parameters.- Specified by:
parsein classUriParser- Parameters:
pathSegments- thePathSegments of the resource path, potentially percent-encodedqueryParameters- the query parameters, already percent-decoded- Returns:
- a
UriInfoImplinstance containing the parsed information - Throws:
UriSyntaxExceptionUriNotMatchingExceptionEdmException
-
parseAll
public UriInfo parseAll(List<PathSegment> pathSegments, Map<String, List<String>> allQueryParameters) throws UriSyntaxException, UriNotMatchingException, EdmExceptionDescription copied from class:UriParserParses path segments and query parameters. Throws an exception if there are redundant system query parameters.- Specified by:
parseAllin classUriParser- Parameters:
pathSegments- list of path segments- Returns:
UriInfoinformation about the parsed URI- Throws:
UriSyntaxExceptionUriNotMatchingExceptionEdmException
-
parseFilterString
public FilterExpression parseFilterString(EdmEntityType entityType, String expression) throws ODataMessageException Description copied from class:UriParserParses a $filter expression string and create an expression tree.The current expression parser supports expressions as defined in the OData specification 2.0 with the following restrictions:
- the methods "cast", "isof" and "replace" are not supported
The expression parser can be used with providing an Entity Data Model (EDM) and without providing it. When an EDM is provided the expression parser will be as strict as possible. That means:
- All properties used in the expression must be defined inside the EDM,
- the types of EDM properties will be checked against the lists of allowed types per method and per binary or unary operator, respectively
- The properties used in the expression are not looked up inside the EDM and the type of the expression node representing the property will be "null",
- expression nodes with EDM type "null" are not considered during the parameter type validation, so the return type of the parent expression node will also become "null".
- Specified by:
parseFilterStringin classUriParser- Parameters:
entityType- EDM type of the OData entity/complex type/... addressed by the URLexpression- $filter expression string to be parsed- Returns:
- expression tree which can be traversed with help of the interfaces
ExpressionVisitorandVisitable - Throws:
ExpressionParserException- thrown due to errors while parsing the $filter expression stringODataMessageException- for extensibility
-
parseOrderByString
public OrderByExpression parseOrderByString(EdmEntityType entityType, String expression) throws ODataMessageException Description copied from class:UriParserParses a $orderby expression string and creates an expression tree.- Specified by:
parseOrderByStringin classUriParser- Parameters:
entityType- EDM type of the OData entity/complex type/... addressed by the URLexpression- $orderby expression string to be parsed- Returns:
- expression tree which can be traversed with help of the interfaces
ExpressionVisitorandVisitable - Throws:
ExpressionParserException- thrown due to errors while parsing the $orderby expression stringODataMessageException- used for extensibility
-
buildExpandSelectTree
public ExpandSelectTreeNode buildExpandSelectTree(List<SelectItem> select, List<ArrayList<NavigationPropertySegment>> expand) throws EdmException Description copied from class:UriParserCreates an optimized expression tree out of $expand and $select expressions.- Specified by:
buildExpandSelectTreein classUriParser- Parameters:
select- List ofselect itemsexpand- List of Lists ofnavigation property segments- Returns:
- expression tree of type
ExpandSelectTreeNode - Throws:
EdmException
-
buildPathSegment
Description copied from class:UriParserCreates an path segment object.- Specified by:
buildPathSegmentin classUriParser- Parameters:
path- path of created path segmentmatrixParameters- Map of Lists of matrix parameters for this path segment (can be null if no matrix parameters should be set for this path segment)- Returns:
- created path segment
-
getKeyFromEntityLink
public List<KeyPredicate> getKeyFromEntityLink(EdmEntitySet entitySet, String entityLink, URI serviceRoot) throws ODataException Description copied from class:UriParserRetrieves the key predicates from a canonical link to an entity.- Specified by:
getKeyFromEntityLinkin classUriParser- Parameters:
entitySet- the entity set the entity belongs toentityLink- the link as StringserviceRoot- the root URI of the service, may benullfor a relative link URI- Returns:
- a list of key predicates
- Throws:
ODataException- in case the link is malformed- See Also:
-
parse
@Deprecated public UriInfo parse(List<PathSegment> pathSegments, Map<String, String> queryParameters, boolean strictFilter) throws UriSyntaxException, UriNotMatchingException, EdmExceptionDeprecated.Description copied from class:UriParserParses path segments and query parameters. This method ignores redundant system query parameters.- Specified by:
parsein classUriParser- Parameters:
pathSegments- list of path segmentsqueryParameters- query parameters- Returns:
UriInfoinformation about the parsed URI- Throws:
UriSyntaxExceptionUriNotMatchingExceptionEdmException
-