skipcheck

TM1 client · Docs · Dimensions and hierarchies

LocalizedAttributeService

import io.skipcheck.tm1.client.service.attribute.LocalizedAttributeService;

Translated attribute values: an AttributeOwner's LocalizedAttributes, one per locale, keyed by locale ID (fr, de-CH). The values are in Attributes: Caption, and every other attribute in its dynamicProperties (set with AttributesPatch.Builder#property).

Only attributes the owner's kind has can be translated (see AttributeService): Caption too, once it's defined. A member's translations are its element's, and read only: write them through AttributeOwner.element.

TM1 (11.8) creates a locale's translations once and reads them, and that's all: it supports no PATCH or DELETE on them and refuses to create a locale twice. Changing or removing translations goes through the }Localized…Attributes control cubes, as cell writes.

Translate an element's attribute into French:

// The French for an element's Long Name, an attribute its hierarchy has. A
// locale's translations are created once: TM1 can't change them here.
return tm1.localizedAttributes()
    .create(AttributeOwner.element("Region", "Region", "North"),
            LocalizedAttributesPatch.builder()
                .localeID("fr")
                .attributes(AttributesPatch.builder().property("Long Name", "Région Nord").build())
                .build());

Read the translation back:

// Attributes other than Caption come back in dynamicProperties
return tm1.localizedAttributes()
    .get(AttributeOwner.element("Region", "Region", "North"), "fr", ODataQuery.none())
    .mapNotNull(LocalizedAttributes::attributes)
    .mapNotNull(Attributes::dynamicProperties)
    .mapNotNull(values -> values.get("Long Name"))
    .map(JsonNode::asString);

Members

LocalizedAttributeService constructorA service sending its requests through session.
listGET …/LocalizedAttributes, streamed.
getGET …/LocalizedAttributes('locale').
createAdds translations for a locale.

LocalizedAttributeService

constructor
LocalizedAttributeService(Tm1Session session)

A service sending its requests through session.

Parameters

session
the session

list

Flux<LocalizedAttributes> list(AttributeOwner owner, ODataQuery query)

GET …/LocalizedAttributes, streamed.

Parameters

owner
whose translations
query
what to select, filter and order

Returns

the owner's translations, one per locale

get

Mono<LocalizedAttributes> get(AttributeOwner owner, String locale, ODataQuery query)

GET …/LocalizedAttributes('locale').

Parameters

owner
whose translations
locale
the locale ID, such as fr
query
what to select

Returns

the translations for the locale, or a Tm1NotFoundException if there are none

create

Mono<LocalizedAttributes> create(AttributeOwner owner, LocalizedAttributesPatch translations)

POST …/LocalizedAttributes: adds translations for a locale.

Parameters

owner
whose translations
translations
the LocaleID and the translated Attributes

Returns

the translations as created

Also in the Javadoc.