ODataPath
import io.skipcheck.tm1.client.odata.ODataPath;A resource path relative to the service root, built from segments and encoded as it's built:
ODataPath element = ODataPath.of("Dimensions")
.key("Region")
.nav("Hierarchies")
.key("Region")
.nav("Elements")
.key("O'Neil");
// Dimensions('Region')/Hierarchies('Region')/Elements('O''Neil')
ODataPath reserve = ODataPath.of("Cubes").key("Sales").action("tm1.Reserve");
// Cubes('Sales')/tm1.Reserve
Names (entity sets, navigation properties, operations, type casts) must be OData identifiers, optionally qualified; they're checked, never encoded. Key values can be any text: they're written as string literals and percent-encoded. Paths are immutable.
Members
of static | A path starting at an entity set, singleton or operation import, e.g. |
metadata static | The service's metadata document, $metadata. |
batch static | The service's batch endpoint, $batch. |
key | Adds a single-part key with a string value. |
key | Adds a single-part key with a non-string value, such as a number. |
key | Adds a compound key, in the order given. |
nav | Adds a navigation property or structural property segment, e.g. |
cast | Adds a type-cast segment, e.g. |
action | Adds a bound action segment, e.g. |
function | Adds a bound function call with literal parameters, e.g. |
link static | A path a server returned, such as a delta link (MessageLogEntries/!delta('…')), relative to the service root and not yet encoded. |
functionImport static | A function import called from the service root, e.g. |
value | Adds $value. |
count | Adds $count. |
ref | Adds $ref. |
toString | The encoded path, without a leading slash, e.g. |
equals | |
hashCode |
of
staticstatic ODataPath of(String name) A path starting at an entity set, singleton or operation import, e.g.
Cubes.
Parameters
name- the first segment's name, an OData identifier
Returns
- a one-segment path
Throws
IllegalArgumentException- if
nameisn't an identifier
metadata
staticstatic ODataPath metadata() The service's metadata document, $metadata: its CSDL XML. A path of its
own, since $metadata isn't an identifier of accepts.
Returns
- the path
batch
staticstatic ODataPath batch() The service's batch endpoint, $batch: a path of its own, as for
metadata.
Returns
- the path
key
ODataPath key(String value) Adds a single-part key with a string value: ('Sales').
Parameters
value- the key value, any text; quoted and percent-encoded
Returns
- a new path with the key on its last segment
Throws
IllegalStateException- if the last segment already has a key or is a
$segment
key
ODataPath key(Object value) Adds a single-part key with a non-string value, such as a number: (42).
Parameters
value- the key value, written as an OData literal (
ODataLiterals.of); text is treated as bykey
Returns
- a new path with the key on its last segment
key
ODataPath key(Map<String,?> parts) Adds a compound key, in the order given:
(ParentName='Total',ComponentName='Q1').
Parameters
parts- the key's property names (identifiers) and values, in order
Returns
- a new path with the key on its last segment
Throws
IllegalArgumentException- if
partsis empty
cast
ODataPath cast(String qualifiedType) Adds a type-cast segment, e.g. tm1.NativeView.
Parameters
qualifiedType- the namespace-qualified type name
Returns
- a new path with the segment added
action
ODataPath action(String qualifiedName) Adds a bound action segment, e.g. tm1.Reserve. Actions are invoked with
POST.
Parameters
qualifiedName- the namespace-qualified action name
Returns
- a new path with the segment added
function
ODataPath function(String qualifiedName, Map<String,?> parameters) Adds a bound function call with literal parameters, e.g.
tm1.GetPartition(Begin=0,End=99). Use parameter aliases (in
ODataQuery) for complex or collection parameters.
Parameters
qualifiedName- the namespace-qualified function name
parameters- the parameter names and values, in order; each value is written
as an OData literal, or as the alias's name if it's an
ODataPath.Alias
Returns
- a new path with the segment added
link
staticstatic ODataPath link(String link) A path a server returned, such as a delta link
(MessageLogEntries/!delta('…')), relative to the service root and not yet
encoded: each segment is percent-encoded as it is (keeping !, (,
) and '), without checking it's an identifier.
Parameters
link- the path, without a query
Returns
- the path
Throws
IllegalArgumentException- if it's empty, absolute or has a query
functionImport
staticstatic ODataPath functionImport(String name, Map<String,?> parameters) A function import called from the service root, e.g. ModelCubes() or
TailMessageLog(Top=10).
Parameters
name- the import's name, unqualified
parameters- the parameter names and values, in order, as for
function
Returns
- the path
value
ODataPath value() Adds $value: a property's or media entity's raw value.
Returns
- a new path with the segment added
count
ODataPath count() Adds $count: the number of items in a collection, as plain text.
Returns
- a new path with the segment added
ref
ODataPath ref() Adds $ref: references to entities rather than the entities themselves.
Returns
- a new path with the segment added
toString
String toString()The encoded path, without a leading slash, e.g. Cubes('Sales')/Views.
equals
boolean equals(Object o)hashCode
int hashCode()Also in the Javadoc.