Class CubeService
java.lang.Object
io.skipcheck.tm1.client.service.cube.CubeService
Cubes:
/Cubes, a cube's dimensions, and the operations bound to a cube. Views
have a service of their own; cell data is read and written through cellsets.
List cubes with a query: here, the model cubes whose names start with "Sales".
// The names of the model cubes starting with "Sales", in name order
return tm1.cubes()
.modelCubes(ODataQuery.none()
.select(Cube.NAME)
.filter(Filter.startsWith(Cube.NAME, "Sales"))
.orderBy(Cube.NAME))
.map(Cube::name);
Create a cube over existing dimensions, bound in order:
// A cube over two existing dimensions, in this order
ODataPath dimensions = ODataPath.of("Dimensions");
return tm1.cubes()
.create(CubePatch.builder()
.name("Sales")
.bindDimensions(dimensions.key("Region"), dimensions.key("Month"))
.build());
Change a cube's rules, checking them first:
// TM1 saves rules even when they don't compile, so check them first
String rules = "SKIPCHECK;\n['Margin'] = N: ['Revenue'] - ['Cost'];";
return tm1.cubes()
.checkRules("Sales", rules)
.collectList()
.flatMap(errors -> errors.isEmpty() ? tm1.cubes().update("Sales", CubePatch.builder().rules(rules).build())
: Mono.error(new IllegalArgumentException("The rules don't compile: " + errors)));
-
Constructor Summary
ConstructorsConstructorDescriptionCubeService(Tm1Session session) A service sending its requests throughsession. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Flux<FedCellDescriptor> checkFeeders(String name, Map<String, String> tuple, CheckFeedersSelection selection, ODataQuery query) tm1.CheckFeeders: the cells under a consolidated cell that are fed, not fed, or both, to find missing feeders.reactor.core.publisher.Flux<RuleSyntaxError> checkRules(String name) tm1.CheckRules: compiles the cube's saved rules and lists their errors.reactor.core.publisher.Flux<RuleSyntaxError> checkRules(String name, String rules) tm1.CheckRuleswithRules: compiles rules for the cube without saving them, so they can be checked beforeupdate(String, CubePatch)saves them (which TM1 does even when they don't compile).reactor.core.publisher.Flux<Cube> controlCubes(ODataQuery query) ControlCubes(): the control cubes, such as}ClientGroups, streamed.reactor.core.publisher.Mono<Cube> POST Cubes: creates a cube over existing dimensions, bound in order withCubePatch.Builder#bindDimensions, and optionally its rules.reactor.core.publisher.Mono<Void> DELETE Cubes('name'), with its data and views; its dimensions stay.reactor.core.publisher.Flux<Dimension> dimensions(String name, ODataQuery query) GET Cubes('name')/Dimensions, streamed, in the cube's order.reactor.core.publisher.Flux<Dimension> dimensionsStorageOrder(String name, ODataQuery query) tm1.DimensionsStorageOrder(): the cube's dimensions in the order TM1 stores them, which can differ from the order they're presented in.reactor.core.publisher.Mono<Cube> get(String name, ODataQuery query) GET Cubes('name').reactor.core.publisher.Flux<Cube> list(ODataQuery query) GET Cubes: every cube, control cubes included, streamed.reactor.core.publisher.Mono<Void> tm1.Load: loads the cube into memory, if it isn't.reactor.core.publisher.Mono<Void> tm1.Lock: stops everyone else changing the cube until it's unlocked.reactor.core.publisher.Flux<Cube> modelCubes(ODataQuery query) ModelCubes(): the cubes that aren't control cubes (whose names start with}), streamed.reactor.core.publisher.Mono<Void> tm1.Release.reactor.core.publisher.Mono<Double> reorderDimensions(String name, List<String> dimensions) tm1.ReorderDimensions: changes the order TM1 stores the cube's dimensions in, which changes its memory use but not how it's presented.reactor.core.publisher.Mono<Void> tm1.Reserve: stops everyone else changing the cube until it's released.reactor.core.publisher.Mono<CalculationComponent> traceCellCalculation(String name, Map<String, String> tuple, ODataQuery query) tm1.TraceCellCalculation: how a cell's value is calculated, as a tree of rule and consolidation components.reactor.core.publisher.Mono<FeederTrace> traceFeeders(String name, Map<String, String> tuple, ODataQuery query) tm1.TraceFeeders: which cells a cell feeds, and the feeder statements that do it.reactor.core.publisher.Mono<Void> tm1.Unload: frees the cube's memory; TM1 loads it again when it's next used.reactor.core.publisher.Mono<Void> tm1.Unlock.reactor.core.publisher.Mono<Void> PATCH Cubes('name'): changes the properties the patch sets, typicallyRulesorDrillthroughRules;nullclears them.reactor.core.publisher.Mono<Void> PATCH Cubes('name')withIf-Match: changes the properties the patch sets, unless the cube changed since it was read.
-
Constructor Details
-
CubeService
A service sending its requests throughsession.- Parameters:
session- the session
-
-
Method Details
-
list
GET Cubes: every cube, control cubes included, streamed.- Parameters:
query- what to select, expand, filter and order- Returns:
- the cubes
-
modelCubes
@Tm1Endpoint("FunctionImport ModelCubes") public reactor.core.publisher.Flux<Cube> modelCubes(ODataQuery query) ModelCubes(): the cubes that aren't control cubes (whose names start with}), streamed.- Parameters:
query- what to select, expand, filter and order- Returns:
- the model cubes
-
controlCubes
@Tm1Endpoint("FunctionImport ControlCubes") public reactor.core.publisher.Flux<Cube> controlCubes(ODataQuery query) ControlCubes(): the control cubes, such as}ClientGroups, streamed.- Parameters:
query- what to select, expand, filter and order- Returns:
- the control cubes
-
get
@Tm1Endpoint("EntitySet Cubes") public reactor.core.publisher.Mono<Cube> get(String name, ODataQuery query) GET Cubes('name').- Parameters:
name- the cube's namequery- what to select and expand- Returns:
- the cube, or a
Tm1NotFoundExceptionif there's none
-
create
POST Cubes: creates a cube over existing dimensions, bound in order withCubePatch.Builder#bindDimensions, and optionally its rules.- Parameters:
cube- the new cube; it needs a name and at least two dimensions- Returns:
- the cube as created
-
update
@Tm1Endpoint("EntitySet Cubes") public reactor.core.publisher.Mono<Void> update(String name, CubePatch patch) PATCH Cubes('name'): changes the properties the patch sets, typicallyRulesorDrillthroughRules;nullclears them.TM1 (11.8) saves rules even when they don't compile: check them first with
checkRules(String, String).- Parameters:
name- the cube's namepatch- the changes- Returns:
- completes when the cube is changed
-
update
@Tm1Endpoint("EntitySet Cubes") public reactor.core.publisher.Mono<Void> update(String name, CubePatch patch, String etag) PATCH Cubes('name')withIf-Match: changes the properties the patch sets, unless the cube changed since it was read. TM1 (11.8) saves rules even when they don't compile.- Parameters:
name- the cube's namepatch- the changesetag- the ETag the cube was read with (Cube.etag())- Returns:
- completes when the cube is changed, or a
Tm1PreconditionFailedExceptionif it had changed
-
delete
DELETE Cubes('name'), with its data and views; its dimensions stay.- Parameters:
name- the cube's name- Returns:
- completes when the cube is deleted
-
dimensions
@Tm1Endpoint("Navigation Cube/Dimensions") public reactor.core.publisher.Flux<Dimension> dimensions(String name, ODataQuery query) GET Cubes('name')/Dimensions, streamed, in the cube's order.TM1 (11.8) lists its virtual
Sandboxesdimension first, before the dimensions the cube was made of; skip it to get those.- Parameters:
name- the cube's namequery- what to select, expand, filter and order- Returns:
- the cube's dimensions,
Sandboxesfirst
-
dimensionsStorageOrder
@Tm1Endpoint("Function Cube/DimensionsStorageOrder") public reactor.core.publisher.Flux<Dimension> dimensionsStorageOrder(String name, ODataQuery query) tm1.DimensionsStorageOrder(): the cube's dimensions in the order TM1 stores them, which can differ from the order they're presented in. Needs schema 11.4.0.- Parameters:
name- the cube's namequery- what to select of each dimension- Returns:
- the dimensions in storage order
-
reorderDimensions
@Tm1Endpoint("Action Cube/ReorderDimensions") public reactor.core.publisher.Mono<Double> reorderDimensions(String name, List<String> dimensions) tm1.ReorderDimensions: changes the order TM1 stores the cube's dimensions in, which changes its memory use but not how it's presented. Needs schema 11.4.0.- Parameters:
name- the cube's namedimensions- the cube's dimensions, in the new storage order- Returns:
- the change in the cube's memory use, as TM1 reports it (a percentage)
-
load
tm1.Load: loads the cube into memory, if it isn't. Needs schema 11.6.0.- Parameters:
name- the cube's name- Returns:
- completes when the cube is loaded
-
unload
tm1.Unload: frees the cube's memory; TM1 loads it again when it's next used. Needs schema 11.6.0.- Parameters:
name- the cube's name- Returns:
- completes when the cube is unloaded
-
lock
tm1.Lock: stops everyone else changing the cube until it's unlocked.- Parameters:
name- the cube's name- Returns:
- completes when the cube is locked
-
unlock
tm1.Unlock.- Parameters:
name- the cube's name- Returns:
- completes when the cube is unlocked
-
reserve
tm1.Reserve: stops everyone else changing the cube until it's released. Needs schema 11.8.34.- Parameters:
name- the cube's name- Returns:
- completes when the cube is reserved
-
release
tm1.Release. Needs schema 11.8.34.- Parameters:
name- the cube's name- Returns:
- completes when the cube is released
-
checkRules
@Tm1Endpoint("Action Cube/CheckRules") public reactor.core.publisher.Flux<RuleSyntaxError> checkRules(String name) tm1.CheckRules: compiles the cube's saved rules and lists their errors. Needs schema 11.1.0.- Parameters:
name- the cube's name- Returns:
- the syntax errors, with line numbers; none if the rules compile
-
checkRules
@Tm1Endpoint("Action Cube/CheckRules") public reactor.core.publisher.Flux<RuleSyntaxError> checkRules(String name, String rules) tm1.CheckRuleswithRules: compiles rules for the cube without saving them, so they can be checked beforeupdate(String, CubePatch)saves them (which TM1 does even when they don't compile). Needs schema 11.1.0.- Parameters:
name- the cube's namerules- the rules to check- Returns:
- the syntax errors, with line numbers; none if the rules compile
-
traceCellCalculation
@Tm1Endpoint("Action Cube/TraceCellCalculation") @Tm1Endpoint("Navigation CalculationComponent/Cube") @Tm1Endpoint("Navigation CalculationComponent/Tuple") public reactor.core.publisher.Mono<CalculationComponent> traceCellCalculation(String name, Map<String, String> tuple, ODataQuery query) tm1.TraceCellCalculation: how a cell's value is calculated, as a tree of rule and consolidation components. Needs schema 11.1.0.- Parameters:
name- the cube's nametuple- the cell: dimension name to element name, for every dimension of the cube in its order (aLinkedHashMap); each element is in its dimension's same-named hierarchyquery- what to expand of the result, such asComponents,TupleorCube- Returns:
- the calculation's root component
-
traceFeeders
@Tm1Endpoint("Action Cube/TraceFeeders") @Tm1Endpoint("Navigation FedCellDescriptor/Cube") @Tm1Endpoint("Navigation FedCellDescriptor/Tuple") public reactor.core.publisher.Mono<FeederTrace> traceFeeders(String name, Map<String, String> tuple, ODataQuery query) tm1.TraceFeeders: which cells a cell feeds, and the feeder statements that do it. Needs schema 11.1.0.- Parameters:
name- the cube's nametuple- the cell, as fortraceCellCalculation(String, Map, ODataQuery)query- what to expand of the result, such asFedCells/Tuple:FedCellsis a complex property, so TM1 wants a path, not nested options (FedCells($expand=Tuple)gets 400)- Returns:
- the trace
-
checkFeeders
@Tm1Endpoint("Action Cube/CheckFeeders") @Tm1Endpoint("Navigation FedCellDescriptor/Cube") @Tm1Endpoint("Navigation FedCellDescriptor/Tuple") public reactor.core.publisher.Flux<FedCellDescriptor> checkFeeders(String name, Map<String, String> tuple, CheckFeedersSelection selection, ODataQuery query) tm1.CheckFeeders: the cells under a consolidated cell that are fed, not fed, or both, to find missing feeders. Needs schema 11.1.0.- Parameters:
name- the cube's nametuple- the cell, as fortraceCellCalculation(String, Map, ODataQuery)selection- which cells to listquery- what to expand of each cell, such asTupleorCube- Returns:
- the cells, streamed
-