skipcheck

TM1 client · Docs · Dimensions and hierarchies

ElementService

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

Elements: /Dimensions('d')/Hierarchies('h')/Elements, an element's parents, components and edges, and the operations bound to an element.

TM1 (11.8) ignores Name in an element PATCH, so elements can't be renamed, and rejects Attributes, whose values are cells of the }ElementAttributes_<dimension> cube. update refuses both, saying why.

List elements with a query: here, the consolidations.

// The names of the consolidated elements, in name order
return tm1.elements()
    .list("Region", "Region",
            ODataQuery.none()
                .select(Element.NAME)
                .filter(Element.TYPE.eq(ElementType.CONSOLIDATED))
                .orderBy(Element.NAME))
    .map(Element::name);

Add an element under a consolidation. A new element is a root until it has a parent:

// A new element is a root; SetComponent then puts it last under Total
return tm1.elements()
    .create("Region", "Region", ElementPatch.builder().name("West").type(ElementType.NUMERIC).build())
    .then(tm1.elements().setComponent("Region", "Region", "Total", "West"));

Read a consolidation's children:

// The children of Total, in order
return tm1.elements()
    .components("Region", "Region", "Total", ODataQuery.none().select(Element.NAME))
    .map(Element::name);

Members

ElementService constructorA service sending its requests through session.
listGET …/Hierarchies('h')/Elements, streamed.
getGET …/Elements('e').
createAdds an element, as a root of the hierarchy.
updateChanges the properties the patch sets, such as its type.
updatePATCH …/Elements('e') with If-Match.
deleteDELETE …/Elements('e'), with the element's edges and data.
parentsGET …/Elements('e')/Parents, streamed.
componentsGET …/Elements('e')/Components, streamed.
edgesGET …/Elements('e')/Edges, streamed.
hierarchyGET …/Elements('e')/Hierarchy.
setComponentMakes child a child of parent, with weight 1, placed last among its children.
setComponentMakes child a child of parent with a weight, placed last among its children.
setComponentMakes child a child of parent with a weight, placed just before another child.
lockStops everyone else changing the element until it's unlocked.
unlocktm1.Unlock.
reserveStops everyone else changing the element's data until it's released.
releasetm1.Release.

ElementService

constructor
ElementService(Tm1Session session)

A service sending its requests through session.

Parameters

session
the session

list

Flux<Element> list(String dimension, String hierarchy, ODataQuery query)

GET …/Hierarchies('h')/Elements, streamed.

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
query
what to select, expand, filter and order

Returns

the hierarchy's elements

TM1 REST Navigation Hierarchy/Elements

get

Mono<Element> get(String dimension, String hierarchy, String element, ODataQuery query)

GET …/Elements('e').

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
element
the element's name
query
what to select and expand

Returns

the element, or a Tm1NotFoundException if there's none

TM1 REST Navigation Hierarchy/Elements

create

Mono<Element> create(String dimension, String hierarchy, ElementPatch element)

POST …/Elements: adds an element, as a root of the hierarchy.

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
element
the new element; it needs a name, and a type unless it's numeric

Returns

the element as created

TM1 REST Navigation Hierarchy/Elements

update

Mono<Void> update(String dimension, String hierarchy, String element, ElementPatch patch)

PATCH …/Elements('e'): changes the properties the patch sets, such as its type.

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
element
the element's name
patch
the changes, without Name or Attributes

Returns

completes when the element is changed

Throws

IllegalArgumentException
if the patch sets Name, which TM1 ignores, or Attributes, which it rejects

TM1 REST Navigation Hierarchy/Elements

update

Mono<Void> update(String dimension, String hierarchy, String element, ElementPatch patch, String etag)

PATCH …/Elements('e') with If-Match.

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
element
the element's name
patch
the changes, without Name or Attributes
etag
the ETag the element was read with (Element.etag)

Returns

completes when the element is changed, or a Tm1PreconditionFailedException if it had changed

Throws

IllegalArgumentException
if the patch sets Name or Attributes

TM1 REST Navigation Hierarchy/Elements

delete

Mono<Void> delete(String dimension, String hierarchy, String element)

DELETE …/Elements('e'), with the element's edges and data.

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
element
the element's name

Returns

completes when the element is deleted

TM1 REST Navigation Hierarchy/Elements

parents

Flux<Element> parents(String dimension, String hierarchy, String element, ODataQuery query)

GET …/Elements('e')/Parents, streamed.

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
element
the element's name
query
what to select, expand, filter and order

Returns

the consolidations the element is in

TM1 REST Navigation Element/Parents

components

Flux<Element> components(String dimension, String hierarchy, String element, ODataQuery query)

GET …/Elements('e')/Components, streamed.

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
element
the element's name
query
what to select, expand, filter and order

Returns

the element's children, in order

TM1 REST Navigation Element/Components

edges

Flux<Edge> edges(String dimension, String hierarchy, String element, ODataQuery query)

GET …/Elements('e')/Edges, streamed.

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
element
the element's name
query
what to select, expand, filter and order

Returns

the edges to the element's children

TM1 REST Navigation Element/Edges

hierarchy

Mono<Hierarchy> hierarchy(String dimension, String hierarchy, String element, ODataQuery query)

GET …/Elements('e')/Hierarchy.

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
element
the element's name
query
what to select and expand

Returns

the element's hierarchy

TM1 REST Navigation Element/Hierarchy

setComponent

Mono<Void> setComponent(String dimension, String hierarchy, String parent, String child)

tm1.SetComponent: makes child a child of parent, with weight 1, placed last among its children. ($metadata doesn't say; TM1 11.8 puts it last.)

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
parent
the consolidation's name
child
the child's name

Returns

completes when the edge is set

TM1 REST Action Element/SetComponent

setComponent

Mono<Void> setComponent(String dimension, String hierarchy, String parent, String child, double weight)

tm1.SetComponent: makes child a child of parent with a weight, placed last among its children.

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
parent
the consolidation's name
child
the child's name
weight
the child's weight in the consolidation

Returns

completes when the edge is set

TM1 REST Action Element/SetComponent

setComponent

Mono<Void> setComponent(String dimension, String hierarchy, String parent, String child, String before, double weight)

tm1.SetComponent: makes child a child of parent with a weight, placed just before another child.

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
parent
the consolidation's name
child
the child's name
before
the name of the child to place it before
weight
the child's weight in the consolidation

Returns

completes when the edge is set

TM1 REST Action Element/SetComponent

lock

Mono<Void> lock(String dimension, String hierarchy, String element)

tm1.Lock: stops everyone else changing the element until it's unlocked. Needs schema 11.8.23.

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
element
the element's name

Returns

completes when the element is locked

TM1 REST Action Element/Lock

unlock

Mono<Void> unlock(String dimension, String hierarchy, String element)

tm1.Unlock. Needs schema 11.8.23.

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
element
the element's name

Returns

completes when the element is unlocked

TM1 REST Action Element/Unlock

reserve

Mono<Void> reserve(String dimension, String hierarchy, String element)

tm1.Reserve: stops everyone else changing the element's data until it's released. Needs schema 11.8.34.

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
element
the element's name

Returns

completes when the element is reserved

TM1 REST Action Element/Reserve

release

Mono<Void> release(String dimension, String hierarchy, String element)

tm1.Release. Needs schema 11.8.34.

Parameters

dimension
the dimension's name
hierarchy
the hierarchy's name
element
the element's name

Returns

completes when the element is released

TM1 REST Action Element/Release

Also in the Javadoc.