diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims-life-sciences/1/as/master-data/data-model.xls b/openbis_standard_technologies/dist/core-plugins/eln-lims-life-sciences/1/as/master-data/data-model.xls index fcb9ea57fb21fb635024372cb7a862d01a076864..e48c6791cc01af5e22d312990581b33b826836ad 100644 Binary files a/openbis_standard_technologies/dist/core-plugins/eln-lims-life-sciences/1/as/master-data/data-model.xls and b/openbis_standard_technologies/dist/core-plugins/eln-lims-life-sciences/1/as/master-data/data-model.xls differ diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/compatibility/genetic_modifications.py b/openbis_standard_technologies/dist/core-plugins/eln-lims-life-sciences/1/as/master-data/scripts/genetic_modifications.py similarity index 92% rename from openbis_standard_technologies/dist/core-plugins/eln-lims/1/compatibility/genetic_modifications.py rename to openbis_standard_technologies/dist/core-plugins/eln-lims-life-sciences/1/as/master-data/scripts/genetic_modifications.py index b91679ab633450063cacdf52d6c25a0665026535..0739e95afae19df1d4f32dd1f3cd6dde25c2d7fd 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/compatibility/genetic_modifications.py +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims-life-sciences/1/as/master-data/scripts/genetic_modifications.py @@ -37,7 +37,7 @@ def calculate(): parentCode = parent.code() #Add the code annotationMap = getAnnotationsForParent(parent, child) - if(annotationMap["PLASMID_RELATIONSHIP"] == "LOT"): + if(annotationMap["ANNOTATION.SYSTEM.PLASMID_RELATIONSHIP"] == "LOT"): newLostList.append(parent.entityPE().getPermId()) elif parent.entityPE().getPermId() not in lostList: #Check if is the first to add the separator or not @@ -58,16 +58,16 @@ def calculate(): return genotypeResult def getAnnotationString(annotationMap): - return annotationMap["PLASMID_RELATIONSHIP"] + " " + annotationMap["PLASMID_ANNOTATION"] + return annotationMap["ANNOTATION.SYSTEM.PLASMID_RELATIONSHIP"] + " " + annotationMap["ANNOTATION.SYSTEM.PLASMID_ANNOTATION"] def getAnnotationsForParent(parent, child): permId = parent.entityPE().getPermId() annotations = child.propertyValue("ANNOTATIONS_STATE") if (annotations is not None) and ('<root' in annotations): - relationshipValue = getAnnotationFromPermId(annotations, permId, "PLASMID_RELATIONSHIP") + relationshipValue = getAnnotationFromPermId(annotations, permId, "ANNOTATION.SYSTEM.PLASMID_RELATIONSHIP") if relationshipValue is None: relationshipValue = "None" - annotationValue = getAnnotationFromPermId(annotations, permId, "PLASMID_ANNOTATION"); + annotationValue = getAnnotationFromPermId(annotations, permId, "ANNOTATION.SYSTEM.PLASMID_ANNOTATION"); if annotationValue is None: annotationValue = "" annotation = "\"" + str(annotationValue) + "\"" diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/index.html b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/index.html index cd590405472230bace23c04fdde815f7c8bc0a64..50c5bd15300539b9a6c12b3c8401367046e21d70 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/index.html +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/index.html @@ -262,7 +262,7 @@ <script type="text/javascript" src="./js/plugins/ELNLIMSPlugin.js"></script> <script type="text/javascript" src="./js/plugins/GenericTechnology.js"></script> - <script type="text/javascript" src="./js/plugins/BiologyTechnology.js"></script> + <script type="text/javascript" src="./js/plugins/LifeSciencesTechnology.js"></script> <script type="text/javascript" src="./js/plugins/MicroscopyTechnology.js"></script> <script type="text/javascript"> diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js index 1350c50b9cc9fd13d554d0e90f0b2e1c9deee409..53fb5118d6c7b4894b8191a02840c68ebb2ee16e 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js @@ -133,7 +133,7 @@ $.extend(DefaultProfile.prototype, { // "ADMIN-BS-MBPR28.D.ETHZ.CH-E96954A7" : "http://localhost:8080/download" } - this.plugins = [new GenericTechnology(), new BiologyTechnology(), new MicroscopyTechnology()]; + this.plugins = [new GenericTechnology(), new LifeSciencesTechnology(), new MicroscopyTechnology()]; this.sampleFormTop = function($container, model) { for(var i = 0; i < this.plugins.length; i++) { this.plugins[i].sampleFormTop($container, model); diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/plugins/BiologyTechnology.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/plugins/LifeSciencesTechnology.js similarity index 88% rename from openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/plugins/BiologyTechnology.js rename to openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/plugins/LifeSciencesTechnology.js index c7dfec2ec059250df5c8157b3db00fa54fb4e916..d064fe15a729ff430e894d1b338292136caaa7e7 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/plugins/BiologyTechnology.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/plugins/LifeSciencesTechnology.js @@ -1,8 +1,8 @@ -function BiologyTechnology() { +function LifeSciencesTechnology() { this.init(); } -$.extend(BiologyTechnology.prototype, ELNLIMSPlugin.prototype, { +$.extend(LifeSciencesTechnology.prototype, ELNLIMSPlugin.prototype, { init: function() { }, @@ -151,7 +151,7 @@ $.extend(BiologyTechnology.prototype, ELNLIMSPlugin.prototype, { "LABEL" : "Plasmid", "TYPE": "PLASMID", "MIN_COUNT" : 0, - "ANNOTATION_PROPERTIES" : [{"TYPE" : "ANNOTATION.PLASMID.PLASMID_RELATIONSHIP", "MANDATORY" : false },{"TYPE" : "ANNOTATION.PLASMID.PLASMID_ANNOTATION", "MANDATORY" : false },{"TYPE" : "ANNOTATION.SYSTEM.COMMENTS", "MANDATORY" : false }] + "ANNOTATION_PROPERTIES" : [{"TYPE" : "ANNOTATION.SYSTEM.PLASMID_RELATIONSHIP", "MANDATORY" : false },{"TYPE" : "ANNOTATION.SYSTEM.PLASMID_ANNOTATION", "MANDATORY" : false },{"TYPE" : "ANNOTATION.SYSTEM.COMMENTS", "MANDATORY" : false }] } ], }, @@ -169,7 +169,7 @@ $.extend(BiologyTechnology.prototype, ELNLIMSPlugin.prototype, { "LABEL" : "Plasmid", "TYPE": "PLASMID", "MIN_COUNT" : 0, - "ANNOTATION_PROPERTIES" : [{"TYPE" : "ANNOTATION.PLASMID.PLASMID_RELATIONSHIP", "MANDATORY" : false },{"TYPE" : "ANNOTATION.PLASMID.PLASMID_ANNOTATION", "MANDATORY" : false },{"TYPE" : "ANNOTATION.SYSTEM.COMMENTS", "MANDATORY" : false }] + "ANNOTATION_PROPERTIES" : [{"TYPE" : "ANNOTATION.SYSTEM.PLASMID_RELATIONSHIP", "MANDATORY" : false },{"TYPE" : "ANNOTATION.SYSTEM.PLASMID_ANNOTATION", "MANDATORY" : false },{"TYPE" : "ANNOTATION.SYSTEM.COMMENTS", "MANDATORY" : false }] } ], }, @@ -187,7 +187,7 @@ $.extend(BiologyTechnology.prototype, ELNLIMSPlugin.prototype, { "LABEL" : "Plasmid", "TYPE": "PLASMID", "MIN_COUNT" : 0, - "ANNOTATION_PROPERTIES" : [{"TYPE" : "ANNOTATION.PLASMID.PLASMID_RELATIONSHIP", "MANDATORY" : false },{"TYPE" : "ANNOTATION.PLASMID.PLASMID_ANNOTATION", "MANDATORY" : false },{"TYPE" : "ANNOTATION.SYSTEM.COMMENTS", "MANDATORY" : false }] + "ANNOTATION_PROPERTIES" : [{"TYPE" : "ANNOTATION.SYSTEM.PLASMID_RELATIONSHIP", "MANDATORY" : false },{"TYPE" : "ANNOTATION.SYSTEM.PLASMID_ANNOTATION", "MANDATORY" : false },{"TYPE" : "ANNOTATION.SYSTEM.COMMENTS", "MANDATORY" : false }] }, { "LABEL" : "Parental fly", @@ -211,7 +211,7 @@ $.extend(BiologyTechnology.prototype, ELNLIMSPlugin.prototype, { "LABEL" : "Plasmid", "TYPE": "PLASMID", "MIN_COUNT" : 0, - "ANNOTATION_PROPERTIES" : [{"TYPE" : "ANNOTATION.PLASMID.PLASMID_RELATIONSHIP", "MANDATORY" : false },{"TYPE" : "ANNOTATION.PLASMID.PLASMID_ANNOTATION", "MANDATORY" : false },{"TYPE" : "ANNOTATION.SYSTEM.COMMENTS", "MANDATORY" : false }] + "ANNOTATION_PROPERTIES" : [{"TYPE" : "ANNOTATION.SYSTEM.PLASMID_RELATIONSHIP", "MANDATORY" : false },{"TYPE" : "ANNOTATION.SYSTEM.PLASMID_ANNOTATION", "MANDATORY" : false },{"TYPE" : "ANNOTATION.SYSTEM.COMMENTS", "MANDATORY" : false }] } ], } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/compatibility/comments.py b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/compatibility/comments.py deleted file mode 100644 index 396f3acb1791f395f1a999c847ad04a83191d243..0000000000000000000000000000000000000000 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/compatibility/comments.py +++ /dev/null @@ -1,183 +0,0 @@ -from java.util import Date - -""" -Example XML property value handled by this script: -<root> - <commentEntry date="2011-02-20 14:15:28 GMT+01:00" person="buczekp">Here is the 1st entry text.<commentEntry> - <commentEntry date="2011-02-20 14:16:28 GMT+01:00" person="kohleman">Here is the 2nd entry text - a warning!<commentEntry> - <commentEntry date="2011-02-20 14:17:28 GMT+01:00" person="tpylak">Here is the 3rd entry text - an error!!!<commentEntry> - <commentEntry date="2011-02-20 14:18:28 GMT+01:00" person="brinn">Here is the 4th entry text - an error!!!<commentEntry> - <commentEntry date="2011-02-20 14:19:28 GMT+01:00" person="felmer">Here is the 5th entry text - a warning!<commentEntry> -</root> -""" -## -## Configuration -## -COMMENT_ENTRY_ELEMENT_LABEL = 'commentEntry' - -""" labels of table columns and corresponding input fields """ -DATE_LABEL = 'Date' -PERSON_LABEL = 'Person' -COMMENT_TEXT_LABEL = 'Comment Text' - -""" names of attributes of XML elements for comment entries """ -DATE_ATTRIBUTE = 'date' -PERSON_ATTRIBUTE = 'person' - -""" action labels (shown as button labels in UI) """ -ADD_ACTION_LABEL = 'Add Comment Entry' -EDIT_ACTION_LABEL = 'Edit' -DELETE_ACTION_LABEL = 'Delete' - -## -## Main Methods -## -def configureUI(): - """Create table builder and add headers of columns.""" - builder = createTableBuilder() - builder.addHeader(DATE_LABEL, 250) # date and comment text values are long, override default width (150) - builder.addHeader(PERSON_LABEL) - builder.addHeader(COMMENT_TEXT_LABEL, 400) - - """ - Extract XML elements from property value to a Python list. - For each element (comment entry) add add a row to the table. - """ - elements = list(propertyConverter().convertToElements(property)) - for commentEntry in elements: - row = builder.addRow() - row.setCell(DATE_LABEL, Date(long(commentEntry.getAttribute(DATE_ATTRIBUTE)))) - row.setCell(PERSON_LABEL, commentEntry.getAttribute(PERSON_ATTRIBUTE)) - row.setCell(COMMENT_TEXT_LABEL, commentEntry.getData()) - - """Specify that the property should be shown in a tab and set the table output.""" - property.setOwnTab(True) - uiDescription = property.getUiDescription() - uiDescription.useTableOutput(builder.getTableModel()) - - """ - Define and add actions with input fields used to: - 1. specify attributes of new comment entry, - """ - addAction = uiDescription.addTableAction(ADD_ACTION_LABEL)\ - .setDescription('Add a new comment entry:') - widgets = [ - inputWidgetFactory().createMultilineTextInputField(COMMENT_TEXT_LABEL)\ - .setMandatory(True) - ] - addAction.addInputWidgets(widgets) - - """ - 2. modify attributes of a selected comment entry, - """ - editAction = uiDescription.addTableAction(EDIT_ACTION_LABEL)\ - .setDescription('Edit selected comment entry:') - # Exactly 1 row needs to be selected to enable action. - editAction.setRowSelectionRequiredSingle() - widgets = [ - inputWidgetFactory().createMultilineTextInputField(COMMENT_TEXT_LABEL).setMandatory(True) - ] - editAction.addInputWidgets(widgets) - # Bind field name with column name. - editAction.addBinding(COMMENT_TEXT_LABEL, COMMENT_TEXT_LABEL) - - """ - 3. delete selected comment entries. - """ - deleteAction = uiDescription.addTableAction(DELETE_ACTION_LABEL)\ - .setDescription('Are you sure you want to delete selected comment entry?') - # Delete is enabled when at least 1 row is selected. - deleteAction.setRowSelectionRequired() - - -def updateFromUI(action): - """Extract list of elements from old value of the property.""" - converter = propertyConverter() - elements = list(converter.convertToElements(property)) - - """Implement behaviour of user actions.""" - if action.name == ADD_ACTION_LABEL: - """ - For 'add' action create new comment entry element with values from input fields - and add it to existing elements. - """ - element = elementFactory().createElement(COMMENT_ENTRY_ELEMENT_LABEL) - """Fill element attributes with appropriate values.""" - element.addAttribute(DATE_ATTRIBUTE, str(Date().getTime())) # current date - element.addAttribute(PERSON_ATTRIBUTE, action.getPerson().getUserId()) # invoker the action - """Retrieve values from input fields filled by user on the client side.""" - - """Set comment text as a text element, not an attribute.""" - element.setData(action.getInputValue(COMMENT_TEXT_LABEL)) - """Add the new entry to the end of the element list.""" - elements.append(element) - elif action.name == EDIT_ACTION_LABEL: - """ - For 'edit' action find the comment entry element corresponding to selected row - and replace it with an element with values from input fields. - """ - - selectedRowId = action.getSelectedRows()[0] - xmlUser = elements[selectedRowId].getAttribute(PERSON_ATTRIBUTE) - if action.getPerson().getUserId() == xmlUser: - elements[selectedRowId].setData(action.getInputValue(COMMENT_TEXT_LABEL)) - else: - raise ValidationException('Comment creator and current user differ:\n' + str(xmlUser) + "!=" + str(action.getPerson().getUserId()) ) - elif action.name == DELETE_ACTION_LABEL: - """ - For 'delete' action delete the entries that correspond to selected rows. - NOTE: As many rows can be deleted at once it is easier to delete them in reversed order. - """ - rowIds = list(action.getSelectedRows()) - rowIds.reverse() - for rowId in rowIds: - xmlUser = elements[rowId].getAttribute(PERSON_ATTRIBUTE) - if action.getPerson().getUserId() == xmlUser: - elements.pop(rowId) - else: - raise ValidationException('Comment creator and current user differ:\n' + str(xmlUser) + "!=" + str(action.getPerson().getUserId()) ) - else: - raise ValidationException('action not supported') - - """Update value of the managed property to XML string created from modified list of elements.""" - property.value = converter.convertToString(elements) - -## -## Form Methods -## -def showRawValueInForms(): - return False - -def updateFromRegistrationForm(bindings): - elements = [] - for item in bindings: - comment_text_list = item.get('COMMENTENTRY') - sampleLink = _createCommentEntry(comment_text_list) - elements.append(sampleLink) - - property.value = propertyConverter().convertToString(elements) - -## -## Batch Import Methods -## -def batchColumnNames(): - return [COMMENT_ENTRY_ELEMENT_LABEL] - -def updateFromBatchInput(bindings): - elements = [] - input = bindings.get('COMMENTENTRY') - if input is not None: - commentEntry = _createCommentEntry(input) - elements.append(commentEntry) - property.value = propertyConverter().convertToString(elements) - -## -## Help Methods -## -def _createCommentEntry(comment_text_list): - #if comment_text_list is not None: - commentEntry = elementFactory().createElement(COMMENT_ENTRY_ELEMENT_LABEL) - commentEntry.addAttribute(PERSON_ATTRIBUTE, person.getUserId()) - commentEntry.addAttribute(DATE_ATTRIBUTE,str(Date().getTime())) - commentEntry.setData(comment_text_list) - return commentEntry \ No newline at end of file diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/compatibility/managed.py b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/compatibility/managed.py deleted file mode 100644 index 848a92850e0245ec574253d91b85615420771e96..0000000000000000000000000000000000000000 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/compatibility/managed.py +++ /dev/null @@ -1,267 +0,0 @@ -from ch.systemsx.cisd.openbis.generic.server import CommonServiceProvider - -## -## Configuration -## - -# This needs to be edited for each sample type to match the Profile.js ANNOTATION_PROPERTIES map. -configuration = {} -configuration["MEDIA"] = { - "CHEMICAL" : {"QUANTITY" : False, "COMMENTS" : False }, - "SOLUTION_BUFFER" : {"QUANTITY" : False, "COMMENTS" : False }, - "MEDIA" : {"QUANTITY" : False, "COMMENTS" : False } - }; - -configuration["SOLUTION_BUFFER"] = { - "CHEMICAL" : {"QUANTITY" : False, "COMMENTS" : False }, - "SOLUTION_BUFFER" : {"QUANTITY" : False, "COMMENTS" : False }, - "MEDIA" : {"QUANTITY" : False, "COMMENTS" : False } - }; - -configuration["GENERAL_PROTOCOL"] = { - "CHEMICAL" : {"QUANTITY" : False, "COMMENTS" : False }, - "SOLUTION_BUFFER" : {"QUANTITY" : False, "COMMENTS" : False }, - "MEDIA" : {"QUANTITY" : False, "COMMENTS" : False }, - "ENZYME" : {"QUANTITY" : False, "COMMENTS" : False }, - "GENERAL_PROTOCOL" : {"COMMENTS" : False } - }; - -configuration["PCR_PROTOCOL"] = { - "CHEMICAL" : {"QUANTITY" : False, "COMMENTS" : False }, - "SOLUTION_BUFFER" : {"QUANTITY" : False, "COMMENTS" : False }, - "ENZYME" : {"QUANTITY" : False, "COMMENTS" : False } - }; - -configuration["WESTERN_BLOTTING_PROTOCOL"] = { - "CHEMICAL" : {"QUANTITY" : False, "COMMENTS" : False }, - "SOLUTION_BUFFER" : {"QUANTITY" : False, "COMMENTS" : False }, - "ANTIBODY" : {"QUANTITY" : False, "COMMENTS" : False } - }; - -configuration["PLASMID"] = { - "PLASMID" : {"COMMENTS" : False } - }; - -configuration["BACTERIA"] = { - "BACTERIA" : {"COMMENTS" : False }, - "PLASMID" : {"PLASMID_RELATIONSHIP" : False, "PLASMID_ANNOTATION" : False, "COMMENTS" : False } - }; - -configuration["YEAST"] = { - "YEAST" : {"COMMENTS" : False }, - "PLASMID" : {"PLASMID_RELATIONSHIP" : False, "PLASMID_ANNOTATION" : False, "COMMENTS" : False, "CONTAINED" : False } - }; - -configuration["CELL_LINE"] = { - "CELL_LINE" : {"COMMENTS" : False }, - "PLASMID" : {"PLASMID_RELATIONSHIP" : False, "PLASMID_ANNOTATION" : False, "COMMENTS" : False }, - "FLY" : {"COMMENTS" : False } - }; - -configuration["FLY"] = { - "FLY" : {"COMMENTS" : False }, - "PLASMID" : {"PLASMID_RELATIONSHIP" : False, "PLASMID_ANNOTATION" : False, "COMMENTS" : False } - }; - -configuration["EXPERIMENTAL_STEP"] = { - "ANTIBODY" : {"QUANTITY" : False, "COMMENTS" : False }, - "BACTERIA" : {"COMMENTS" : False }, - "CELL_LINE" : {"COMMENTS" : False }, - "CHEMICAL" : {"QUANTITY" : False, "COMMENTS" : False }, - "ENZYME" : {"QUANTITY" : False, "COMMENTS" : False }, - "FLY" : {"COMMENTS" : False }, - "MEDIA" : {"QUANTITY" : False, "COMMENTS" : False }, - "OLIGO" : {"COMMENTS" : False }, - "PLASMID" : {"COMMENTS" : False }, - "RNA" : {"COMMENTS" : False }, - "SOLUTION_BUFFER" : {"QUANTITY" : False, "COMMENTS" : False }, - "YEAST" : {"COMMENTS" : False }, - "GENERAL_PROTOCOL" : {"COMMENTS" : False }, - "PCR_PROTOCOL" : {"COMMENTS" : False }, - "WESTERN_BLOTTING_PROTOCOL" : {"COMMENTS" : False } - }; - -#Global Variables -annotableType = "<REPLACE_WITH_ANNOTABLE_TYPE>" -propertyTypes = None -def getPropertyTypes(): - global propertyTypes - if propertyTypes is None: - server = CommonServiceProvider.getCommonServer() - contextOrNull = server.tryToAuthenticateAsSystem() - propertyTypes = server.listPropertyTypes(contextOrNull.getSessionToken(), False) - return propertyTypes; - -## -## Help Methods -## -def getAllAnnotableSampleTypesForType(fromAnnotableType): - allTypes = {}; - for sampleTypeWithAnnotations in configuration: - if (fromAnnotableType == None) or (fromAnnotableType == sampleTypeWithAnnotations): - for sampleTypeWithAnnotationsForType in configuration[sampleTypeWithAnnotations]: - allTypes[sampleTypeWithAnnotationsForType] = True; - return allTypes; - -def getPropertyTypesForSampleTypeFromAnnotableType(sampleTypeCodeToFind, fromAnnotableType): - for sampleTypeWithAnnotations in configuration: - if (fromAnnotableType == None) or (fromAnnotableType == sampleTypeWithAnnotations): - for sampleTypeWithAnnotationsForType in configuration[sampleTypeWithAnnotations]: - if sampleTypeWithAnnotationsForType == sampleTypeCodeToFind: - return configuration[sampleTypeWithAnnotations][sampleTypeWithAnnotationsForType]; - return None; - -def getPropertyType(propertyTypeCode): - for propertyType in getPropertyTypes(): - if propertyType.code == propertyTypeCode: - return propertyType - return None; - -def createAnnotationsFor(identifier, annotations, sampleType): - permId = entityInformationProvider().getSamplePermId(identifier); - newAnnotation = elementFactory().createSampleLink(permId) - - newAnnotation.addAttribute("identifier", identifier) - newAnnotation.addAttribute("sampleType", sampleType) - for annotation in annotations: - newAnnotation.addAttribute(annotation, annotations[annotation]) - return newAnnotation - -def getWidgetForAdd(sampleTypeCode, annotableType): - #print "sampleTypeCode:" + sampleTypeCode + " - " + annotableType #Deleting this comment causes the thing to break - widgets = [] - widgetIdentifier = inputWidgetFactory().createTextInputField("identifier")\ - .setMandatory(True)\ - .setValue("")\ - .setDescription("") - widgets.append(widgetIdentifier) - for propertyTypeCode in getPropertyTypesForSampleTypeFromAnnotableType(sampleTypeCode, annotableType): - propertyType = getPropertyType(propertyTypeCode) - widget = inputWidgetFactory().createTextInputField(propertyType.label)\ - .setMandatory(getPropertyTypesForSampleTypeFromAnnotableType(sampleTypeCode, annotableType)[propertyTypeCode])\ - .setValue("")\ - .setDescription(propertyType.description) - widgets.append(widget) - return widgets; - -def isValid(dataType, value): - return True - -## -## Main Methods -## -def configureUI(): - # Add Headers - tableBuilder = createTableBuilder() - tableBuilder.addHeader("identifier") - tableBuilder.addHeader("sampleType") - tableBuilder.addHeader("name") - - usedTableHeaders = {"identifier" : True, "sampleType" : True, "name" : True } - - for sampleTypeCode in getAllAnnotableSampleTypesForType(annotableType): - for propertyTypeCode in getPropertyTypesForSampleTypeFromAnnotableType(sampleTypeCode, annotableType): - if propertyTypeCode not in usedTableHeaders: - tableBuilder.addHeader(propertyTypeCode) - usedTableHeaders[propertyTypeCode] = True - - property.setOwnTab(True) - uiDescription = property.getUiDescription() - uiDescription.useTableOutput(tableBuilder.getTableModel()) - - # Add Rows - samples = list(propertyConverter().convertToElements(property)) - for sample in samples: - row = tableBuilder.addRow() - permId = sample.getAttribute("permId") - - nameValue = entityInformationProvider().getSamplePropertyValue(permId, "NAME") - if nameValue is not None: - row.setCell("name", nameValue) - - for annotation in sample.getAttributes(): - if annotation != "permId": - if annotation == "identifier": - row.setCell(annotation, sample, sample.getAttribute(annotation)) - else: - row.setCell(annotation, sample.getAttribute(annotation)) - - # Add Create buttons - for sampleTypeCode in getAllAnnotableSampleTypesForType(annotableType): - title = "Add " + sampleTypeCode; - addAction = uiDescription.addTableAction(title).setDescription(title) - widgets = getWidgetForAdd(sampleTypeCode, annotableType) - addAction.addInputWidgets(widgets) - - # Add Delete button - deleteAction = uiDescription.addTableAction("Delete")\ - .setDescription('Are you sure you want to delete selected annotation?') - deleteAction.setRowSelectionRequired() # Delete is enabled when at least 1 row is selected. - -def updateFromUI(action): - converter = propertyConverter() - elements = list(converter.convertToElements(property)) - - if action.name.startswith("Add"): - sampleTypeCode = action.name[4:] - identifier = action.getInputValue("identifier") - annotations = { } - for propertyTypeCode in getPropertyTypesForSampleTypeFromAnnotableType(sampleTypeCode, annotableType): - propertyType = getPropertyType(propertyTypeCode) - propertyTypeValue = action.getInputValue(propertyType.label) - if not isValid(propertyType.dataType, propertyTypeValue): - raise ValidationException("Property " + str(propertyType.label) + " with invalid value " + str(propertyTypeValue)) - if propertyTypeValue is None: - propertyTypeValue = "" - annotations[propertyTypeCode] = propertyTypeValue - newAnnotation = createAnnotationsFor(identifier, annotations, sampleTypeCode) - elements.append(newAnnotation) - - if action.name.startswith("Delete"): - rowIds = list(action.getSelectedRows()) - rowIds.reverse() - for rowId in rowIds: - elements.pop(rowId) - - property.value = converter.convertToString(elements) - -## -## Batch Import Methods -## -def batchColumnNames(): - allTypes = [] - for sampleTypeCode in getAllAnnotableSampleTypesForType(annotableType): - allTypes.append(sampleTypeCode) - return allTypes - -def updateFromBatchInput(bindings): - #print "--------> UPDATE FROM BATCH INPUT: " - elements = [] - - for annotableSampleType in getAllAnnotableSampleTypesForType(annotableType): - annotatedSamples = bindings.get(annotableSampleType) - #print "-----> TYPE: " + str(annotableSampleType) + " BINDINGS: " + str(annotatedSamples) - if (annotatedSamples != None and annotatedSamples != ""): - #Annotations - for sampleLine in annotatedSamples.split("\\"): - propertyTypes = getPropertyTypesForSampleTypeFromAnnotableType(annotableSampleType, annotableType) - identifier = None - permId = None - sampleLink = None - for sampleProperty in sampleLine.split(";"): - propertyName = sampleProperty.split(":")[0] - propertyValue = sampleProperty.split(":")[1] - if propertyName == "identifier": - identifier = propertyValue - permId = entityInformationProvider().getSamplePermId(propertyValue) - sampleLink = elementFactory().createSampleLink(permId) - sampleLink.addAttribute(propertyName, propertyValue) - sampleLink.addAttribute('sampleType', annotableSampleType) - elif propertyName in propertyTypes: - sampleLink.addAttribute(propertyName, propertyValue) - else: - raise NameError('Found invalid property: ' + propertyName + " on type " + annotableSampleType) - if identifier is not None: - elements.append(sampleLink) - #Links - property.value = propertyConverter().convertToString(elements) \ No newline at end of file diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/compatibility/requests_children_code.py b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/compatibility/requests_children_code.py deleted file mode 100644 index c79ad63402a2f4f10f586f527c5e3a2a0cb49891..0000000000000000000000000000000000000000 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/compatibility/requests_children_code.py +++ /dev/null @@ -1,14 +0,0 @@ -def retrieve_childrenCode(): - - sample= entity.samplePE() - children=sample.children - if len(children) != 0: - children_code = children[0].getCode() - else: - children_code="n.a." - - - return children_code - -def calculate(): - return retrieve_childrenCode()