Class EdgeService

java.lang.Object
io.skipcheck.tm1.client.service.dimension.EdgeService

public final class EdgeService extends Object
Edges: /Dimensions('d')/Hierarchies('h')/Edges, the parent-child links of a hierarchy, each keyed by its parent's and its component's names.

List a hierarchy's edges:

// Every parent-child link of the hierarchy, as "parent > child (weight)"
return tm1.edges()
	.list("Region", "Region", ODataQuery.none())
	.map(edge -> edge.parentName() + " > " + edge.componentName() + " (" + edge.weight() + ")");

Change an edge's weight:

// Make Cost count negatively in Margin
return tm1.edges().update("Account", "Account", "Margin", "Cost", EdgePatch.builder().weight(-1.0).build());

Move an element to another parent:

// Move North from Total to Total Sales: add the new edge, then delete the old
return tm1.edges()
	.create("Region", "Region",
			EdgePatch.builder().parentName("Total Sales").componentName("North").weight(1.0).build())
	.flatMap(edge -> tm1.edges().delete("Region", "Region", "Total", "North").thenReturn(edge));
  • Constructor Details

    • EdgeService

      public EdgeService(Tm1Session session)
      A service sending its requests through session.
      Parameters:
      session - the session
  • Method Details

    • list

      @Tm1Endpoint("Navigation Hierarchy/Edges") public reactor.core.publisher.Flux<Edge> list(String dimension, String hierarchy, ODataQuery query)
      GET …/Hierarchies('h')/Edges, streamed.
      Parameters:
      dimension - the dimension's name
      hierarchy - the hierarchy's name
      query - what to select, expand, filter and order
      Returns:
      the hierarchy's edges
    • get

      @Tm1Endpoint("Navigation Hierarchy/Edges") public reactor.core.publisher.Mono<Edge> get(String dimension, String hierarchy, String parent, String component, ODataQuery query)
      GET …/Edges(ParentName='p',ComponentName='c').
      Parameters:
      dimension - the dimension's name
      hierarchy - the hierarchy's name
      parent - the parent's name
      component - the component's name
      query - what to select and expand
      Returns:
      the edge, or a Tm1NotFoundException if there's none
    • create

      @Tm1Endpoint("Navigation Hierarchy/Edges") public reactor.core.publisher.Mono<Edge> create(String dimension, String hierarchy, EdgePatch edge)
      POST …/Edges: makes an element a child of a consolidation.
      Parameters:
      dimension - the dimension's name
      hierarchy - the hierarchy's name
      edge - the new edge: parent, component and, optionally, weight
      Returns:
      the edge as created
    • update

      @Tm1Endpoint("Navigation Hierarchy/Edges") public reactor.core.publisher.Mono<Void> update(String dimension, String hierarchy, String parent, String component, EdgePatch patch)
      PATCH …/Edges(ParentName='p',ComponentName='c'): changes the edge's weight.
      Parameters:
      dimension - the dimension's name
      hierarchy - the hierarchy's name
      parent - the parent's name
      component - the component's name
      patch - the changes
      Returns:
      completes when the edge is changed
    • delete

      @Tm1Endpoint("Navigation Hierarchy/Edges") public reactor.core.publisher.Mono<Void> delete(String dimension, String hierarchy, String parent, String component)
      DELETE …/Edges(ParentName='p',ComponentName='c'): takes an element out of a consolidation; the element stays in the hierarchy.
      Parameters:
      dimension - the dimension's name
      hierarchy - the hierarchy's name
      parent - the parent's name
      component - the component's name
      Returns:
      completes when the edge is deleted
    • parent

      @Tm1Endpoint("Navigation Edge/Parent") public reactor.core.publisher.Mono<Element> parent(String dimension, String hierarchy, String parent, String component, ODataQuery query)
      GET …/Edges(…)/Parent.
      Parameters:
      dimension - the dimension's name
      hierarchy - the hierarchy's name
      parent - the parent's name
      component - the component's name
      query - what to select and expand
      Returns:
      the edge's parent
    • component

      @Tm1Endpoint("Navigation Edge/Component") public reactor.core.publisher.Mono<Element> component(String dimension, String hierarchy, String parent, String component, ODataQuery query)
      GET …/Edges(…)/Component.
      Parameters:
      dimension - the dimension's name
      hierarchy - the hierarchy's name
      parent - the parent's name
      component - the component's name
      query - what to select and expand
      Returns:
      the edge's component
    • hierarchy

      @Tm1Endpoint("Navigation Edge/Hierarchy") public reactor.core.publisher.Mono<Hierarchy> hierarchy(String dimension, String hierarchy, String parent, String component, ODataQuery query)
      GET …/Edges(…)/Hierarchy.
      Parameters:
      dimension - the dimension's name
      hierarchy - the hierarchy's name
      parent - the parent's name
      component - the component's name
      query - what to select and expand
      Returns:
      the edge's hierarchy