Class SubsetService
java.lang.Object
io.skipcheck.tm1.client.service.dimension.SubsetService
Subsets: a hierarchy's public, private and session subsets (
SubsetScope), their
elements, and the operations bound to a subset or creating a session subset.
A static subset lists its elements; a dynamic one has an MDX Expression.
Binding Elements in a subset PATCH appends to them, so update(String, String, SubsetScope, String, SubsetPatch)
refuses it: addElements(String, String, SubsetScope, String, List) appends by name and clearElements(String, String, SubsetScope, String) empties the
list.
Create a static subset, binding its elements:
// A static subset lists its elements, bound by their paths
ODataPath elements = ODataPath.of("Dimensions").key("Region").nav("Hierarchies").key("Region").nav("Elements");
return tm1.subsets()
.create("Region", "Region", SubsetScope.PUBLIC,
SubsetPatch.builder()
.name("Key Regions")
.bindElements(elements.key("North"), elements.key("South"))
.build());
Create a dynamic subset from an MDX expression:
// A dynamic subset has an MDX expression, evaluated each time it's read
return tm1.subsets()
.create("Region", "Region", SubsetScope.PUBLIC,
SubsetPatch.builder()
.name("All Leaves")
.expression("{TM1FILTERBYLEVEL({TM1SUBSETALL([Region].[Region])}, 0)}")
.build());
Replace a static subset's elements:
// A PATCH appends elements, so empty the list, then add the new ones in order
return tm1.subsets()
.clearElements("Region", "Region", SubsetScope.PUBLIC, "Key Regions")
.then(tm1.subsets()
.addElements("Region", "Region", SubsetScope.PUBLIC, "Key Regions", List.of("East", "West")));
Create a session subset and read its elements by the name TM1 gave it:
// TM1 names a session subset itself, ignoring the name sent: read it by the name
// it gives back
return tm1.subsets()
.createSessionSubset("Region", "Region",
SubsetPatch.builder().name("Regions").expression("{[Region].[Region].[Total].Children}").build())
.flatMapMany(subset -> tm1.subsets()
.elements("Region", "Region", SubsetScope.SESSION, subset.name(),
ODataQuery.none().select(Element.NAME)))
.map(Element::name);
-
Constructor Summary
ConstructorsConstructorDescriptionSubsetService(Tm1Session session) A service sending its requests throughsession. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void> addElements(String dimension, String hierarchy, SubsetScope scope, String subset, List<String> elements) PATCH …/Subsets('s')bindingElements: appends elements to a static subset, in order.reactor.core.publisher.Mono<Void> clearElements(String dimension, String hierarchy, SubsetScope scope, String subset) DELETE …/Subsets('s')/Elements/$ref: removes every element from a static subset; the elements stay in the hierarchy.reactor.core.publisher.Mono<Subset> create(String dimension, String hierarchy, SubsetScope scope, SubsetPatch subset) POST …/Subsets: creates a subset: static withElements@odata.bind(SubsetPatch.Builder#bindElements), dynamic with anExpression.reactor.core.publisher.Mono<Subset> createSessionSubset(String dimension, String hierarchy, SubsetPatch definition) tm1.CreateSessionSubsetwith a definition: creates a subset visible only to this session.reactor.core.publisher.Mono<Subset> createSessionSubsetFrom(String dimension, String hierarchy, SubsetScope scope, String subset) tm1.CreateSessionSubsetwith a reference: copies a subset into one visible only to this session.reactor.core.publisher.Mono<Void> delete(String dimension, String hierarchy, SubsetScope scope, String subset) DELETE …/Subsets('s').reactor.core.publisher.Flux<Element> elements(String dimension, String hierarchy, SubsetScope scope, String subset, ODataQuery query) GET …/Subsets('s')/Elements, streamed: a static subset's elements in order, or what a dynamic one's expression gives now.reactor.core.publisher.Mono<Subset> get(String dimension, String hierarchy, SubsetScope scope, String subset, ODataQuery query) GET …/Subsets('s').reactor.core.publisher.Mono<Hierarchy> hierarchy(String dimension, String hierarchy, SubsetScope scope, String subset, ODataQuery query) GET …/Subsets('s')/Hierarchy.reactor.core.publisher.Flux<Subset> list(String dimension, String hierarchy, SubsetScope scope, ODataQuery query) GET …/Hierarchies('h')/Subsets(or the private or session ones), streamed.reactor.core.publisher.Mono<Subset> tm1.SaveAs: copies a subset under a new name, as public and keeping whether it's static or dynamic.reactor.core.publisher.Mono<Subset> saveAs(String dimension, String hierarchy, SubsetScope scope, String subset, String newName, boolean makePrivate, boolean makeStatic) tm1.SaveAs: copies a subset under a new name.reactor.core.publisher.Mono<Void> setElement(String dimension, String hierarchy, SubsetScope scope, String subset, String element) tm1.SetElement: adds an element to a static subset, or moves it if it's there.reactor.core.publisher.Mono<Void> setElementAfter(String dimension, String hierarchy, SubsetScope scope, String subset, String element, String after) tm1.SetElementwithAfter: places an element just after another in a static subset.reactor.core.publisher.Mono<Void> setElementBefore(String dimension, String hierarchy, SubsetScope scope, String subset, String element, String before) tm1.SetElementwithBefore: places an element just before another in a static subset.reactor.core.publisher.Mono<Void> update(String dimension, String hierarchy, SubsetScope scope, String subset, SubsetPatch patch) PATCH …/Subsets('s'): changes the properties the patch sets, such as a dynamic subset's expression.reactor.core.publisher.Mono<Void> update(String dimension, String hierarchy, SubsetScope scope, String subset, SubsetPatch patch, String etag) PATCH …/Subsets('s')withIf-Match.
-
Constructor Details
-
SubsetService
A service sending its requests throughsession.- Parameters:
session- the session
-
-
Method Details
-
list
@Tm1Endpoint("Navigation Hierarchy/Subsets") @Tm1Endpoint("Navigation Hierarchy/PrivateSubsets") @Tm1Endpoint("Navigation Hierarchy/SessionSubsets") public reactor.core.publisher.Flux<Subset> list(String dimension, String hierarchy, SubsetScope scope, ODataQuery query) GET …/Hierarchies('h')/Subsets(or the private or session ones), streamed. TM1 (11.8) lists no session subsets, though each reads by the namecreateSessionSubset(String, String, SubsetPatch)returned.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namescope- which subsetsquery- what to select, expand, filter and order- Returns:
- the subsets
-
get
@Tm1Endpoint("Navigation Hierarchy/Subsets") @Tm1Endpoint("Navigation Hierarchy/PrivateSubsets") @Tm1Endpoint("Navigation Hierarchy/SessionSubsets") public reactor.core.publisher.Mono<Subset> get(String dimension, String hierarchy, SubsetScope scope, String subset, ODataQuery query) GET …/Subsets('s').- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namescope- where the subset issubset- the subset's namequery- what to select and expand- Returns:
- the subset, or a
Tm1NotFoundExceptionif there's none
-
create
@Tm1Endpoint("Navigation Hierarchy/Subsets") @Tm1Endpoint("Navigation Hierarchy/PrivateSubsets") @Tm1Endpoint("Navigation Hierarchy/SessionSubsets") public reactor.core.publisher.Mono<Subset> create(String dimension, String hierarchy, SubsetScope scope, SubsetPatch subset) POST …/Subsets: creates a subset: static withElements@odata.bind(SubsetPatch.Builder#bindElements), dynamic with anExpression.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namescope- where to create itsubset- the new subset; it needs a name- Returns:
- the subset as created
-
update
@Tm1Endpoint("Navigation Hierarchy/Subsets") @Tm1Endpoint("Navigation Hierarchy/PrivateSubsets") @Tm1Endpoint("Navigation Hierarchy/SessionSubsets") public reactor.core.publisher.Mono<Void> update(String dimension, String hierarchy, SubsetScope scope, String subset, SubsetPatch patch) PATCH …/Subsets('s'): changes the properties the patch sets, such as a dynamic subset's expression.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namescope- where the subset issubset- the subset's namepatch- the changes, withoutElements- Returns:
- completes when the subset is changed
- Throws:
IllegalArgumentException- if the patch sets or bindsElements, which TM1 appends: useaddElements(String, String, SubsetScope, String, List)orclearElements(String, String, SubsetScope, String)
-
update
@Tm1Endpoint("Navigation Hierarchy/Subsets") @Tm1Endpoint("Navigation Hierarchy/PrivateSubsets") @Tm1Endpoint("Navigation Hierarchy/SessionSubsets") public reactor.core.publisher.Mono<Void> update(String dimension, String hierarchy, SubsetScope scope, String subset, SubsetPatch patch, String etag) PATCH …/Subsets('s')withIf-Match.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namescope- where the subset issubset- the subset's namepatch- the changes, withoutElementsetag- the ETag the subset was read with (Subset.etag())- Returns:
- completes when the subset is changed, or a
Tm1PreconditionFailedExceptionif it had changed - Throws:
IllegalArgumentException- if the patch sets or bindsElements
-
addElements
@Tm1Endpoint("Navigation Hierarchy/Subsets") @Tm1Endpoint("Navigation Hierarchy/PrivateSubsets") @Tm1Endpoint("Navigation Hierarchy/SessionSubsets") public reactor.core.publisher.Mono<Void> addElements(String dimension, String hierarchy, SubsetScope scope, String subset, List<String> elements) PATCH …/Subsets('s')bindingElements: appends elements to a static subset, in order.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namescope- where the subset issubset- the subset's nameelements- the names of the elements to append- Returns:
- completes when they're added
-
clearElements
@Tm1Endpoint("Navigation Subset/Elements") public reactor.core.publisher.Mono<Void> clearElements(String dimension, String hierarchy, SubsetScope scope, String subset) DELETE …/Subsets('s')/Elements/$ref: removes every element from a static subset; the elements stay in the hierarchy.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namescope- where the subset issubset- the subset's name- Returns:
- completes when the subset is empty
-
delete
@Tm1Endpoint("Navigation Hierarchy/Subsets") @Tm1Endpoint("Navigation Hierarchy/PrivateSubsets") @Tm1Endpoint("Navigation Hierarchy/SessionSubsets") public reactor.core.publisher.Mono<Void> delete(String dimension, String hierarchy, SubsetScope scope, String subset) DELETE …/Subsets('s').- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namescope- where the subset issubset- the subset's name- Returns:
- completes when the subset is deleted
-
elements
@Tm1Endpoint("Navigation Subset/Elements") public reactor.core.publisher.Flux<Element> elements(String dimension, String hierarchy, SubsetScope scope, String subset, ODataQuery query) GET …/Subsets('s')/Elements, streamed: a static subset's elements in order, or what a dynamic one's expression gives now.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namescope- where the subset issubset- the subset's namequery- what to select, expand and filter of each element- Returns:
- the subset's elements
-
hierarchy
@Tm1Endpoint("Navigation Subset/Hierarchy") public reactor.core.publisher.Mono<Hierarchy> hierarchy(String dimension, String hierarchy, SubsetScope scope, String subset, ODataQuery query) GET …/Subsets('s')/Hierarchy.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namescope- where the subset issubset- the subset's namequery- what to select and expand- Returns:
- the subset's hierarchy
-
saveAs
@Tm1Endpoint("Action Subset/SaveAs") public reactor.core.publisher.Mono<Subset> saveAs(String dimension, String hierarchy, SubsetScope scope, String subset, String newName) tm1.SaveAs: copies a subset under a new name, as public and keeping whether it's static or dynamic.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namescope- where the subset issubset- the subset's namenewName- the copy's name- Returns:
- the copy
-
saveAs
@Tm1Endpoint("Action Subset/SaveAs") public reactor.core.publisher.Mono<Subset> saveAs(String dimension, String hierarchy, SubsetScope scope, String subset, String newName, boolean makePrivate, boolean makeStatic) tm1.SaveAs: copies a subset under a new name.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namescope- where the subset issubset- the subset's namenewName- the copy's namemakePrivate- whether the copy is privatemakeStatic- whether the copy is static, holding the elements the subset has now- Returns:
- the copy
-
setElement
@Tm1Endpoint("Action Subset/SetElement") public reactor.core.publisher.Mono<Void> setElement(String dimension, String hierarchy, SubsetScope scope, String subset, String element) tm1.SetElement: adds an element to a static subset, or moves it if it's there.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namescope- where the subset issubset- the subset's nameelement- the element's name- Returns:
- completes when the element is placed
-
setElementBefore
@Tm1Endpoint("Action Subset/SetElement") public reactor.core.publisher.Mono<Void> setElementBefore(String dimension, String hierarchy, SubsetScope scope, String subset, String element, String before) tm1.SetElementwithBefore: places an element just before another in a static subset.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namescope- where the subset issubset- the subset's nameelement- the element's namebefore- the name of the element to place it before- Returns:
- completes when the element is placed
-
setElementAfter
@Tm1Endpoint("Action Subset/SetElement") public reactor.core.publisher.Mono<Void> setElementAfter(String dimension, String hierarchy, SubsetScope scope, String subset, String element, String after) tm1.SetElementwithAfter: places an element just after another in a static subset.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namescope- where the subset issubset- the subset's nameelement- the element's nameafter- the name of the element to place it after- Returns:
- completes when the element is placed
-
createSessionSubset
@Tm1Endpoint("Action Hierarchy/CreateSessionSubset") public reactor.core.publisher.Mono<Subset> createSessionSubset(String dimension, String hierarchy, SubsetPatch definition) tm1.CreateSessionSubsetwith a definition: creates a subset visible only to this session. TM1 (11.8) ignores the definition'sNameand names it itself; the result has the name to use.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namedefinition- the subset: anExpression, or boundElements- Returns:
- the session subset, with the name TM1 gave it
-
createSessionSubsetFrom
@Tm1Endpoint("Action Hierarchy/CreateSessionSubset") public reactor.core.publisher.Mono<Subset> createSessionSubsetFrom(String dimension, String hierarchy, SubsetScope scope, String subset) tm1.CreateSessionSubsetwith a reference: copies a subset into one visible only to this session.- Parameters:
dimension- the dimension's namehierarchy- the hierarchy's namescope- where the subset to copy issubset- the name of the subset to copy- Returns:
- the session subset, with the name TM1 gave it
-