private DataSet getDataSetForWorkFlowElement(Integer workflowElementId) { // get data set for the given workflow element Protocol protocol = dataService.findOne(Protocol.ENTITY_NAME, workflowElementId, Protocol.class); Iterable<DataSet> dataSets = dataService.findAll(DataSet.ENTITY_NAME, new QueryImpl().eq(DataSet.PROTOCOLUSED, protocol), DataSet.class); if (Iterables.size(dataSets) != 1) throw new RuntimeException("Workflow element must have exactly one data set"); return dataSets.iterator().next(); } }
private Stream<GenomeBrowserAttributes> getDefaultGenomeBrowserAttributes() { return dataService.findAll( GenomeBrowserAttributesMetadata.GENOMEBROWSERATTRIBUTES, new QueryImpl<GenomeBrowserAttributes>().eq(GenomeBrowserAttributesMetadata.DEFAULT, true), GenomeBrowserAttributes.class); }
@Override public Entity getOntologyEntity(String ontologyIri) { return dataService.findOne( ONTOLOGY, new QueryImpl<>().eq(OntologyMetaData.ONTOLOGY_IRI, ontologyIri)); }
@Override public StyleSheet findThemeByName(String themeName) { Query<StyleSheet> findByName = new QueryImpl<StyleSheet>().eq(StyleSheetMetadata.NAME, themeName); return dataService.findOne(StyleSheetMetadata.STYLE_SHEET, findByName, StyleSheet.class); }
@Override public CatalogItem findItem(String catalogItemId) { // TODO verify that the catalog item is part of this catalog. // this check was removed because of bad performance (worst case the full protocol tree needs to be pruned). ObservableFeature observableFeature = dataService.findOne(ObservableFeature.ENTITY_NAME, new QueryImpl().eq(ObservableFeature.ID, catalogItemId), ObservableFeature.class); if (observableFeature == null) throw new IllegalArgumentException("catalogItemId does not exist"); return new OmxCatalogItem(observableFeature); } }
@Override public Stream<AlgorithmTemplate> find(Map<Attribute, ExplainedAttribute> attrMatches) { // get all algorithm templates Stream<Script> jsScripts = dataService .findAll(SCRIPT, new QueryImpl<Script>().eq(TYPE, JsMagmaScriptRunner.NAME), Script.class); // select all algorithm templates that can be used with target and sources return jsScripts.flatMap(script -> toAlgorithmTemplate(script, attrMatches)); }
@Override public Stream<AlgorithmTemplate> find(Hits<ExplainedAttribute> attrMatches) { // get all algorithm templates Stream<Script> jsScripts = dataService.findAll( SCRIPT, new QueryImpl<Script>().eq(TYPE, JsMagmaScriptRunner.NAME), Script.class); // select all algorithm templates that can be used with target and sources return jsScripts.flatMap(script -> toAlgorithmTemplate(script, attrMatches)); }
@Override public void loadCatalogOfStudyDefinition(String id) throws UnknownCatalogException, UnknownStudyDefinitionException { StudyDataRequest studyDataRequest = dataService.findOne(StudyDataRequest.ENTITY_NAME, new QueryImpl().eq(StudyDataRequest.ID, Integer.valueOf(id)), StudyDataRequest.class); if (studyDataRequest == null) throw new UnknownStudyDefinitionException("Study definition [" + id + "] does not exist"); Protocol protocol = dataService.findOne(Protocol.ENTITY_NAME, new QueryImpl().eq(Protocol.ID, id), Protocol.class); if (protocol == null) throw new UnknownCatalogException("No catalog defined for study definition [" + id + "]"); setProtocolActive(protocol, true); }
private boolean viewExists(String viewName) { Queryable templateRepository = dataService.getQueryableRepository(FreemarkerTemplate.ENTITY_NAME); return templateRepository.count(new QueryImpl().eq("Name", viewName + ".ftl")) > 0; }
@RequestMapping(method = RequestMethod.POST, value = "/attribute", produces = APPLICATION_JSON_VALUE) @ResponseBody public SearchResult getOneAttribute(@RequestBody String featureId) { return searchService.search(new SearchRequest(null, new QueryImpl().eq(ObservableFeature.ID, featureId).and() .eq("type", "observablefeature"), null)); }
private String getOntologyTermNodePath(OntologyTerm ontologyTerm) { Entity ontologyTermEntity = dataService.findOne( ONTOLOGY_TERM, new QueryImpl<>().eq(ONTOLOGY_TERM_IRI, ontologyTerm.getIRI())); Iterable<Entity> ontologyTermNodePathEntities = ontologyTermEntity.getEntities(OntologyTermMetaData.ONTOLOGY_TERM_NODE_PATH); return ontologyTermNodePathEntities .iterator() .next() .getString(OntologyTermNodePathMetaData.NODE_PATH); }
@Override public boolean isCatalogActivated(String id) throws UnknownCatalogException { Protocol protocol = dataService.findOne(Protocol.ENTITY_NAME, new QueryImpl().eq(Protocol.ID, id), Protocol.class); if (protocol == null) throw new UnknownCatalogException("Catalog [" + id + "] does not exist"); return protocol.getActive(); }
public Hit findOntologyTerm(String ontologyIri, String ontologyTermIri, String nodePath) { Query q = new QueryImpl().eq(OntologyTermIndexRepository.NODE_PATH, nodePath).and() .eq(OntologyTermIndexRepository.ONTOLOGY_TERM_IRI, ontologyTermIri).pageSize(5000); String documentType = AsyncOntologyIndexer.createOntologyTermDocumentType(ontologyIri); SearchResult result = searchService.search(new SearchRequest(documentType, q, null)); for (Hit hit : result.getSearchHits()) { if (hit.getColumnValueMap().get(OntologyTermIndexRepository.NODE_PATH).toString().equals(nodePath)) return hit; } return new Hit(null, documentType, Collections.<String, Object> emptyMap()); }
@Override public void loadCatalog(String id) throws UnknownCatalogException { Protocol protocol = dataService.findOne(Protocol.ENTITY_NAME, new QueryImpl().eq(Protocol.ID, id), Protocol.class); if (protocol == null) throw new UnknownCatalogException("Catalog [" + id + "] does not exist"); setProtocolActive(protocol, true); }
@Override public void activateCatalog(String id) throws UnknownCatalogException { Protocol protocol = dataService.findOne(Protocol.ENTITY_NAME, new QueryImpl().eq(Protocol.ID, id), Protocol.class); if (protocol == null) throw new UnknownCatalogException("Catalog [" + id + "] does not exist"); setProtocolActive(protocol, true); } }
@Override public boolean isCatalogLoaded(String id) throws UnknownCatalogException { Protocol protocol = dataService.findOne(Protocol.ENTITY_NAME, new QueryImpl().eq(Protocol.ID, id), Protocol.class); if (protocol == null) throw new UnknownCatalogException("Catalog [" + id + "] does not exist"); return protocol.getActive(); }
@Override public void deactivateCatalog(String id) throws UnknownCatalogException { Protocol protocol = dataService.findOne(Protocol.ENTITY_NAME, new QueryImpl().eq(Protocol.ID, id), Protocol.class); if (protocol == null) throw new UnknownCatalogException("Catalog [" + id + "] does not exist"); setProtocolActive(protocol, false); }
@Override public Catalog getCatalogOfStudyDefinition(String id) throws UnknownCatalogException, UnknownStudyDefinitionException { StudyDataRequest studyDataRequest = dataService.findOne(StudyDataRequest.ENTITY_NAME, new QueryImpl().eq(StudyDataRequest.ID, Integer.valueOf(id)), StudyDataRequest.class); if (studyDataRequest == null) throw new UnknownStudyDefinitionException("Study definition [" + id + "] does not exist"); Protocol protocol = studyDataRequest.getProtocol(); if (protocol == null) throw new UnknownCatalogException("Catalog [" + id + "] does not exist"); return new OmxCatalog(protocol, dataService); }
public StoreMappingRepository(DataSet dataSet, DataService dataService) { super("mapping://" + dataSet.getIdentifier()); this.dataSet = dataSet; Iterable<ObservationSet> observationSets = dataService.findAll(ObservationSet.ENTITY_NAME, new QueryImpl().eq(ObservationSet.PARTOFDATASET, dataSet), ObservationSet.class); observedValues = dataService.findAll(ObservedValue.ENTITY_NAME, new QueryImpl().in(ObservedValue.OBSERVATIONSET, Lists.newArrayList(observationSets)), ObservedValue.class); valueConverter = new ValueConverter(dataService); }
@Override public Entity findOneById(Object id, Fetch fetch) { if (id == null) { return null; } return findOne(new QueryImpl<>().eq(entityType.getIdAttribute().getName(), id).fetch(fetch)); }