use of org.obiba.mica.micaConfig.domain.HarmonizationStudyConfig in project mica2 by obiba.
the class EntityConfigKeyTranslationService method getCompleteConfigTranslationMap.
public RegexHashMap getCompleteConfigTranslationMap(String serviceTypename, String locale) {
RegexHashMap translationMap = new RegexHashMap();
Translator translator = JsonTranslator.buildSafeTranslator(() -> micaConfigService.getTranslations(locale, false));
beanFieldToTranslationKeyMap.forEach((key, translationKey) -> translationMap.put(key, translator.translate(translationKey)));
switch(serviceTypename) {
case "individual-study":
Optional<StudyConfig> optionalIndividualStudySchemaForm = individualStudyConfigService.findComplete();
Optional<PopulationConfig> optionalPopulationSchemaForm = populationConfigService.findComplete();
Optional<DataCollectionEventConfig> optionalDataCollectionEventSchemaForm = dataCollectionEventConfigService.findComplete();
if (optionalIndividualStudySchemaForm.isPresent()) {
StudyConfig individualStudySchemaForm = optionalIndividualStudySchemaForm.get();
translateSchemaForm(translator, individualStudySchemaForm);
translationMap.putAll(getTranslationMap(individualStudySchemaForm, ""));
}
if (optionalPopulationSchemaForm.isPresent()) {
PopulationConfig populationSchemaForm = optionalPopulationSchemaForm.get();
translateSchemaForm(translator, populationSchemaForm);
translationMap.putAll(getTranslationMap(populationSchemaForm, "^populations\\[\\d+\\]\\."));
}
if (optionalDataCollectionEventSchemaForm.isPresent()) {
DataCollectionEventConfig dataCollectionEventSchemaForm = optionalDataCollectionEventSchemaForm.get();
translateSchemaForm(translator, dataCollectionEventSchemaForm);
translationMap.putAll(getTranslationMap(dataCollectionEventSchemaForm, "^populations\\[\\d+\\]\\.dataCollectionEvents\\[\\d+\\]\\."));
}
break;
case "harmonization-study":
Optional<HarmonizationStudyConfig> optionalHarmonizationStudySchemaForm = harmonizationStudyConfigService.findComplete();
Optional<HarmonizationPopulationConfig> optionalHarmonizationPopulationSchemaForm = harmonizationPopulationConfigService.findComplete();
if (optionalHarmonizationStudySchemaForm.isPresent()) {
HarmonizationStudyConfig harmonizationStudySchemaForm = optionalHarmonizationStudySchemaForm.get();
translateSchemaForm(translator, harmonizationStudySchemaForm);
translationMap.putAll(getTranslationMap(harmonizationStudySchemaForm, ""));
}
if (optionalHarmonizationPopulationSchemaForm.isPresent()) {
HarmonizationPopulationConfig harmonizationPopulationSchemaForm = optionalHarmonizationPopulationSchemaForm.get();
translateSchemaForm(translator, harmonizationPopulationSchemaForm);
translationMap.putAll(getTranslationMap(harmonizationPopulationSchemaForm, "^populations\\[\\d+\\]\\."));
}
break;
case "network":
Optional<NetworkConfig> optionalNetworkSchemaForm = networkConfigService.findComplete();
if (optionalNetworkSchemaForm.isPresent()) {
NetworkConfig networkSchemaForm = optionalNetworkSchemaForm.get();
translateSchemaForm(translator, networkSchemaForm);
translationMap.putAll(getTranslationMap(networkSchemaForm, ""));
}
break;
case "collected-dataset":
Optional<StudyDatasetConfig> optionalStudyDatasetSchemaForm = studyDatasetConfigService.findComplete();
if (optionalStudyDatasetSchemaForm.isPresent()) {
StudyDatasetConfig studyDatasetSchemaForm = optionalStudyDatasetSchemaForm.get();
translateSchemaForm(translator, studyDatasetSchemaForm);
translationMap.putAll(getTranslationMap(studyDatasetSchemaForm, ""));
}
break;
case "harmonized-dataset":
Optional<HarmonizationDatasetConfig> optionalHarmonizationDatasetSchemaForm = harmonizationDatasetConfigService.findComplete();
if (optionalHarmonizationDatasetSchemaForm.isPresent()) {
HarmonizationDatasetConfig harmonizationDatasetSchemaForm = optionalHarmonizationDatasetSchemaForm.get();
translateSchemaForm(translator, harmonizationDatasetSchemaForm);
translationMap.putAll(getTranslationMap(harmonizationDatasetSchemaForm, ""));
}
break;
case "project":
Optional<ProjectConfig> optionalProjectSchemaForm = projectConfigService.findComplete();
if (optionalProjectSchemaForm.isPresent()) {
ProjectConfig projectSchemaForm = optionalProjectSchemaForm.get();
translateSchemaForm(translator, projectSchemaForm);
translationMap.putAll(getTranslationMap(projectSchemaForm, ""));
}
break;
default:
break;
}
return translationMap;
}
use of org.obiba.mica.micaConfig.domain.HarmonizationStudyConfig in project mica2 by obiba.
the class MicaConfigDtos method fromDto.
@NotNull
<T extends EntityConfig> T fromDto(@NotNull Mica.EntityFormDto dto) {
EntityConfig config = null;
switch(dto.getType()) {
case Network:
config = new NetworkConfig();
break;
case Study:
config = new StudyConfig();
break;
case DataCollectionEvent:
config = new DataCollectionEventConfig();
break;
case Population:
config = new PopulationConfig();
break;
case CollectedDataset:
config = new StudyDatasetConfig();
break;
case HarmonizedDataset:
config = new HarmonizationDatasetConfig();
break;
case HarmonizationStudy:
config = new HarmonizationStudyConfig();
break;
case HarmonizationPopulation:
config = new HarmonizationPopulationConfig();
break;
}
config.setSchema(dto.getSchema());
config.setDefinition(dto.getDefinition());
return (T) config;
}
Aggregations