skipcheck

TM1 client · Docs · More services

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 Annotations lists none, even with annotations made. They're found by cube (cubeAnnotations), by cell (cellAnnotations), or by ID.
  • An annotation's ApplicationContext reads back empty, though the facet value given when it was made exists (facetValues).
  • Besides Text, an annotation carries properties $metadata doesn't declare (Annotation is an open type): objectName (the cube), commentValue, commentType and commentLocation (the cell's elements, comma-separated). They're in dynamicProperties.
  • 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 constructorA service sending its requests through session.
listGET Annotations, streamed.
getGET Annotations('id').
createAnnotates one cell, the way Planning Analytics Workspace does.
createPOST Annotations, for an annotation built by hand.
updatePATCH Annotations('id').
deleteDELETE Annotations('id').
applicationContextApplicationContext, streamed.
dimensionalContextDimensionalContext, streamed.
attachmentsAttachments, streamed.
cubeAnnotationsCubes('c')/Annotations, streamed.
cellAnnotationsCellsets('id')/Cells(n)/Annotations, streamed.
facetsGET ApplicationContextFacets, streamed, such as Cubes}.
facetValuesA facet's Values, streamed.
facetA facet value's Facet.
deleteAnnotationArtifactsRemoves every annotation in the model, with their facet values, attachments and control cubes.

AnnotationService

constructor
AnnotationService(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 Tm1NotFoundException if it's gone, or a Tm1BadRequestException for 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 LastUpdatedBy and LastUpdated

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.