diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/resolver-plugins/microscopy.py b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/resolver-plugins/microscopy.py index 43b0700280e2d316bb976fa13909c8e8dc3441e9..046e8c7975c536d0c562991f9d0442c9cbe61d8e 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/resolver-plugins/microscopy.py +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/resolver-plugins/microscopy.py @@ -1 +1,10 @@ acceptor.hideDataSetType("MICROSCOPY_IMG_CONTAINER") +acceptor.hideSampleType("MICROSCOPY_SAMPLE_TYPE") + +acceptor.dataSetSearchCriteriaExtender.append(lambda c, id: extendDataSetSearchCriteriaForMicroscopy(c, id)) + +def extendDataSetSearchCriteriaForMicroscopy(dataSetSearchCriteria, samplePermId): + dataSetSearchCriteria.withOrOperator() + parentsSearchCriteria = dataSetSearchCriteria.withSample().withParents() + parentsSearchCriteria.withType().withCode().thatEquals("MICROSCOPY_EXPERIMENT") + parentsSearchCriteria.withPermId().thatEquals(samplePermId) diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/script.py b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/script.py index d650c1c68d0063187c2a2d47725f2512fb5444b8..428090b2ecd9a4f4decfceb9eb92d23095531a3f 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/script.py +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/script.py @@ -30,6 +30,7 @@ class Acceptor(object): self.hiddenExperimentTypes = {} self.hiddenSampleTypes = {} self.hiddenDataSetTypes = {} + self.dataSetSearchCriteriaExtender = [] def assertValidSection(self, section): if section not in self.sections: @@ -70,7 +71,7 @@ class Acceptor(object): showTerm = "show%s" % item return mainMenue[showTerm] if showTerm in mainMenue else False return False - + def _getGroupPrefix(self, code): groups = filter(lambda group: code.startswith(group), self.mainMenues.keys()) return groups[0] if groups else "GENERAL" @@ -101,6 +102,10 @@ class Acceptor(object): def acceptDataSet(self, dataSet): return dataSet.getType().getCode() not in self.hiddenDataSetTypes + def extendDataSetSearchCriteria(self, dataSetSearchCriteria, samplePermId): + for extender in self.dataSetSearchCriteriaExtender: + extender(dataSetSearchCriteria, samplePermId) + class Settings(object): def __init__(self, inventorySpaces, mainMenues, sampleTypeViewAttributes): self.inventorySpaces = inventorySpaces @@ -294,6 +299,8 @@ def addExperimentChildNodes(path, experimentPermId, response, acceptor, context) def addSampleChildNodes(path, samplePermId, response, acceptor, context): dataSetSearchCriteria = DataSetSearchCriteria() dataSetSearchCriteria.withSample().withPermId().thatEquals(samplePermId) + acceptor.extendDataSetSearchCriteria(dataSetSearchCriteria, samplePermId) + listDataSets(path, dataSetSearchCriteria, True, response, acceptor, context) fetchOptions = SampleFetchOptions() @@ -339,6 +346,8 @@ def listDataSets(path, dataSetSearchCriteria, assignedToSample, response, accept fetchOptions.withProperties() fetchOptions.withSample() dataSets = context.getApi().searchDataSets(context.getSessionToken(), dataSetSearchCriteria, fetchOptions).getObjects() + print(">>>> data set search criteria: %s" % dataSetSearchCriteria) + print(">>>> data sets: %s" % dataSets) entitiesByName = {} for dataSet in dataSets: sample = dataSet.getSample()