Class HierarchyService
java.lang.Object
io.skipcheck.tm1.client.service.dimension.HierarchyService
Hierarchies:
/Dimensions('d')/Hierarchies, a dimension's default hierarchy, and
the operations bound to a hierarchy. Elements, edges, members, levels and subsets have
services of their own.
A hierarchy PATCH that sets Elements or Edges replaces them:
TM1 deletes the elements it doesn't list. So update(String, String, HierarchyPatch) refuses such a patch, and
replaceStructure(String, String, List, List) does it by name.
Add a hierarchy to a dimension, with its elements and edges:
// A second hierarchy of Region, rolling the same leaves up by manager
return tm1.hierarchies()
.create("Region", HierarchyPatch.builder()
.name("By Manager")
.elements(List.of(ElementPatch.builder().name("Smith").type(ElementType.CONSOLIDATED).build(),
ElementPatch.builder().name("North").type(ElementType.NUMERIC).build(),
ElementPatch.builder().name("South").type(ElementType.NUMERIC).build()))
.edges(List.of(EdgePatch.builder().parentName("Smith").componentName("North").weight(1.0).build(),
EdgePatch.builder().parentName("Smith").componentName("South").weight(1.0).build()))
.build());
Replace a hierarchy's structure, knowing that TM1 deletes what isn't listed:
// Makes the elements and edges exactly these: TM1 deletes every other element of
// the hierarchy, with its data
ElementPatch all = ElementPatch.builder().name("All Versions").type(ElementType.CONSOLIDATED).build();
ElementPatch actual = ElementPatch.builder().name("Actual").type(ElementType.NUMERIC).build();
ElementPatch budget = ElementPatch.builder().name("Budget").type(ElementType.NUMERIC).build();
return tm1.hierarchies()
.replaceStructure("Version", "Version", List.of(all, actual, budget), List.of(
EdgePatch.builder().parentName("All Versions").componentName("Actual").weight(1.0).build(),
EdgePatch.builder().parentName("All Versions").componentName("Budget").weight(1.0).build()));
Read the roots of a hierarchy:
// The top of the hierarchy: the members with no parent, in order
return tm1.hierarchies()
.rootMembers("Region", "Region", ODataQuery.none().select(Member.NAME))
.map(Member::name);
-
Constructor Summary
ConstructorsConstructorDescriptionHierarchyService(Tm1Session session) A service sending its requests throughsession. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Member> allMember(String dimension, String hierarchy, ODataQuery query) GET Dimensions('d')/Hierarchies('h')/AllMember: the member that stands for the whole hierarchy.reactor.core.publisher.Mono<Hierarchy> create(String dimension, HierarchyPatch hierarchy) POST Dimensions('d')/Hierarchies: adds a hierarchy, with its elements and edges if the patch has them.reactor.core.publisher.Mono<Hierarchy> defaultHierarchy(String dimension, ODataQuery query) GET Dimensions('d')/DefaultHierarchy.reactor.core.publisher.Mono<Member> defaultMember(String dimension, String hierarchy, ODataQuery query) GET Dimensions('d')/Hierarchies('h')/DefaultMember.reactor.core.publisher.Mono<Void> DELETE Dimensions('d')/Hierarchies('h').reactor.core.publisher.Mono<Dimension> dimension(String dimension, String hierarchy, ODataQuery query) GET Dimensions('d')/Hierarchies('h')/Dimension.reactor.core.publisher.Mono<Hierarchy> get(String dimension, String hierarchy, ODataQuery query) GET Dimensions('d')/Hierarchies('h').reactor.core.publisher.Flux<Hierarchy> list(String dimension, ODataQuery query) GET Dimensions('d')/Hierarchies, streamed.reactor.core.publisher.Mono<Void> replaceStructure(String dimension, String hierarchy, List<ElementPatch> elements, List<EdgePatch> edges) PATCH Dimensions('d')/Hierarchies('h')withElementsandEdges: makes them exactly these.reactor.core.publisher.Flux<Member> rootMembers(String dimension, String hierarchy, ODataQuery query) tm1.RootMembers(): the members with no parent, streamed.reactor.core.publisher.Mono<Hierarchy> tm1.SaveAs: copies a hierarchy under a new name in the same dimension, failing if one exists.reactor.core.publisher.Mono<Hierarchy> saveAs(String dimension, String hierarchy, String newName, boolean overwrite, boolean keepExistingAttributes) tm1.SaveAs: copies a hierarchy under a new name in the same dimension.reactor.core.publisher.Mono<Void> setElement(String dimension, String hierarchy, String element) tm1.SetElementwith noBefore: makes an element a root of the hierarchy, placed last among the roots.reactor.core.publisher.Mono<Void> setElement(String dimension, String hierarchy, String element, String before) tm1.SetElement: makes an element a root of the hierarchy, placed just before another root.reactor.core.publisher.Mono<Void> update(String dimension, String hierarchy, HierarchyPatch patch) PATCH Dimensions('d')/Hierarchies('h'): changes the properties the patch sets.reactor.core.publisher.Mono<Void> update(String dimension, String hierarchy, HierarchyPatch patch, String etag) PATCH Dimensions('d')/Hierarchies('h')withIf-Match: changes the properties the patch sets, unless the hierarchy changed since it was read.
-
Constructor Details
-
HierarchyService
A service sending its requests throughsession.- Parameters:
session- the session
-
-
Method Details
-
list
@Tm1Endpoint("Navigation Dimension/Hierarchies") public reactor.core.publisher.Flux<Hierarchy> list(String dimension, ODataQuery query) GET Dimensions('d')/Hierarchies, streamed.- Parameters:
dimension- the dimension's namequery- what to select, expand, filter and order- Returns:
- the dimension's hierarchies
-
get
@Tm1Endpoint("Navigation Dimension/Hierarchies") public reactor.core.publisher.Mono<Hierarchy> get(String dimension, String hierarchy, ODataQuery query) GET Dimensions('d')/Hierarchies('h').- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namequery- what to select and expand- Returns:
- the hierarchy, or a
Tm1NotFoundExceptionif there's none
-
create
@Tm1Endpoint("Navigation Dimension/Hierarchies") public reactor.core.publisher.Mono<Hierarchy> create(String dimension, HierarchyPatch hierarchy) POST Dimensions('d')/Hierarchies: adds a hierarchy, with its elements and edges if the patch has them.- Parameters:
dimension- the dimension's namehierarchy- the new hierarchy; it needs a name- Returns:
- the hierarchy as created
-
update
@Tm1Endpoint("Navigation Dimension/Hierarchies") public reactor.core.publisher.Mono<Void> update(String dimension, String hierarchy, HierarchyPatch patch) PATCH Dimensions('d')/Hierarchies('h'): changes the properties the patch sets. TM1 (11.8) ignoresVisible.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namepatch- the changes, withoutElementsorEdges- Returns:
- completes when the hierarchy is changed
- Throws:
IllegalArgumentException- if the patch setsElementsorEdges, which would replace them: usereplaceStructure(String, String, List, List)
-
update
@Tm1Endpoint("Navigation Dimension/Hierarchies") public reactor.core.publisher.Mono<Void> update(String dimension, String hierarchy, HierarchyPatch patch, String etag) PATCH Dimensions('d')/Hierarchies('h')withIf-Match: changes the properties the patch sets, unless the hierarchy changed since it was read.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namepatch- the changes, withoutElementsorEdgesetag- the ETag the hierarchy was read with (Hierarchy.etag())- Returns:
- completes when the hierarchy is changed, or a
Tm1PreconditionFailedExceptionif it had changed - Throws:
IllegalArgumentException- if the patch setsElementsorEdges: usereplaceStructure(String, String, List, List)
-
replaceStructure
@Tm1Endpoint("Navigation Dimension/Hierarchies") public reactor.core.publisher.Mono<Void> replaceStructure(String dimension, String hierarchy, List<ElementPatch> elements, List<EdgePatch> edges) PATCH Dimensions('d')/Hierarchies('h')withElementsandEdges: makes them exactly these. TM1 deletes every element not listed, with its data.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's nameelements- every element the hierarchy should haveedges- every parent-child edge it should have- Returns:
- completes when the hierarchy is replaced
-
delete
@Tm1Endpoint("Navigation Dimension/Hierarchies") public reactor.core.publisher.Mono<Void> delete(String dimension, String hierarchy) DELETE Dimensions('d')/Hierarchies('h').- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's name- Returns:
- completes when the hierarchy is deleted
-
defaultHierarchy
@Tm1Endpoint("Navigation Dimension/DefaultHierarchy") public reactor.core.publisher.Mono<Hierarchy> defaultHierarchy(String dimension, ODataQuery query) GET Dimensions('d')/DefaultHierarchy.- Parameters:
dimension- the dimension's namequery- what to select and expand- Returns:
- the dimension's default hierarchy
-
dimension
@Tm1Endpoint("Navigation Hierarchy/Dimension") public reactor.core.publisher.Mono<Dimension> dimension(String dimension, String hierarchy, ODataQuery query) GET Dimensions('d')/Hierarchies('h')/Dimension.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namequery- what to select and expand- Returns:
- the hierarchy's dimension
-
allMember
@Tm1Endpoint("Navigation Hierarchy/AllMember") public reactor.core.publisher.Mono<Member> allMember(String dimension, String hierarchy, ODataQuery query) GET Dimensions('d')/Hierarchies('h')/AllMember: the member that stands for the whole hierarchy. TM1 (11.8) has one only when the hierarchy has a single root, which is then that root; with several roots it sends no content, and this completes empty.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namequery- what to select and expand- Returns:
- the all member, or empty if the hierarchy has several roots
-
defaultMember
@Tm1Endpoint("Navigation Hierarchy/DefaultMember") public reactor.core.publisher.Mono<Member> defaultMember(String dimension, String hierarchy, ODataQuery query) GET Dimensions('d')/Hierarchies('h')/DefaultMember.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namequery- what to select and expand- Returns:
- the default member
-
rootMembers
@Tm1Endpoint("Function Hierarchy/RootMembers") public reactor.core.publisher.Flux<Member> rootMembers(String dimension, String hierarchy, ODataQuery query) tm1.RootMembers(): the members with no parent, streamed. Needs schema 11.4.7.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namequery- what to select and expand of each member- Returns:
- the root members
-
saveAs
@Tm1Endpoint("Action Hierarchy/SaveAs") public reactor.core.publisher.Mono<Hierarchy> saveAs(String dimension, String hierarchy, String newName) tm1.SaveAs: copies a hierarchy under a new name in the same dimension, failing if one exists.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namenewName- the copy's name- Returns:
- the copy
-
saveAs
@Tm1Endpoint("Action Hierarchy/SaveAs") public reactor.core.publisher.Mono<Hierarchy> saveAs(String dimension, String hierarchy, String newName, boolean overwrite, boolean keepExistingAttributes) tm1.SaveAs: copies a hierarchy under a new name in the same dimension.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namenewName- the copy's nameoverwrite- whether to replace a hierarchy that already has the new namekeepExistingAttributes- when overwriting, whether to keep the attributes of what's replaced; when not, true creates no attributes for the copy- Returns:
- the copy
-
setElement
@Tm1Endpoint("Action Hierarchy/SetElement") public reactor.core.publisher.Mono<Void> setElement(String dimension, String hierarchy, String element) tm1.SetElementwith noBefore: makes an element a root of the hierarchy, placed last among the roots. ($metadatasays first; TM1 11.8 puts it last.)- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's nameelement- the element's name- Returns:
- completes when the element is placed
-
setElement
@Tm1Endpoint("Action Hierarchy/SetElement") public reactor.core.publisher.Mono<Void> setElement(String dimension, String hierarchy, String element, String before) tm1.SetElement: makes an element a root of the hierarchy, placed just before another root.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's nameelement- the element's namebefore- the name of the root to place it before- Returns:
- completes when the element is placed
-