use of org.molgenis.data.meta.model.AttributeMetadata in project molgenis by molgenis.
the class SystemEntityTypeI18nInitializer method initialize.
/**
* Initialize internationalization attributes
*
* @param event application event
*/
public void initialize(ContextRefreshedEvent event) {
ApplicationContext ctx = event.getApplicationContext();
Stream<String> languageCodes = LanguageService.getLanguageCodes();
EntityTypeMetadata entityTypeMeta = ctx.getBean(EntityTypeMetadata.class);
AttributeMetadata attrMetaMeta = ctx.getBean(AttributeMetadata.class);
L10nStringMetaData l10nStringMeta = ctx.getBean(L10nStringMetaData.class);
languageCodes.forEach(languageCode -> {
entityTypeMeta.addAttribute(getI18nAttributeName(EntityTypeMetadata.LABEL, languageCode)).setNillable(true).setLabel("Label (" + languageCode + ')');
entityTypeMeta.addAttribute(getI18nAttributeName(EntityTypeMetadata.DESCRIPTION, languageCode)).setNillable(true).setLabel("Description (" + languageCode + ')').setDataType(TEXT);
attrMetaMeta.addAttribute(getI18nAttributeName(AttributeMetadata.LABEL, languageCode)).setNillable(true).setLabel("Label (" + languageCode + ')');
attrMetaMeta.addAttribute(getI18nAttributeName(AttributeMetadata.DESCRIPTION, languageCode)).setNillable(true).setLabel("Description (" + languageCode + ')').setDataType(TEXT);
l10nStringMeta.addAttribute(languageCode).setNillable(true).setDataType(TEXT);
});
}
Aggregations