use of org.molgenis.genomebrowser.meta.GenomeBrowserSettings in project molgenis by molgenis.
the class GenomeBrowserService method getGenomeBrowserTracks.
public Map<String, GenomeBrowserTrack> getGenomeBrowserTracks(EntityType entityType, List<GenomeBrowserAttributes> defaultGenomeBrowserAttributes) {
Map<String, GenomeBrowserTrack> settings = new HashMap<>();
dataService.findAll(GENOMEBROWSERSETTINGS, new QueryImpl<GenomeBrowserSettings>().eq(GenomeBrowserSettingsMetadata.ENTITY, entityType.getIdValue()), GenomeBrowserSettings.class).forEach(referenceSettings -> settings.put(referenceSettings.getIdentifier(), GenomeBrowserTrack.create(referenceSettings)));
if (settings.isEmpty()) {
// if not check if attrs match any default config
Collections.sort(defaultGenomeBrowserAttributes);
for (GenomeBrowserAttributes genomeBrowserAttributes : defaultGenomeBrowserAttributes) {
List<String> attributeNames = Lists.newArrayList(entityType.getAttributeNames());
if (areAllAttributeAvailable(genomeBrowserAttributes, attributeNames)) {
GenomeBrowserTrack genomeBrowserTrack = getDefaultGenomeBrowserSettingsEntity(entityType, genomeBrowserAttributes);
settings.put(genomeBrowserTrack.getId(), genomeBrowserTrack);
break;
}
}
}
return settings;
}
Aggregations