skipcheck

TM1 client · Docs · Dimensions and hierarchies

DimensionService

import io.skipcheck.tm1.client.service.dimension.DimensionService;

Used in the walkthrough Test your code against a real TM1.

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);

Members

DimensionService constructorA service sending its requests through session.
listEvery dimension, control dimensions included, streamed.
modelDimensionsThe dimensions that aren't control dimensions (whose names start with }), streamed.
controlDimensionsThe control dimensions, such as }Clients, streamed.
getGET Dimensions('name').
createCreates a dimension, with its hierarchies, elements and edges if the patch has them (a deep insert).
updateChanges the properties the patch sets.
updatePATCH Dimensions('name') with If-Match.
deleteDELETE Dimensions('name').
saveAsCopies a dimension under a new name, failing if one exists.
saveAsCopies a dimension under a new name.
addAllLeavesHierarchyAdds a hierarchy of all the dimension's leaves, named Leaves and not visible, which makes it a multi-hierarchy dimension.
addAllLeavesHierarchyAdds a hierarchy of all the dimension's leaves, which makes it a multi-hierarchy dimension.
lockStops everyone else changing the dimension until it's unlocked.
unlocktm1.Unlock.
reserveStops everyone else changing the dimension until it's released.
releasetm1.Release.

DimensionService

constructor
DimensionService(Tm1Session session)

A service sending its requests through session.

Parameters

session
the session

list

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

TM1 REST EntitySet Dimensions

modelDimensions

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

TM1 REST FunctionImport ModelDimensions

controlDimensions

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

TM1 REST FunctionImport ControlDimensions

get

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

TM1 REST EntitySet Dimensions

create

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

TM1 REST EntitySet Dimensions

update

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.

Parameters

name
the dimension's name
patch
the changes

Returns

completes when the dimension is changed

TM1 REST EntitySet Dimensions

update

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

TM1 REST EntitySet Dimensions

delete

Mono<Void> delete(String name)

DELETE Dimensions('name').

Parameters

name
the dimension's name

Returns

completes when the dimension is deleted

TM1 REST EntitySet Dimensions

saveAs

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

TM1 REST Action Dimension/SaveAs

saveAs

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

TM1 REST Action Dimension/SaveAs

addAllLeavesHierarchy

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

TM1 REST Action Dimension/AddAllLeavesHierarchy

addAllLeavesHierarchy

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

TM1 REST Action Dimension/AddAllLeavesHierarchy

lock

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

TM1 REST Action Dimension/Lock

unlock

Mono<Void> unlock(String name)

tm1.Unlock.

Parameters

name
the dimension's name

Returns

completes when the dimension is unlocked

TM1 REST Action Dimension/Unlock

reserve

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

TM1 REST Action Dimension/Reserve

release

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

TM1 REST Action Dimension/Release

Also in the Javadoc.