use of org.molgenis.data.meta.model.EntityTypeMetadata 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);
});
}
use of org.molgenis.data.meta.model.EntityTypeMetadata in project molgenis by molgenis.
the class SystemEntityTypeInitializer method initialize.
public void initialize(ContextRefreshedEvent event) {
ApplicationContext ctx = event.getApplicationContext();
ctx.getBeansOfType(SystemPackage.class).values().forEach(SystemPackage::bootstrap);
EntityTypeMetadata entityTypeMetaData = ctx.getBean(EntityTypeMetadata.class);
ctx.getBean(AttributeMetadata.class).bootstrap(entityTypeMetaData);
// TODO: doesn't this mean all attributes get added twice?
Map<String, SystemEntityType> systemEntityTypeMap = ctx.getBeansOfType(SystemEntityType.class);
genericDependencyResolver.resolve(systemEntityTypeMap.values(), SystemEntityType::getDependencies).forEach(systemEntityType -> initialize(systemEntityType, entityTypeMetaData));
}
use of org.molgenis.data.meta.model.EntityTypeMetadata in project molgenis by molgenis.
the class AbstractMolgenisSpringTest method abstractMolgenisSpringTestBeforeClass.
// long method name, because if a method annotated with @BeforeClass and the same method name exists in a subclass then this method is ignored.
@BeforeClass
public void abstractMolgenisSpringTestBeforeClass() {
// bootstrap meta data
EntityTypeMetadata entityTypeMeta = applicationContext.getBean(EntityTypeMetadata.class);
entityTypeMeta.setBackendEnumOptions(newArrayList("test"));
applicationContext.getBean(AttributeMetadata.class).bootstrap(entityTypeMeta);
Map<String, SystemEntityType> systemEntityTypeMap = applicationContext.getBeansOfType(SystemEntityType.class);
new GenericDependencyResolver().resolve(systemEntityTypeMap.values(), SystemEntityType::getDependencies).forEach(systemEntityType -> systemEntityType.bootstrap(entityTypeMeta));
}
Aggregations