Class ElementService
java.lang.Object
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(String, String, String, ElementPatch) 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);
-
Constructor Summary
ConstructorsConstructorDescriptionElementService(Tm1Session session) A service sending its requests throughsession. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Flux<Element> components(String dimension, String hierarchy, String element, ODataQuery query) GET …/Elements('e')/Components, streamed.reactor.core.publisher.Mono<Element> create(String dimension, String hierarchy, ElementPatch element) POST …/Elements: adds an element, as a root of the hierarchy.reactor.core.publisher.Mono<Void> DELETE …/Elements('e'), with the element's edges and data.reactor.core.publisher.Flux<Edge> edges(String dimension, String hierarchy, String element, ODataQuery query) GET …/Elements('e')/Edges, streamed.reactor.core.publisher.Mono<Element> get(String dimension, String hierarchy, String element, ODataQuery query) GET …/Elements('e').reactor.core.publisher.Mono<Hierarchy> hierarchy(String dimension, String hierarchy, String element, ODataQuery query) GET …/Elements('e')/Hierarchy.reactor.core.publisher.Flux<Element> list(String dimension, String hierarchy, ODataQuery query) GET …/Hierarchies('h')/Elements, streamed.reactor.core.publisher.Mono<Void> tm1.Lock: stops everyone else changing the element until it's unlocked.reactor.core.publisher.Flux<Element> parents(String dimension, String hierarchy, String element, ODataQuery query) GET …/Elements('e')/Parents, streamed.reactor.core.publisher.Mono<Void> tm1.Release.reactor.core.publisher.Mono<Void> tm1.Reserve: stops everyone else changing the element's data until it's released.reactor.core.publisher.Mono<Void> setComponent(String dimension, String hierarchy, String parent, String child) tm1.SetComponent: makeschilda child ofparent, with weight 1, placed last among its children.reactor.core.publisher.Mono<Void> setComponent(String dimension, String hierarchy, String parent, String child, double weight) tm1.SetComponent: makeschilda child ofparentwith a weight, placed last among its children.reactor.core.publisher.Mono<Void> setComponent(String dimension, String hierarchy, String parent, String child, String before, double weight) tm1.SetComponent: makeschilda child ofparentwith a weight, placed just before another child.reactor.core.publisher.Mono<Void> tm1.Unlock.reactor.core.publisher.Mono<Void> update(String dimension, String hierarchy, String element, ElementPatch patch) PATCH …/Elements('e'): changes the properties the patch sets, such as its type.reactor.core.publisher.Mono<Void> PATCH …/Elements('e')withIf-Match.
-
Constructor Details
-
ElementService
A service sending its requests throughsession.- Parameters:
session- the session
-
-
Method Details
-
list
@Tm1Endpoint("Navigation Hierarchy/Elements") public reactor.core.publisher.Flux<Element> list(String dimension, String hierarchy, ODataQuery query) GET …/Hierarchies('h')/Elements, streamed.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namequery- what to select, expand, filter and order- Returns:
- the hierarchy's elements
-
get
@Tm1Endpoint("Navigation Hierarchy/Elements") public reactor.core.publisher.Mono<Element> get(String dimension, String hierarchy, String element, ODataQuery query) GET …/Elements('e').- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's nameelement- the element's namequery- what to select and expand- Returns:
- the element, or a
Tm1NotFoundExceptionif there's none
-
create
@Tm1Endpoint("Navigation Hierarchy/Elements") public reactor.core.publisher.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 namehierarchy- the hierarchy's nameelement- the new element; it needs a name, and a type unless it's numeric- Returns:
- the element as created
-
update
@Tm1Endpoint("Navigation Hierarchy/Elements") public reactor.core.publisher.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 namehierarchy- the hierarchy's nameelement- the element's namepatch- the changes, withoutNameorAttributes- Returns:
- completes when the element is changed
- Throws:
IllegalArgumentException- if the patch setsName, which TM1 ignores, orAttributes, which it rejects
-
update
@Tm1Endpoint("Navigation Hierarchy/Elements") public reactor.core.publisher.Mono<Void> update(String dimension, String hierarchy, String element, ElementPatch patch, String etag) PATCH …/Elements('e')withIf-Match.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's nameelement- the element's namepatch- the changes, withoutNameorAttributesetag- the ETag the element was read with (Element.etag())- Returns:
- completes when the element is changed, or a
Tm1PreconditionFailedExceptionif it had changed - Throws:
IllegalArgumentException- if the patch setsNameorAttributes
-
delete
@Tm1Endpoint("Navigation Hierarchy/Elements") public reactor.core.publisher.Mono<Void> delete(String dimension, String hierarchy, String element) DELETE …/Elements('e'), with the element's edges and data.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's nameelement- the element's name- Returns:
- completes when the element is deleted
-
parents
@Tm1Endpoint("Navigation Element/Parents") public reactor.core.publisher.Flux<Element> parents(String dimension, String hierarchy, String element, ODataQuery query) GET …/Elements('e')/Parents, streamed.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's nameelement- the element's namequery- what to select, expand, filter and order- Returns:
- the consolidations the element is in
-
components
@Tm1Endpoint("Navigation Element/Components") public reactor.core.publisher.Flux<Element> components(String dimension, String hierarchy, String element, ODataQuery query) GET …/Elements('e')/Components, streamed.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's nameelement- the element's namequery- what to select, expand, filter and order- Returns:
- the element's children, in order
-
edges
@Tm1Endpoint("Navigation Element/Edges") public reactor.core.publisher.Flux<Edge> edges(String dimension, String hierarchy, String element, ODataQuery query) GET …/Elements('e')/Edges, streamed.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's nameelement- the element's namequery- what to select, expand, filter and order- Returns:
- the edges to the element's children
-
hierarchy
@Tm1Endpoint("Navigation Element/Hierarchy") public reactor.core.publisher.Mono<Hierarchy> hierarchy(String dimension, String hierarchy, String element, ODataQuery query) GET …/Elements('e')/Hierarchy.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's nameelement- the element's namequery- what to select and expand- Returns:
- the element's hierarchy
-
setComponent
@Tm1Endpoint("Action Element/SetComponent") public reactor.core.publisher.Mono<Void> setComponent(String dimension, String hierarchy, String parent, String child) tm1.SetComponent: makeschilda child ofparent, with weight 1, placed last among its children. ($metadatadoesn't say; TM1 11.8 puts it last.)- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's nameparent- the consolidation's namechild- the child's name- Returns:
- completes when the edge is set
-
setComponent
@Tm1Endpoint("Action Element/SetComponent") public reactor.core.publisher.Mono<Void> setComponent(String dimension, String hierarchy, String parent, String child, double weight) tm1.SetComponent: makeschilda child ofparentwith a weight, placed last among its children.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's nameparent- the consolidation's namechild- the child's nameweight- the child's weight in the consolidation- Returns:
- completes when the edge is set
-
setComponent
@Tm1Endpoint("Action Element/SetComponent") public reactor.core.publisher.Mono<Void> setComponent(String dimension, String hierarchy, String parent, String child, String before, double weight) tm1.SetComponent: makeschilda child ofparentwith a weight, placed just before another child.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's nameparent- the consolidation's namechild- the child's namebefore- the name of the child to place it beforeweight- the child's weight in the consolidation- Returns:
- completes when the edge is set
-
lock
@Tm1Endpoint("Action Element/Lock") public reactor.core.publisher.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 namehierarchy- the hierarchy's nameelement- the element's name- Returns:
- completes when the element is locked
-
unlock
@Tm1Endpoint("Action Element/Unlock") public reactor.core.publisher.Mono<Void> unlock(String dimension, String hierarchy, String element) tm1.Unlock. Needs schema 11.8.23.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's nameelement- the element's name- Returns:
- completes when the element is unlocked
-
reserve
@Tm1Endpoint("Action Element/Reserve") public reactor.core.publisher.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 namehierarchy- the hierarchy's nameelement- the element's name- Returns:
- completes when the element is reserved
-
release
@Tm1Endpoint("Action Element/Release") public reactor.core.publisher.Mono<Void> release(String dimension, String hierarchy, String element) tm1.Release. Needs schema 11.8.34.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's nameelement- the element's name- Returns:
- completes when the element is released
-