From 715ea509a0ef41727b154a0c95487ef03087b850 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Tue, 29 Mar 2016 07:14:51 +0000
Subject: [PATCH] SSDM-3348:  VocabularyTermDeletionOptions.js added.
 Vocabulary* js adapted.

SVN: 36019
---
 .../openbis-v3-api-test/html/test/dtos.js     |  3 +-
 .../delete/VocabularyTermDeletionOptions.js   | 17 ++++++++++
 .../search/VocabularyCodeSearchCriteria.js    | 18 -----------
 .../search/VocabularySearchCriteria.js        | 27 ++++++++++++++++
 .../VocabularyTermCodeSearchCriteria.js       | 18 -----------
 .../search/VocabularyTermSearchCriteria.js    | 31 ++++++-------------
 6 files changed, 55 insertions(+), 59 deletions(-)
 create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/delete/VocabularyTermDeletionOptions.js
 delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/search/VocabularyCodeSearchCriteria.js
 create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/search/VocabularySearchCriteria.js
 delete mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/search/VocabularyTermCodeSearchCriteria.js

diff --git a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/dtos.js b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/dtos.js
index aaee3ccf778..a51bfe929b9 100644
--- a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/dtos.js
+++ b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/dtos.js
@@ -297,8 +297,7 @@ var sources = [
 	'as/dto/vocabulary/id/VocabularyTermPermId',
 	'as/dto/vocabulary/Vocabulary',
 	'as/dto/vocabulary/VocabularyTerm',	
-	'as/dto/vocabulary/search/VocabularyCodeSearchCriteria',
-	'as/dto/vocabulary/search/VocabularyTermCodeSearchCriteria',
+	'as/dto/vocabulary/search/VocabularySearchCriteria',
 	'as/dto/vocabulary/search/VocabularyTermSearchCriteria',
 	'as/dto/vocabulary/create/VocabularyTermCreation'
  ];
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/delete/VocabularyTermDeletionOptions.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/delete/VocabularyTermDeletionOptions.js
new file mode 100644
index 00000000000..360bbdc9416
--- /dev/null
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/delete/VocabularyTermDeletionOptions.js
@@ -0,0 +1,17 @@
+define([ "stjs", "as/dto/deletion/AbstractObjectDeletionOptions" ], function(stjs, AbstractObjectDeletionOptions) {
+	var VocabularyTermDeletionOptions = function() {
+		AbstractObjectDeletionOptions.call(this);
+	};
+	stjs.extend(VocabularyTermDeletionOptions, AbstractObjectDeletionOptions, [ AbstractObjectDeletionOptions ], function(constructor, prototype) {
+		prototype['@type'] = 'as.dto.vocabulary.delete.VocabularyTermDeletionOptions';
+		constructor.serialVersionUID = 1;
+		prototype.replacements = null;
+		prototype.replace = function(termId, replacementId) {
+			this.replacements[termId] = replacementId;
+		};
+		prototype.getReplacements = function() {
+			return this.replacements;
+		};
+	}, {});
+	return VocabularyTermDeletionOptions;
+})
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/search/VocabularyCodeSearchCriteria.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/search/VocabularyCodeSearchCriteria.js
deleted file mode 100644
index b8ae2478449..00000000000
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/search/VocabularyCodeSearchCriteria.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * @author pkupczyk
- */
-define([ "stjs", "as/dto/common/search/StringFieldSearchCriteria", "as/dto/common/search/SearchFieldType" ], function(stjs, StringFieldSearchCriteria, SearchFieldType) {
-	var VocabularyCodeSearchCriteria = function() {
-		StringFieldSearchCriteria.call(this, "vocabularyCode", SearchFieldType.ATTRIBUTE);
-	};
-	stjs.extend(VocabularyCodeSearchCriteria, StringFieldSearchCriteria, [ StringFieldSearchCriteria ], function(constructor, prototype) {
-		prototype['@type'] = 'as.dto.vocabulary.search.VocabularyCodeSearchCriteria';
-		constructor.serialVersionUID = 1;
-	}, {
-//		fieldType : {
-//			name : "Enum",
-//			arguments : [ "SearchFieldType" ]
-//		}
-	});
-	return VocabularyCodeSearchCriteria;
-})
\ No newline at end of file
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/search/VocabularySearchCriteria.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/search/VocabularySearchCriteria.js
new file mode 100644
index 00000000000..4e32cf24515
--- /dev/null
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/search/VocabularySearchCriteria.js
@@ -0,0 +1,27 @@
+/**
+ * @author pkupczyk
+ */
+define([ "require", "stjs", "as/dto/common/search/AbstractObjectSearchCriteria", "as/dto/common/search/CodeSearchCriteria", "as/dto/common/search/PermIdSearchCriteria",
+		"as/dto/common/search/AbstractCompositeSearchCriteria" ], function(require, stjs, AbstractObjectSearchCriteria) {
+	var VocabularySearchCriteria = function() {
+		AbstractObjectSearchCriteria.call(this);
+	};
+	stjs.extend(VocabularySearchCriteria, AbstractObjectSearchCriteria, [ AbstractObjectSearchCriteria ], function(constructor, prototype) {
+		prototype['@type'] = 'as.dto.vocabulary.search.VocabularySearchCriteria';
+		constructor.serialVersionUID = 1;
+		prototype.withCode = function() {
+			var CodeSearchCriteria = require("as/dto/common/search/CodeSearchCriteria");
+			return this.addCriteria(new CodeSearchCriteria());
+		};
+		prototype.withPermId = function() {
+			var PermIdSearchCriteria = require("as/dto/common/search/PermIdSearchCriteria");
+			return this.addCriteria(new PermIdSearchCriteria());
+		};
+	}, {
+		criteria : {
+			name : "Collection",
+			arguments : [ "ISearchCriteria" ]
+		}
+	});
+	return VocabularySearchCriteria;
+})
\ No newline at end of file
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/search/VocabularyTermCodeSearchCriteria.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/search/VocabularyTermCodeSearchCriteria.js
deleted file mode 100644
index 80c9727c05d..00000000000
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/search/VocabularyTermCodeSearchCriteria.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * @author pkupczyk
- */
-define([ "stjs", "as/dto/common/search/StringFieldSearchCriteria", "as/dto/common/search/SearchFieldType" ], function(stjs, StringFieldSearchCriteria, SearchFieldType) {
-	var VocabularyTermCodeSearchCriteria = function() {
-		StringFieldSearchCriteria.call(this, "any", SearchFieldType.ANY_FIELD);
-	};
-	stjs.extend(VocabularyTermCodeSearchCriteria, StringFieldSearchCriteria, [ StringFieldSearchCriteria ], function(constructor, prototype) {
-		prototype['@type'] = 'as.dto.vocabulary.search.VocabularyTermCodeSearchCriteria';
-		constructor.serialVersionUID = 1;
-	}, {
-//		fieldType : {
-//			name : "Enum",
-//			arguments : [ "SearchFieldType" ]
-//		}
-	});
-	return VocabularyTermCodeSearchCriteria;
-})
\ No newline at end of file
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/search/VocabularyTermSearchCriteria.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/search/VocabularyTermSearchCriteria.js
index 22008836e94..b5cb217cfff 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/search/VocabularyTermSearchCriteria.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/vocabulary/search/VocabularyTermSearchCriteria.js
@@ -1,35 +1,24 @@
 /**
  * @author pkupczyk
  */
-define([ "require", "stjs", "as/dto/common/search/AbstractObjectSearchCriteria", "as/dto/common/search/SearchOperator", "as/dto/common/search/PermIdSearchCriteria",
-		"as/dto/common/search/AbstractCompositeSearchCriteria", "as/dto/vocabulary/search/VocabularyTermSearchCriteria", "as/dto/vocabulary/search/VocabularyCodeSearchCriteria" ], 
-		function(require, stjs, AbstractObjectSearchCriteria, SearchOperator) {
+define([ "require", "stjs", "as/dto/common/search/AbstractObjectSearchCriteria"], 
+		function(require, stjs, AbstractObjectSearchCriteria) {
 	var VocabularyTermSearchCriteria = function() {
 		AbstractObjectSearchCriteria.call(this);
 	};
 	stjs.extend(VocabularyTermSearchCriteria, AbstractObjectSearchCriteria, [ AbstractObjectSearchCriteria ], function(constructor, prototype) {
-		prototype['@type'] = 'as.dto.tag.search.TagSearchCriteria';
+		prototype['@type'] = 'as.dto.vocabulary.search.VocabularyTermSearchCriteria';
 		constructor.serialVersionUID = 1;
 		
 		prototype.withPermId = function() {
-	        return this.with(new require("as/dto/common/search/PermIdSearchCriteria")());
-	    };
-
+			return this.with(new require("as/dto/common/search/PermIdSearchCriteria")());
+		};
 		prototype.withCode = function() {
-	        return this.with(new require("as/dto/vocabulary/search/VocabularyTermSearchCriteria")());
-	    };
-
-		prototype.withVocabularyCode = function() {
-	        return this.with(new require("as/dto/vocabulary/search/VocabularyCodeSearchCriteria")());
-	    };
-
-		prototype.withOrOperator = function() {
-	        return this.withOperator(new SearchOperator().OR);
-	    };
-
-		prototype.withAndOperator = function() {
-	        return this.withOperator(new SearchOperator().AND);
-	    };
+			return this.addCriteria(new require("as/dto/common/search/CodeSearchCriteria")());
+		};
+		prototype.withVocabulary = function() {
+			return this.with(new require("as/dto/vocabulary/search/VocabularySearchCriteria")());
+		};
 	}, {
 //		criteria : {
 //			name : "Collection",
-- 
GitLab