From 098de55f95f136d2a6c642817a3ad1699da3b566 Mon Sep 17 00:00:00 2001 From: vermeul <swen@ethz.ch> Date: Fri, 2 Aug 2019 15:24:20 +0200 Subject: [PATCH] added create, update and delete types for PropertyType and Sample --- pybis/src/python/pybis/definitions.py | 38 ++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/pybis/src/python/pybis/definitions.py b/pybis/src/python/pybis/definitions.py index 707a5b3e7e7..5091dfb8800 100644 --- a/pybis/src/python/pybis/definitions.py +++ b/pybis/src/python/pybis/definitions.py @@ -49,6 +49,7 @@ def openbis_definitions(entity): "identifier": "sampleId", "create": { "@type": "as.dto.sample.create.SampleCreation"}, "update": { "@type": "as.dto.sample.upate.SampleUpdate"}, + "delete": { "@type": "as.dto.sample.delete.SampleDeletionOptions"}, "cre_type": "as.dto.sample.create.SampleCreation", "multi": "parents children components tags attachments".split(), }, @@ -57,14 +58,29 @@ def openbis_definitions(entity): "attrs_up": "autoGeneratedCode generatedCodePrefix subcodeUnique description listable showContainer showParents showParentMetadata".split(), "attrs": "code autoGeneratedCode generatedCodePrefix subcodeUnique description listable showContainer showParents showParentMetadata".split(), + "create": { + "@type": "as.dto.sample.create.SampleTypeCreation" + }, + "update": { + "@type": "as.dto.sample.update.SampleTypeUpdate" + }, + "delete": { + "@type": "as.dto.sample.delete.SampleTypeDeletionOptions" + }, }, "propertyType": { "attrs": "code label description managedInternally internalNameSpace dataType vocabulary materialType schema transformation semanticAnnotations registrator registrationDate".split(), "attrs_new": "code label description managedInternally internalNameSpace dataType vocabularyId materialTypeId schema transformation metaData".split(), "attrs_up": "label description schema transformation metaData".split(), - - - + "create": { + "@type": "as.dto.property.create.PropertyTypeCreation" + }, + "update": { + "@type": "as.dto.property.update.PropertyTypeUpdate" + }, + "delete": { + "@type": "as.dto.property.delete.PropertyTypeDeletionOptions" + }, }, "SemanticAnnotation": { "attrs_new": "permId entityType propertyType predicateOntologyId predicateOntologyVersion predicateAccessionId descriptorOntologyId descriptorOntologyVersion descriptorAccessionId".split(), @@ -260,6 +276,10 @@ fetch_option = { "@type": "as.dto.person.fetchoptions.PersonFetchOptions" }, }, + "semanticAnnotations": { + "@type": "as.dto.semanticannotation.fetchoptions.SemanticAnnotationFetchOptions" + }, + "materialType": { "@type": "as.dto.material.fetchoptions.MaterialTypeFetchOptions" }, "tags": {"@type": "as.dto.tag.fetchoptions.TagFetchOptions"}, "tag": {"@type": "as.dto.tag.fetchoptions.TagFetchOptions"}, "attachments": {"@type": "as.dto.attachment.fetchoptions.AttachmentFetchOptions"}, @@ -277,9 +297,9 @@ fetch_option = { "plugin": {"@type": "as.dto.plugin.fetchoptions.PluginFetchOptions"}, "vocabulary": { "@type": "as.dto.vocabulary.fetchoptions.VocabularyFetchOptions", - "terms": { - "@type": "as.dto.vocabulary.fetchoptions.VocabularyTermFetchOptions" - }, + #"terms": { + # "@type": "as.dto.vocabulary.fetchoptions.VocabularyTermFetchOptions" + #}, }, "vocabularyTerm": {"@type": "as.dto.vocabulary.fetchoptions.VocabularyTermFetchOptions"}, "deletedObjects": { "@type": "as.dto.deletion.fetchoptions.DeletedObjectFetchOptions" }, @@ -301,7 +321,11 @@ def get_type_for_entity(entity, action): return definition[action] def get_method_for_entity(entity, action): - if action == "Vocabulary": + action = action.lower() + + if entity == "Vocabulary": return "{}Vocabularies".format(action) + if entity == "propertyType": + return "{}PropertyTypes".format(action) return "{}{}s".format(action, entity) -- GitLab