Class AnnotationService
java.lang.Object
io.skipcheck.tm1.client.service.annotation.AnnotationService
Annotations: comments on cube cells, as Planning Analytics Workspace makes them, and
the application context facets that tie them to cubes.
What TM1 (11.8) does here that you might not expect:
GET Annotationslists none, even with annotations made. They're found by cube (cubeAnnotations(String, ODataQuery)), by cell (cellAnnotations(String, long, ODataQuery)), or by ID.- An annotation's
ApplicationContextreads back empty, though the facet value given when it was made exists (facetValues(String, ODataQuery)). - Besides
Text, an annotation carries properties$metadatadoesn't declare (Annotationis an open type):objectName(the cube),commentValue,commentTypeandcommentLocation(the cell's elements, comma-separated). They're indynamicProperties. - IDs look like
C}ClientGroups~B.B~7uA_4TxLwG.
Comment on a cell:
// A comment on one cell, as Planning Analytics Workspace makes it: the cell's
// elements by dimension, in the cube's dimension order
Map<String, String> cell = new LinkedHashMap<>();
cell.put("Version", "Forecast");
cell.put("Region", "North");
cell.put("Measure", "Amount");
return tm1.annotations().create("Sales", cell, "Includes the March promotion");
Read a cube's comments:
// GET Annotations lists none on TM1 11.8, so read them by cube
return tm1.annotations()
.cubeAnnotations("Sales", ODataQuery.none())
.map(annotation -> annotation.creator() + ": " + annotation.text());
Change what a comment says:
// TM1 keeps Text and the commentValue PAW shows apart, so change both
String text = "Includes the March and April promotions";
return tm1.annotations()
.update(id, AnnotationPatch.builder().text(text).property("commentValue", text).build());
-
Constructor Summary
ConstructorsConstructorDescriptionAnnotationService(Tm1Session session) A service sending its requests throughsession. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Flux<ApplicationContextFacetValue> applicationContext(String id, ODataQuery query) ApplicationContext, streamed.reactor.core.publisher.Flux<Attachment> attachments(String id, ODataQuery query) Attachments, streamed: documents attached to the annotation.reactor.core.publisher.Flux<Annotation> cellAnnotations(String cellset, long ordinal, ODataQuery query) Cellsets('id')/Cells(n)/Annotations, streamed: one cellset cell's annotations.reactor.core.publisher.Mono<Annotation> create(AnnotationPatch annotation) POST Annotations, for an annotation built by hand.reactor.core.publisher.Mono<Annotation> Annotates one cell, the way Planning Analytics Workspace does:TextandcommentValueare the text, the Cubes} facet names the cube, and the dimensional context binds the cell's members.reactor.core.publisher.Flux<Annotation> cubeAnnotations(String cube, ODataQuery query) Cubes('c')/Annotations, streamed: a cube's annotations.reactor.core.publisher.Mono<Void> DELETE Annotations('id').reactor.core.publisher.Mono<Void> DeleteAnnotationArtifacts: removes every annotation in the model, with their facet values, attachments and control cubes.reactor.core.publisher.Flux<Member> dimensionalContext(String id, ODataQuery query) DimensionalContext, streamed: the members of the annotated cell.reactor.core.publisher.Mono<ApplicationContextFacet> facet(String facet, String value, ODataQuery query) A facet value'sFacet.reactor.core.publisher.Flux<ApplicationContextFacet> facets(ODataQuery query) GET ApplicationContextFacets, streamed, such as Cubes}.reactor.core.publisher.Flux<ApplicationContextFacetValue> facetValues(String facet, ODataQuery query) A facet'sValues, streamed: for Cubes}, the cubes with annotations.reactor.core.publisher.Mono<Annotation> get(String id, ODataQuery query) GET Annotations('id').reactor.core.publisher.Flux<Annotation> list(ODataQuery query) GET Annotations, streamed.reactor.core.publisher.Mono<Void> update(String id, AnnotationPatch patch) PATCH Annotations('id').
-
Constructor Details
-
AnnotationService
A service sending its requests throughsession.- Parameters:
session- the session
-
-
Method Details
-
list
@Tm1Endpoint("EntitySet Annotations") public reactor.core.publisher.Flux<Annotation> list(ODataQuery query) GET Annotations, streamed. TM1 (11.8) lists none here: usecubeAnnotations(String, ODataQuery)orcellAnnotations(String, long, ODataQuery).- Parameters:
query- what to select, expand and filter- Returns:
- the annotations
-
get
@Tm1Endpoint("EntitySet Annotations") public reactor.core.publisher.Mono<Annotation> get(String id, ODataQuery query) GET Annotations('id'). TM1 (11.8) answers 404 only for an ID it once gave out, such as a deleted annotation's. Any other text is refused as aTm1BadRequestException(400, code 248, "Invalid annotation id!").- Parameters:
id- the annotation's IDquery- what to select and expand- Returns:
- the annotation; a
Tm1NotFoundExceptionif it's gone, or aTm1BadRequestExceptionfor an ID that was never TM1's
-
create
@Tm1Endpoint("EntitySet Annotations") public reactor.core.publisher.Mono<Annotation> create(String cube, Map<String, String> elements, String text) Annotates one cell, the way Planning Analytics Workspace does:TextandcommentValueare the text, the Cubes} facet names the cube, and the dimensional context binds the cell's members.- Parameters:
cube- the cubeelements- the cell's element in each dimension's same-named hierarchy, by dimension, in the cube's dimension ordertext- what the annotation says- Returns:
- the annotation, with its ID
-
create
@Tm1Endpoint("EntitySet Annotations") public reactor.core.publisher.Mono<Annotation> create(AnnotationPatch annotation) POST Annotations, for an annotation built by hand.- Parameters:
annotation- the annotation- Returns:
- the annotation as made, with its ID
-
update
@Tm1Endpoint("EntitySet Annotations") public reactor.core.publisher.Mono<Void> update(String id, AnnotationPatch patch) PATCH Annotations('id'). To change what it says, set bothTextand thecommentValueproperty: TM1 keeps them apart.- Parameters:
id- the annotation's IDpatch- what to change- Returns:
- completes when it's changed; TM1 records
LastUpdatedByandLastUpdated
-
delete
DELETE Annotations('id').- Parameters:
id- the annotation's ID- Returns:
- completes when it's gone
-
applicationContext
@Tm1Endpoint("Navigation Annotation/ApplicationContext") public reactor.core.publisher.Flux<ApplicationContextFacetValue> applicationContext(String id, ODataQuery query) ApplicationContext, streamed. TM1 (11.8) returns none.- Parameters:
id- the annotation's IDquery- what to select and expand, such asFacet- Returns:
- the facet values
-
dimensionalContext
@Tm1Endpoint("Navigation Annotation/DimensionalContext") public reactor.core.publisher.Flux<Member> dimensionalContext(String id, ODataQuery query) DimensionalContext, streamed: the members of the annotated cell.- Parameters:
id- the annotation's IDquery- what to select- Returns:
- the members
-
attachments
@Tm1Endpoint("Navigation Annotation/Attachments") public reactor.core.publisher.Flux<Attachment> attachments(String id, ODataQuery query) Attachments, streamed: documents attached to the annotation.- Parameters:
id- the annotation's IDquery- what to select- Returns:
- the attachments
-
cubeAnnotations
@Tm1Endpoint("Navigation Cube/Annotations") public reactor.core.publisher.Flux<Annotation> cubeAnnotations(String cube, ODataQuery query) Cubes('c')/Annotations, streamed: a cube's annotations.- Parameters:
cube- the cubequery- what to select, expand and filter- Returns:
- the annotations
-
cellAnnotations
@Tm1Endpoint("Navigation CellsetCell/Annotations") public reactor.core.publisher.Flux<Annotation> cellAnnotations(String cellset, long ordinal, ODataQuery query) Cellsets('id')/Cells(n)/Annotations, streamed: one cellset cell's annotations. They also come with the cells byexpand("Annotations").- Parameters:
cellset- the cellset's IDordinal- the cell's ordinalquery- what to select- Returns:
- the annotations
-
facets
@Tm1Endpoint("EntitySet ApplicationContextFacets") public reactor.core.publisher.Flux<ApplicationContextFacet> facets(ODataQuery query) GET ApplicationContextFacets, streamed, such as Cubes}.- Parameters:
query- what to select and expand, such asValues- Returns:
- the facets
-
facetValues
@Tm1Endpoint("Navigation ApplicationContextFacet/Values") public reactor.core.publisher.Flux<ApplicationContextFacetValue> facetValues(String facet, ODataQuery query) A facet'sValues, streamed: for Cubes}, the cubes with annotations.- Parameters:
facet- the facet's namequery- what to select- Returns:
- the values
-
facet
@Tm1Endpoint("Navigation ApplicationContextFacetValue/Facet") public reactor.core.publisher.Mono<ApplicationContextFacet> facet(String facet, String value, ODataQuery query) A facet value'sFacet.- Parameters:
facet- the facet's namevalue- the valuequery- what to select- Returns:
- the facet
-
deleteAnnotationArtifacts
@Tm1Endpoint("ActionImport DeleteAnnotationArtifacts") public reactor.core.publisher.Mono<Void> deleteAnnotationArtifacts()DeleteAnnotationArtifacts: removes every annotation in the model, with their facet values, attachments and control cubes. It can't be undone.- Returns:
- completes when they're gone
-