Class LocalizedAttributeService
java.lang.Object
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(String, String, String).
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);
-
Constructor Summary
ConstructorsConstructorDescriptionLocalizedAttributeService(Tm1Session session) A service sending its requests throughsession. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<LocalizedAttributes> create(AttributeOwner owner, LocalizedAttributesPatch translations) POST …/LocalizedAttributes: adds translations for a locale.reactor.core.publisher.Mono<LocalizedAttributes> get(AttributeOwner owner, String locale, ODataQuery query) GET …/LocalizedAttributes('locale').reactor.core.publisher.Flux<LocalizedAttributes> list(AttributeOwner owner, ODataQuery query) GET …/LocalizedAttributes, streamed.
-
Constructor Details
-
LocalizedAttributeService
A service sending its requests throughsession.- Parameters:
session- the session
-
-
Method Details
-
list
@Tm1Endpoint("Navigation Dimension/LocalizedAttributes") @Tm1Endpoint("Navigation Hierarchy/LocalizedAttributes") @Tm1Endpoint("Navigation Element/LocalizedAttributes") @Tm1Endpoint("Navigation Member/LocalizedAttributes") @Tm1Endpoint("Navigation Subset/LocalizedAttributes") @Tm1Endpoint("Navigation Cube/LocalizedAttributes") @Tm1Endpoint("Navigation View/LocalizedAttributes") @Tm1Endpoint("Navigation Process/LocalizedAttributes") @Tm1Endpoint("Navigation Chore/LocalizedAttributes") public reactor.core.publisher.Flux<LocalizedAttributes> list(AttributeOwner owner, ODataQuery query) GET …/LocalizedAttributes, streamed.- Parameters:
owner- whose translationsquery- what to select, filter and order- Returns:
- the owner's translations, one per locale
-
get
@Tm1Endpoint("Navigation Dimension/LocalizedAttributes") @Tm1Endpoint("Navigation Hierarchy/LocalizedAttributes") @Tm1Endpoint("Navigation Element/LocalizedAttributes") @Tm1Endpoint("Navigation Member/LocalizedAttributes") @Tm1Endpoint("Navigation Subset/LocalizedAttributes") @Tm1Endpoint("Navigation Cube/LocalizedAttributes") @Tm1Endpoint("Navigation View/LocalizedAttributes") @Tm1Endpoint("Navigation Process/LocalizedAttributes") @Tm1Endpoint("Navigation Chore/LocalizedAttributes") public reactor.core.publisher.Mono<LocalizedAttributes> get(AttributeOwner owner, String locale, ODataQuery query) GET …/LocalizedAttributes('locale').- Parameters:
owner- whose translationslocale- the locale ID, such asfrquery- what to select- Returns:
- the translations for the locale, or a
Tm1NotFoundExceptionif there are none
-
create
@Tm1Endpoint("Navigation Dimension/LocalizedAttributes") @Tm1Endpoint("Navigation Hierarchy/LocalizedAttributes") @Tm1Endpoint("Navigation Element/LocalizedAttributes") @Tm1Endpoint("Navigation Member/LocalizedAttributes") @Tm1Endpoint("Navigation Subset/LocalizedAttributes") @Tm1Endpoint("Navigation Cube/LocalizedAttributes") @Tm1Endpoint("Navigation View/LocalizedAttributes") @Tm1Endpoint("Navigation Process/LocalizedAttributes") @Tm1Endpoint("Navigation Chore/LocalizedAttributes") public reactor.core.publisher.Mono<LocalizedAttributes> create(AttributeOwner owner, LocalizedAttributesPatch translations) POST …/LocalizedAttributes: adds translations for a locale.- Parameters:
owner- whose translationstranslations- theLocaleIDand the translatedAttributes- Returns:
- the translations as created
-