From 9381e89c78d9911f9b1bb9bfc1ff351e53f67e93 Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Tue, 3 May 2016 07:18:05 +0000 Subject: [PATCH] SSDM-3529: Javascript part done. SVN: 36460 --- .../v3/as/dto/property/PropertyAssignment.js | 9 +++++++++ .../api/v3/as/dto/property/PropertyType.js | 20 +++++++++++++++++++ .../PropertyAssignmentFetchOptions.js | 17 +++++++++++++++- 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/property/PropertyAssignment.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/property/PropertyAssignment.js index 89b940f78a0..e61ed84e380 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/property/PropertyAssignment.js +++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/property/PropertyAssignment.js @@ -18,6 +18,15 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) { prototype.setPropertyType = function(propertyType) { this.propertyType = propertyType; }; + prototype.getVocabularyFetchOptions = function() { + return this.propertyType.getVocabularyFetchOptions(); + } + prototype.getVocabulary = function() { + if (this.getVocabularyFetchOptions()) { + return this.propertyType.getVocabulary(); + } else { + throw new exceptions.NotFetchedException("Vocabulary has not been fetched."); + } } }, { propertyType : "PropertyType" }); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/property/PropertyType.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/property/PropertyType.js index ff007fc9559..13141c23e19 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/property/PropertyType.js +++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/property/PropertyType.js @@ -9,6 +9,8 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) { prototype.description = null; prototype.dataTypeCode = null; prototype.internalNameSpace = null; + prototype.vocabularyFetchOptions = null; + prototype.vocabulary = null; prototype.getCode = function() { return this.code; }; @@ -39,7 +41,25 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) { prototype.setInternalNameSpace = function(internalNameSpace) { this.internalNameSpace = internalNameSpace; }; + prototype.getVocabularyFetchOptions = function() { + return this.vocabularyFetchOptions; + }; + prototype.setVocabularyFetchOptions = function(vocabularyFetchOptions) { + this.vocabularyFetchOptions = vocabularyFetchOptions; + }; + prototype.getVocabulary = function() { + if (this.getVocabularyFetchOptions() && this.getVocabularyFetchOptions().hasVocabulary()) { + return this.vocabulary; + } else { + throw new exceptions.NotFetchedException("Vocabulary has not been fetched."); + } + }; + prototype.setVocabulary = function(vocabulary) { + this.vocabulary = vocabulary; + }; }, { + vocabularyFetchOptions : "VocabularyTermFetchOptions", + vocabulary : "Vocabulary", dataTypeCode : "DataTypeCode" }); return PropertyType; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/property/fetchoptions/PropertyAssignmentFetchOptions.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/property/fetchoptions/PropertyAssignmentFetchOptions.js index ece39971e15..ca048e4257e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/property/fetchoptions/PropertyAssignmentFetchOptions.js +++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/property/fetchoptions/PropertyAssignmentFetchOptions.js @@ -1,10 +1,25 @@ -define([ "stjs", "as/dto/common/fetchoptions/FetchOptions", "as/dto/property/fetchoptions/PropertyAssignmentSortOptions" ], function(stjs, FetchOptions) { +define([ "stjs", "as/dto/common/fetchoptions/FetchOptions", "as/dto/vocabulary/fetchoptions/VocabularyFetchOptions", + "as/dto/property/fetchoptions/PropertyAssignmentSortOptions" ], function(stjs, FetchOptions) { var PropertyAssignmentFetchOptions = function() { }; stjs.extend(PropertyAssignmentFetchOptions, FetchOptions, [ FetchOptions ], function(constructor, prototype) { prototype['@type'] = 'as.dto.property.fetchoptions.PropertyAssignmentFetchOptions'; constructor.serialVersionUID = 1; + prototype.vocabulary = null; prototype.sort = null; + prototype.withVocabulary = function() { + if (this.vocabulary == null) { + var VocabularyFetchOptions = require("as/dto/vocabulary/fetchoptions/VocabularyFetchOptions"); + this.vocabulary = new VocabularyFetchOptions(); + } + return this.vocabulary; + }; + prototype.withVocabularyUsing = function(fetchOptions) { + return this.vocabulary = fetchOptions; + }; + prototype.hasVocabulary = function() { + return this.vocabulary != null; + }; prototype.sortBy = function() { if (this.sort == null) { var PropertyAssignmentSortOptions = require("as/dto/property/fetchoptions/PropertyAssignmentSortOptions"); -- GitLab