Class DimensionService

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

public final class DimensionService extends Object
Dimensions: /Dimensions and the operations bound to a dimension.

A dimension's hierarchies, elements and subsets have services of their own.

List dimensions with a query: here, the names of the model dimensions.

// The names of the model dimensions, in name order
return tm1.dimensions()
	.modelDimensions(ODataQuery.none().select(Dimension.NAME).orderBy(Dimension.NAME))
	.map(Dimension::name);

Create a dimension with its hierarchy, elements and edges in one request:

// Region, with one hierarchy of the same name: Total = North + South
ElementPatch total = ElementPatch.builder().name("Total").type(ElementType.CONSOLIDATED).build();
ElementPatch north = ElementPatch.builder().name("North").type(ElementType.NUMERIC).build();
ElementPatch south = ElementPatch.builder().name("South").type(ElementType.NUMERIC).build();
return tm1.dimensions()
	.create(DimensionPatch.builder()
		.name("Region")
		.hierarchies(List.of(HierarchyPatch.builder()
			.name("Region")
			.elements(List.of(total, north, south))
			.edges(List.of(EdgePatch.builder().parentName("Total").componentName("North").weight(1.0).build(),
					EdgePatch.builder().parentName("Total").componentName("South").weight(1.0).build()))
			.build()))
		.build());

Read a dimension with its hierarchies expanded:

// A dimension with its hierarchies' names expanded in the same request
return tm1.dimensions()
	.get("Region", ODataQuery.none().expand(Dimension.HIERARCHIES, h -> h.select(Hierarchy.NAME)))
	.flatMapIterable(Dimension::hierarchies)
	.map(Hierarchy::name);
  • Constructor Summary

    Constructors
    Constructor
    Description
    A service sending its requests through session.
  • Method Summary

    Modifier and Type
    Method
    Description
    reactor.core.publisher.Mono<Hierarchy>
    tm1.AddAllLeavesHierarchy: adds a hierarchy of all the dimension's leaves, named Leaves and not visible, which makes it a multi-hierarchy dimension.
    reactor.core.publisher.Mono<Hierarchy>
    addAllLeavesHierarchy(String name, String hierarchyName, boolean visible)
    tm1.AddAllLeavesHierarchy: adds a hierarchy of all the dimension's leaves, which makes it a multi-hierarchy dimension.
    reactor.core.publisher.Flux<Dimension>
    ControlDimensions(): the control dimensions, such as }Clients, streamed.
    reactor.core.publisher.Mono<Dimension>
    POST Dimensions: creates a dimension, with its hierarchies, elements and edges if the patch has them (a deep insert).
    reactor.core.publisher.Mono<Void>
    delete(String name)
    DELETE Dimensions('name').
    reactor.core.publisher.Mono<Dimension>
    get(String name, ODataQuery query)
    GET Dimensions('name').
    reactor.core.publisher.Flux<Dimension>
    GET Dimensions: every dimension, control dimensions included, streamed.
    reactor.core.publisher.Mono<Void>
    lock(String name)
    tm1.Lock: stops everyone else changing the dimension until it's unlocked.
    reactor.core.publisher.Flux<Dimension>
    ModelDimensions(): the dimensions that aren't control dimensions (whose names start with }), streamed.
    reactor.core.publisher.Mono<Void>
    tm1.Release.
    reactor.core.publisher.Mono<Void>
    tm1.Reserve: stops everyone else changing the dimension until it's released.
    reactor.core.publisher.Mono<Dimension>
    saveAs(String name, String newName)
    tm1.SaveAs: copies a dimension under a new name, failing if one exists.
    reactor.core.publisher.Mono<Dimension>
    saveAs(String name, String newName, boolean overwrite, boolean keepExistingAttributes)
    tm1.SaveAs: copies a dimension under a new name.
    reactor.core.publisher.Mono<Void>
    unlock(String name)
    tm1.Unlock.
    reactor.core.publisher.Mono<Void>
    PATCH Dimensions('name'): changes the properties the patch sets.
    reactor.core.publisher.Mono<Void>
    update(String name, DimensionPatch patch, String etag)
    PATCH Dimensions('name') with If-Match: changes the properties the patch sets, unless the dimension changed since it was read.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DimensionService

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

    • list

      @Tm1Endpoint("EntitySet Dimensions") public reactor.core.publisher.Flux<Dimension> list(ODataQuery query)
      GET Dimensions: every dimension, control dimensions included, streamed.
      Parameters:
      query - what to select, expand, filter and order
      Returns:
      the dimensions
    • modelDimensions

      @Tm1Endpoint("FunctionImport ModelDimensions") public reactor.core.publisher.Flux<Dimension> modelDimensions(ODataQuery query)
      ModelDimensions(): the dimensions that aren't control dimensions (whose names start with }), streamed.
      Parameters:
      query - what to select, expand, filter and order
      Returns:
      the model dimensions
    • controlDimensions

      @Tm1Endpoint("FunctionImport ControlDimensions") public reactor.core.publisher.Flux<Dimension> controlDimensions(ODataQuery query)
      ControlDimensions(): the control dimensions, such as }Clients, streamed.
      Parameters:
      query - what to select, expand, filter and order
      Returns:
      the control dimensions
    • get

      @Tm1Endpoint("EntitySet Dimensions") public reactor.core.publisher.Mono<Dimension> get(String name, ODataQuery query)
      GET Dimensions('name').
      Parameters:
      name - the dimension's name
      query - what to select and expand
      Returns:
      the dimension, or a Tm1NotFoundException if there's none
    • create

      @Tm1Endpoint("EntitySet Dimensions") public reactor.core.publisher.Mono<Dimension> create(DimensionPatch dimension)
      POST Dimensions: creates a dimension, with its hierarchies, elements and edges if the patch has them (a deep insert).
      Parameters:
      dimension - the new dimension; it needs a name
      Returns:
      the dimension as created
    • update

      @Tm1Endpoint("EntitySet Dimensions") public reactor.core.publisher.Mono<Void> update(String name, DimensionPatch patch)
      PATCH Dimensions('name'): changes the properties the patch sets.

      TM1 (11.8) accepts Hierarchies and AllLeavesHierarchyName in a dimension PATCH and ignores them: change hierarchies through their own service, and add an all-leaves hierarchy with addAllLeavesHierarchy(String).

      Parameters:
      name - the dimension's name
      patch - the changes
      Returns:
      completes when the dimension is changed
    • update

      @Tm1Endpoint("EntitySet Dimensions") public reactor.core.publisher.Mono<Void> update(String name, DimensionPatch patch, String etag)
      PATCH Dimensions('name') with If-Match: changes the properties the patch sets, unless the dimension changed since it was read.
      Parameters:
      name - the dimension's name
      patch - the changes
      etag - the ETag the dimension was read with (Dimension.etag())
      Returns:
      completes when the dimension is changed, or a Tm1PreconditionFailedException if it had changed
    • delete

      @Tm1Endpoint("EntitySet Dimensions") public reactor.core.publisher.Mono<Void> delete(String name)
      DELETE Dimensions('name').
      Parameters:
      name - the dimension's name
      Returns:
      completes when the dimension is deleted
    • saveAs

      @Tm1Endpoint("Action Dimension/SaveAs") public reactor.core.publisher.Mono<Dimension> saveAs(String name, String newName)
      tm1.SaveAs: copies a dimension under a new name, failing if one exists.
      Parameters:
      name - the dimension's name
      newName - the copy's name
      Returns:
      the copy
    • saveAs

      @Tm1Endpoint("Action Dimension/SaveAs") public reactor.core.publisher.Mono<Dimension> saveAs(String name, String newName, boolean overwrite, boolean keepExistingAttributes)
      tm1.SaveAs: copies a dimension under a new name.
      Parameters:
      name - the dimension's name
      newName - the copy's name
      overwrite - whether to replace a dimension that already has the new name
      keepExistingAttributes - when overwriting, whether to keep the attributes of what's replaced; when not, true creates no attributes for the copy
      Returns:
      the copy
    • addAllLeavesHierarchy

      @Tm1Endpoint("Action Dimension/AddAllLeavesHierarchy") public reactor.core.publisher.Mono<Hierarchy> addAllLeavesHierarchy(String name)
      tm1.AddAllLeavesHierarchy: adds a hierarchy of all the dimension's leaves, named Leaves and not visible, which makes it a multi-hierarchy dimension.
      Parameters:
      name - the dimension's name
      Returns:
      the new hierarchy
    • addAllLeavesHierarchy

      @Tm1Endpoint("Action Dimension/AddAllLeavesHierarchy") public reactor.core.publisher.Mono<Hierarchy> addAllLeavesHierarchy(String name, String hierarchyName, boolean visible)
      tm1.AddAllLeavesHierarchy: adds a hierarchy of all the dimension's leaves, which makes it a multi-hierarchy dimension.
      Parameters:
      name - the dimension's name
      hierarchyName - the new hierarchy's name
      visible - whether the new hierarchy is visible
      Returns:
      the new hierarchy
    • lock

      @Tm1Endpoint("Action Dimension/Lock") public reactor.core.publisher.Mono<Void> lock(String name)
      tm1.Lock: stops everyone else changing the dimension until it's unlocked.
      Parameters:
      name - the dimension's name
      Returns:
      completes when the dimension is locked
    • unlock

      @Tm1Endpoint("Action Dimension/Unlock") public reactor.core.publisher.Mono<Void> unlock(String name)
      tm1.Unlock.
      Parameters:
      name - the dimension's name
      Returns:
      completes when the dimension is unlocked
    • reserve

      @Tm1Endpoint("Action Dimension/Reserve") public reactor.core.publisher.Mono<Void> reserve(String name)
      tm1.Reserve: stops everyone else changing the dimension until it's released. Needs schema 11.8.34.
      Parameters:
      name - the dimension's name
      Returns:
      completes when the dimension is reserved
    • release

      @Tm1Endpoint("Action Dimension/Release") public reactor.core.publisher.Mono<Void> release(String name)
      tm1.Release. Needs schema 11.8.34.
      Parameters:
      name - the dimension's name
      Returns:
      completes when the dimension is released