AnnotationService
import 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), by cell (cellAnnotations), or by ID.- An annotation's
ApplicationContextreads back empty, though the facet value given when it was made exists (facetValues). - 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());
Members
AnnotationService constructor | A service sending its requests through session. |
list | GET Annotations, streamed. |
get | GET Annotations('id'). |
create | Annotates one cell, the way Planning Analytics Workspace does. |
create | POST Annotations, for an annotation built by hand. |
update | PATCH Annotations('id'). |
delete | DELETE Annotations('id'). |
applicationContext | ApplicationContext, streamed. |
dimensionalContext | DimensionalContext, streamed. |
attachments | Attachments, streamed. |
cubeAnnotations | Cubes('c')/Annotations, streamed. |
cellAnnotations | Cellsets('id')/Cells(n)/Annotations, streamed. |
facets | GET ApplicationContextFacets, streamed, such as Cubes}. |
facetValues | A facet's Values, streamed. |
facet | A facet value's Facet. |
deleteAnnotationArtifacts | Removes every annotation in the model, with their facet values, attachments and control cubes. |
AnnotationService
constructorAnnotationService(Tm1Session session) A service sending its requests through session.
Parameters
session- the session
list
Flux<Annotation> list(ODataQuery query) GET Annotations, streamed. TM1 (11.8) lists none here: use
cubeAnnotations or cellAnnotations.
Parameters
query- what to select, expand and filter
Returns
- the annotations
TM1 REST EntitySet Annotations
get
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 a
Tm1BadRequestException (400, code 248, "Invalid annotation id!").
Parameters
id- the annotation's ID
query- what to select and expand
Returns
- the annotation; a
Tm1NotFoundExceptionif it's gone, or aTm1BadRequestExceptionfor an ID that was never TM1's
TM1 REST EntitySet Annotations
create
Mono<Annotation> create(String cube, Map<String,String> elements, String text) Annotates one cell, the way Planning Analytics Workspace does: Text and
commentValue are the text, the Cubes} facet names the cube, and the
dimensional context binds the cell's members.
Parameters
cube- the cube
elements- the cell's element in each dimension's same-named hierarchy, by dimension, in the cube's dimension order
text- what the annotation says
Returns
- the annotation, with its ID
TM1 REST EntitySet Annotations
create
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
TM1 REST EntitySet Annotations
update
Mono<Void> update(String id, AnnotationPatch patch) PATCH Annotations('id'). To change what it says, set both Text and
the commentValue property: TM1 keeps them apart.
Parameters
id- the annotation's ID
patch- what to change
Returns
- completes when it's changed; TM1 records
LastUpdatedByandLastUpdated
TM1 REST EntitySet Annotations
delete
Mono<Void> delete(String id) DELETE Annotations('id').
Parameters
id- the annotation's ID
Returns
- completes when it's gone
TM1 REST EntitySet Annotations
applicationContext
Flux<ApplicationContextFacetValue> applicationContext(String id, ODataQuery query) ApplicationContext, streamed. TM1 (11.8) returns none.
Parameters
id- the annotation's ID
query- what to select and expand, such as
Facet
Returns
- the facet values
TM1 REST Navigation Annotation/ApplicationContext
dimensionalContext
Flux<Member> dimensionalContext(String id, ODataQuery query) DimensionalContext, streamed: the members of the annotated cell.
Parameters
id- the annotation's ID
query- what to select
Returns
- the members
TM1 REST Navigation Annotation/DimensionalContext
attachments
Flux<Attachment> attachments(String id, ODataQuery query) Attachments, streamed: documents attached to the annotation.
Parameters
id- the annotation's ID
query- what to select
Returns
- the attachments
TM1 REST Navigation Annotation/Attachments
cubeAnnotations
Flux<Annotation> cubeAnnotations(String cube, ODataQuery query) Cubes('c')/Annotations, streamed: a cube's annotations.
Parameters
cube- the cube
query- what to select, expand and filter
Returns
- the annotations
TM1 REST Navigation Cube/Annotations
cellAnnotations
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 by expand("Annotations").
Parameters
cellset- the cellset's ID
ordinal- the cell's ordinal
query- what to select
Returns
- the annotations
TM1 REST Navigation CellsetCell/Annotations
facets
Flux<ApplicationContextFacet> facets(ODataQuery query) GET ApplicationContextFacets, streamed, such as Cubes}.
Parameters
query- what to select and expand, such as
Values
Returns
- the facets
TM1 REST EntitySet ApplicationContextFacets
facetValues
Flux<ApplicationContextFacetValue> facetValues(String facet, ODataQuery query) A facet's Values, streamed: for Cubes}, the cubes with annotations.
Parameters
facet- the facet's name
query- what to select
Returns
- the values
TM1 REST Navigation ApplicationContextFacet/Values
facet
Mono<ApplicationContextFacet> facet(String facet, String value, ODataQuery query) A facet value's Facet.
Parameters
facet- the facet's name
value- the value
query- what to select
Returns
- the facet
TM1 REST Navigation ApplicationContextFacetValue/Facet
deleteAnnotationArtifacts
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
TM1 REST ActionImport DeleteAnnotationArtifacts
Also in the Javadoc.