use of org.obiba.mica.core.domain.LocalizedString in project mica2 by obiba.
the class CollectedDatasetServiceTest method buildStudyDataset.
private StudyDataset buildStudyDataset() {
StudyDataset ds = new StudyDataset();
StudyTable st = new StudyTable();
st.setProject("proj");
st.setTable("tab");
ds.setStudyTable(st);
ds.setName(new LocalizedString(Locale.CANADA, "test"));
return ds;
}
use of org.obiba.mica.core.domain.LocalizedString in project mica2 by obiba.
the class HarmonizedDatasetServiceTest method buildHarmonizationDataset.
private HarmonizationDataset buildHarmonizationDataset(String id, StudyTable... studyTables) {
HarmonizationDataset ds = new HarmonizationDataset();
for (StudyTable s : studyTables) {
ds.addStudyTable(s);
}
ds.setId(id);
ds.setName(new LocalizedString(Locale.CANADA, "dataset" + id));
return ds;
}
use of org.obiba.mica.core.domain.LocalizedString in project mica2 by obiba.
the class DataAccessResource method getDataAccessForm.
@GET
@Path("/form")
@Timed
public Mica.DataAccessFormDto getDataAccessForm(@QueryParam("lang") String lang) {
Optional<DataAccessForm> d = dataAccessFormService.find();
if (!d.isPresent())
throw NoSuchDataAccessFormException.withDefaultMessage();
DataAccessForm dataAccessForm = d.get();
Mica.DataAccessFormDto.Builder builder = Mica.DataAccessFormDto.newBuilder(dtos.asDto(dataAccessForm)).clearProperties().clearPdfTemplates();
String langTag = !Strings.isNullOrEmpty(lang) ? Locale.forLanguageTag(lang).toLanguageTag() : LanguageTag.UNDETERMINED;
Map<String, LocalizedString> properties = dataAccessForm.getProperties().entrySet().stream().map(e -> Maps.immutableEntry(e.getKey(), new LocalizedString().forLanguageTag(langTag, e.getValue().get(langTag)))).collect(toMap(Map.Entry::getKey, Map.Entry::getValue));
builder.addAllProperties(dtos.asDtoList(properties));
return builder.build();
}
use of org.obiba.mica.core.domain.LocalizedString in project mica2 by obiba.
the class NetworkService method getNextId.
private String getNextId(LocalizedString suggested) {
if (suggested == null)
return null;
String prefix = suggested.asUrlSafeString().toLowerCase();
if (Strings.isNullOrEmpty(prefix))
return null;
String next = prefix;
try {
findById(next);
for (int i = 1; i <= 1000; i++) {
next = prefix + "-" + i;
findById(next);
}
return null;
} catch (NoSuchNetworkException e) {
return next;
}
}
use of org.obiba.mica.core.domain.LocalizedString in project mica2 by obiba.
the class ConfigurationTaxonomyMetaDataProvider method populateMetadataMap.
private Map<String, LocalizedMetaData> populateMetadataMap(Vocabulary vocabulary) {
Map<String, LocalizedMetaData> metaData = Maps.newHashMap();
if (vocabulary != null && vocabulary.hasTerms()) {
vocabulary.getTerms().forEach(t -> {
LocalizedString title = new LocalizedString();
title.putAll(t.getTitle());
LocalizedString description = new LocalizedString();
description.putAll(t.getDescription());
String className = t.getAttributeValue("className");
if (Strings.isNullOrEmpty(className)) {
className = t.getClass().getSimpleName();
}
LocalizedMetaData md = new LocalizedMetaData(title, description, className, t.getAttributeValue("start"), t.getAttributeValue("end"));
metaData.put(t.getName(), md);
metaData.put(t.getName().toLowerCase(), md);
});
}
return metaData;
}
Aggregations