Class URIBuilderImpl

java.lang.Object
org.apache.olingo.client.core.uri.URIBuilderImpl
All Implemented Interfaces:
URIBuilder

public class URIBuilderImpl extends Object implements URIBuilder
  • Field Details

    • LOG

      protected static final org.slf4j.Logger LOG
      Logger.
    • segments

      protected final List<URIBuilderImpl.Segment> segments
    • queryOptions

      protected final Map<String,String> queryOptions
      Insertion-order map of query options.
    • customQueryOptions

      protected final Map<String,String> customQueryOptions
      Insertion-order map of custom query options.
    • parameters

      protected final Map<String,String> parameters
      Insertion-order map of parameter aliases.
  • Constructor Details

    • URIBuilderImpl

      public URIBuilderImpl(Configuration configuration, String serviceRoot)
      Constructor.
      Parameters:
      serviceRoot - absolute URL (schema, host and port included) representing the location of the root of the data service.
  • Method Details

    • addQueryOption

      public URIBuilder addQueryOption(QueryOption option, String value)
      Description copied from interface: URIBuilder
      Adds the specified query option to the URI.
      Concatenates value if the specified query option already exists.
      Specified by:
      addQueryOption in interface URIBuilder
      Parameters:
      option - query option.
      value - query option value.
      Returns:
      current URIBuilder instance
    • replaceQueryOption

      public URIBuilder replaceQueryOption(QueryOption option, String value)
      Description copied from interface: URIBuilder
      Adds/replaces the specified query option to the URI.
      Specified by:
      replaceQueryOption in interface URIBuilder
      Parameters:
      option - query option.
      value - query option value.
      Returns:
      current URIBuilder instance
    • addQueryOption

      public URIBuilder addQueryOption(String option, String value, boolean replace)
      Description copied from interface: URIBuilder
      Adds/Replaces the specified (custom) query option to the URI.
      Specified by:
      addQueryOption in interface URIBuilder
      Parameters:
      option - query option.
      value - query option value.
      replace - if true then replace existing one.
      Returns:
      current URIBuilder instance.
    • addParameterAlias

      public URIBuilder addParameterAlias(String alias, String exp)
      Description copied from interface: URIBuilder
      Adds the specified (custom) parameter alias to the URI.
      Specified by:
      addParameterAlias in interface URIBuilder
      Parameters:
      alias - parameter alias.
      exp - expression value.
      Returns:
      current URIBuilder instance.
    • appendEntitySetSegment

      public URIBuilder appendEntitySetSegment(String segmentValue)
      Description copied from interface: URIBuilder
      Appends EntitySet segment to the URI.
      Specified by:
      appendEntitySetSegment in interface URIBuilder
      Parameters:
      segmentValue - segment value.
      Returns:
      current URIBuilder instance
    • appendKeySegment

      public URIBuilder appendKeySegment(Object val)
      Description copied from interface: URIBuilder
      Appends key segment to the URI.
      Specified by:
      appendKeySegment in interface URIBuilder
      Parameters:
      val - segment value.
      Returns:
      current URIBuilder instance
    • appendKeySegment

      public URIBuilder appendKeySegment(Map<String,Object> segmentValues)
      Description copied from interface: URIBuilder
      Appends key segment to the URI, for multiple keys.
      Specified by:
      appendKeySegment in interface URIBuilder
      Parameters:
      segmentValues - segment values.
      Returns:
      current URIBuilder instance
    • appendPropertySegment

      public URIBuilder appendPropertySegment(String segmentValue)
      Description copied from interface: URIBuilder
      Appends property segment to the URI.
      Specified by:
      appendPropertySegment in interface URIBuilder
      Parameters:
      segmentValue - segment value.
      Returns:
      current URIBuilder instance
    • appendNavigationSegment

      public URIBuilder appendNavigationSegment(String segmentValue)
      Description copied from interface: URIBuilder
      Appends navigation segment to the URI.
      Specified by:
      appendNavigationSegment in interface URIBuilder
      Parameters:
      segmentValue - segment value.
      Returns:
      current URIBuilder instance
    • appendDerivedEntityTypeSegment

      public URIBuilder appendDerivedEntityTypeSegment(String segmentValue)
      Description copied from interface: URIBuilder
      Appends derived entity type segment to the URI.
      Specified by:
      appendDerivedEntityTypeSegment in interface URIBuilder
      Parameters:
      segmentValue - segment value.
      Returns:
      current URIBuilder instance
    • appendValueSegment

      public URIBuilder appendValueSegment()
      Description copied from interface: URIBuilder
      Appends value segment to the URI.
      Specified by:
      appendValueSegment in interface URIBuilder
      Returns:
      current URIBuilder instance
    • appendCountSegment

      public URIBuilder appendCountSegment()
      Description copied from interface: URIBuilder
      Appends count segment to the URI.
      Specified by:
      appendCountSegment in interface URIBuilder
      Returns:
      current URIBuilder instance
    • appendActionCallSegment

      public URIBuilder appendActionCallSegment(String action)
      Description copied from interface: URIBuilder
      Appends action segment to the URI.
      Specified by:
      appendActionCallSegment in interface URIBuilder
      Parameters:
      action - Action name
      Returns:
      current URIBuilder instance
    • appendOperationCallSegment

      public URIBuilder appendOperationCallSegment(String operation)
      Description copied from interface: URIBuilder
      Appends operation (action or function) segment to the URI.
      Specified by:
      appendOperationCallSegment in interface URIBuilder
      Parameters:
      operation - Operation (action or function) name
      Returns:
      current URIBuilder instance
    • appendMetadataSegment

      public URIBuilder appendMetadataSegment()
      Description copied from interface: URIBuilder
      Appends metadata segment to the URI.
      Specified by:
      appendMetadataSegment in interface URIBuilder
      Returns:
      current URIBuilder instance
    • appendBatchSegment

      public URIBuilder appendBatchSegment()
      Description copied from interface: URIBuilder
      Appends batch segment to the URI.
      Specified by:
      appendBatchSegment in interface URIBuilder
      Returns:
      current URIBuilder instance
    • count

      public URIBuilder count()
      Description copied from interface: URIBuilder
      Adds count query option.
      Specified by:
      count in interface URIBuilder
      Returns:
      current URIBuilder instance
    • expand

      public URIBuilder expand(String... expandItems)
      Description copied from interface: URIBuilder
      Adds expand query option.
      Specified by:
      expand in interface URIBuilder
      Parameters:
      expandItems - items to be expanded in-line
      Returns:
      current URIBuilder instance
      See Also:
    • format

      public URIBuilder format(String format)
      Description copied from interface: URIBuilder
      Adds format query option.
      Specified by:
      format in interface URIBuilder
      Parameters:
      format - media type acceptable in a response.
      Returns:
      current URIBuilder instance
      See Also:
    • filter

      public URIBuilder filter(URIFilter filter)
      Description copied from interface: URIBuilder
      Adds filter for filter query option.
      Specified by:
      filter in interface URIBuilder
      Parameters:
      filter - filter instance (to be obtained via FilterFactory); note that build() method will be immediately invoked.
      Returns:
      current URIBuilder instance
      See Also:
    • filter

      public URIBuilder filter(String filter)
      Description copied from interface: URIBuilder
      Adds filter query option.
      Specified by:
      filter in interface URIBuilder
      Parameters:
      filter - filter string.
      Returns:
      current URIBuilder instance
      See Also:
    • select

      public URIBuilder select(String... selectItems)
      Description copied from interface: URIBuilder
      Adds select query option.
      Specified by:
      select in interface URIBuilder
      Parameters:
      selectItems - select items
      Returns:
      current URIBuilder instance
      See Also:
    • orderBy

      public URIBuilder orderBy(String order)
      Description copied from interface: URIBuilder
      Adds orderby query option.
      Specified by:
      orderBy in interface URIBuilder
      Parameters:
      order - order string.
      Returns:
      current URIBuilder instance
      See Also:
    • top

      public URIBuilder top(int top)
      Description copied from interface: URIBuilder
      Adds top query option.
      Specified by:
      top in interface URIBuilder
      Parameters:
      top - maximum number of entities to be returned.
      Returns:
      current URIBuilder instance
      See Also:
    • skip

      public URIBuilder skip(int skip)
      Description copied from interface: URIBuilder
      Adds skip query option.
      Specified by:
      skip in interface URIBuilder
      Parameters:
      skip - number of entities to be skipped into the response.
      Returns:
      current URIBuilder instance
      See Also:
    • skipToken

      public URIBuilder skipToken(String skipToken)
      Description copied from interface: URIBuilder
      Adds skiptoken query option.
      Specified by:
      skipToken in interface URIBuilder
      Parameters:
      skipToken - opaque token.
      Returns:
      current URIBuilder instance
      See Also:
    • build

      public URI build()
      Description copied from interface: URIBuilder
      Build OData URI.
      Specified by:
      build in interface URIBuilder
      Returns:
      OData URI.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • buildMultiKeySegment

      protected String buildMultiKeySegment(Map<String,Object> segmentValues, boolean escape, char sperator)
    • appendKeySegment

      public URIBuilder appendKeySegment(EdmEnumType enumType, String memberName)
      Description copied from interface: URIBuilder
      Appends enum key segment to the URI.
      Specified by:
      appendKeySegment in interface URIBuilder
      Parameters:
      enumType - enum type
      memberName - enum member name
      Returns:
      current URIBuilder instance
    • appendKeySegment

      public URIBuilder appendKeySegment(Map<String,org.apache.commons.lang3.tuple.Pair<EdmEnumType,String>> enumValues, Map<String,Object> segmentValues)
      Description copied from interface: URIBuilder
      Appends key segment to the URI, for multiple keys.
      Specified by:
      appendKeySegment in interface URIBuilder
      Parameters:
      enumValues - enum segment values.
      segmentValues - segment values.
      Returns:
      current URIBuilder instance
    • noKeysWrapper

      protected String noKeysWrapper()
    • getBoundOperationSeparator

      protected char getBoundOperationSeparator()
    • getOperationInvokeMarker

      protected String getOperationInvokeMarker()
    • appendSingletonSegment

      public URIBuilder appendSingletonSegment(String segmentValue)
      Description copied from interface: URIBuilder
      Appends Singleton segment to the URI.
      Specified by:
      appendSingletonSegment in interface URIBuilder
      Parameters:
      segmentValue - segment value.
      Returns:
      current URIBuilder instance
    • appendEntityIdSegment

      public URIBuilder appendEntityIdSegment(String segmentValue)
      Description copied from interface: URIBuilder
      Appends entity-id segment to the URI.
      Specified by:
      appendEntityIdSegment in interface URIBuilder
      Parameters:
      segmentValue - segment value
      Returns:
      current URIBuilder instance
    • appendRefSegment

      public URIBuilder appendRefSegment()
      Description copied from interface: URIBuilder
      Appends ref segment to the URI.
      Specified by:
      appendRefSegment in interface URIBuilder
      Returns:
      current URIBuilder instance
    • appendCrossjoinSegment

      public URIBuilder appendCrossjoinSegment(String... segmentValues)
      Description copied from interface: URIBuilder
      Appends cross join segment to the URI.
      Specified by:
      appendCrossjoinSegment in interface URIBuilder
      Parameters:
      segmentValues - segment values.
      Returns:
      current URIBuilder instance
    • appendAllSegment

      public URIBuilder appendAllSegment()
      Description copied from interface: URIBuilder
      Appends all segment to the URI.
      Specified by:
      appendAllSegment in interface URIBuilder
      Returns:
      current URIBuilder instance
    • id

      public URIBuilder id(String idValue)
      Description copied from interface: URIBuilder
      Adds id query option.
      Specified by:
      id in interface URIBuilder
      Parameters:
      idValue - opaque token.
      Returns:
      current URIBuilder instance
      See Also:
    • search

      public URIBuilder search(URISearch search)
      Description copied from interface: URIBuilder
      Appends search query option.
      Specified by:
      search in interface URIBuilder
      Parameters:
      search - search expression
      Returns:
      current URIBuilder instance
      See Also:
    • search

      public URIBuilder search(String expression)
      Description copied from interface: URIBuilder
      Appends search query option.
      Specified by:
      search in interface URIBuilder
      Parameters:
      expression - search expression
      Returns:
      current URIBuilder instance
      See Also:
    • count

      public URIBuilder count(boolean value)
      Description copied from interface: URIBuilder
      Appends count query option.
      Specified by:
      count in interface URIBuilder
      Parameters:
      value - true or false
      Returns:
      current URIBuilder instance
      See Also:
    • expandWithOptions

      public URIBuilder expandWithOptions(String expandItem, Map<QueryOption,Object> options)
      Description copied from interface: URIBuilder
      The set of expanded entities can be refined through the application of expand options, expressed as a semicolon-separated list of system query options, enclosed in parentheses, see [OData-URL].
      Specified by:
      expandWithOptions in interface URIBuilder
      Parameters:
      expandItem - item to be expanded.
      options - System query options. Allowed query options are: $filter, $select, $orderby, $skip, $top, $count, $search, $expand, and $levels.
      Returns:
      current URIBuilder instance.
      See Also:
    • expandWithOptions

      public URIBuilder expandWithOptions(String expandItem, boolean pathRef, boolean pathCount, Map<QueryOption,Object> options)
      Description copied from interface: URIBuilder
      The set of expanded entities can be refined through the application of expand options, expressed as a semicolon-separated list of system query options, enclosed in parentheses, see [OData-URL].
      Specified by:
      expandWithOptions in interface URIBuilder
      Parameters:
      expandItem - item to be expanded.
      pathRef - include the /$ref at the end of the $expand item's path;if true pathCount MUST be false
      pathCount - include /$count at the end of the $expand item's path;if true pathRef MUST be false
      options - System query options. Allowed query options are: $filter, $select, $orderby, $skip, $top, $count, $search, $expand, and $levels.
      Returns:
      current URIBuilder instance.
      See Also:
    • expandWithSelect

      public URIBuilder expandWithSelect(String expandItem, String... selectItems)
      Description copied from interface: URIBuilder
      Properties of related entities can be specified by including the $select query option within the $expand.
      http://host/service/Products?$expand=Category($select=Name)
      Specified by:
      expandWithSelect in interface URIBuilder
      Parameters:
      expandItem - related entity name.
      selectItems - properties to be selected.
      Returns:
      current URIBuilder instance.
      See Also:
    • addCustomQueryOption

      public URIBuilder addCustomQueryOption(String customName, String customValue)
      Description copied from interface: URIBuilder
      Adds/Replaces the specified custom query option to the URI.
      Specified by:
      addCustomQueryOption in interface URIBuilder
      Returns:
      current URIBuilder instance.