From bb0f987a44793df1e11e999609d6f40fbd9883ec Mon Sep 17 00:00:00 2001
From: yvesn <yvesn>
Date: Fri, 21 Jul 2017 07:59:23 +0000
Subject: [PATCH] SSDM-5098: fixing js-test - added git repository id to V3 api
 js

SVN: 38558
---
 .../openbis-v3-api-test/html/test/common.js       |  3 ++-
 .../openbis-v3-api-test/html/test/test-update.js  |  4 +++-
 .../api/v3/as/dto/dataset/ContentCopy.js          |  7 +++++++
 .../as/dto/dataset/create/ContentCopyCreation.js  |  7 +++++++
 .../dataset/search/ContentCopySearchCriteria.js   |  9 +++++++--
 .../search/GitRepositoryIdSearchCriteria.js       | 15 +++++++++++++++
 6 files changed, 41 insertions(+), 4 deletions(-)
 create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/search/GitRepositoryIdSearchCriteria.js

diff --git a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js
index 8900c7c3781..c5c73b52a9b 100644
--- a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js
+++ b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js
@@ -273,7 +273,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
 			});
 		}.bind(this);
 		
-		this.createLinkDataSet = function(facade, path, gitCommitHash) {
+		this.createLinkDataSet = function(facade, path, gitCommitHash, gitRepositoryId) {
 			var c = this;
 			return c.createExperiment(facade).then(function(experimentPermId) {
 				return c.createFileExternalDms(facade).then(function(emdsPermId) {
@@ -287,6 +287,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
 					cc.setExternalDmsId(emdsPermId);
 					cc.setPath(path);
 					cc.setGitCommitHash(gitCommitHash);
+					cc.setGitRepositoryId(gitRepositoryId);
 					linkedData.setContentCopies([cc]);
 					dataSet.setLinkedData(linkedData);
 					return facade.createDataSets([dataSet]).then(function(permIds) {
diff --git a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-update.js b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-update.js
index 776d2a7063d..a764ed31fb5 100644
--- a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-update.js
+++ b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-update.js
@@ -365,7 +365,7 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', '
 			var edmsId = null;
 			
 			var fCreate = function(facade) {
-				return c.createLinkDataSet(facade, "root/path", "my-hash").then(function(permId) {
+				return c.createLinkDataSet(facade, "root/path", "my-hash", "my-repository-id").then(function(permId) {
 					code = permId.getPermId();
 					return [ permId ];
 				});
@@ -380,6 +380,7 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', '
 					contentCopyCreation.setExternalDmsId(edmsId);
 					contentCopyCreation.setPath("my/data/path");
 					contentCopyCreation.setGitCommitHash("my-git-hash");
+					contentCopyCreation.setGitRepositoryId("my-git-repository-id");
 					contentCopyListUpdateValue.add([contentCopyCreation]);
 					contentCopyListUpdateValue.remove([contentCopy.getId()]);
 					
@@ -402,6 +403,7 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', '
 				c.assertEqual(contentCopies[0].getExternalCode(), null, "External code");
 				c.assertEqual(contentCopies[0].getPath(), "/my/data/path", "Path");
 				c.assertEqual(contentCopies[0].getGitCommitHash(), "my-git-hash", "Git commit hash");
+				c.assertEqual(contentCopies[0].getGitRepositoryId(), "my-git-repository-id", "Git repository id");
 			}
 			
 			testUpdate(c, fCreate, fUpdate, c.findDataSet, fCheck);
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/ContentCopy.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/ContentCopy.js
index 57fc016bc9e..c4f03d27d73 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/ContentCopy.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/ContentCopy.js
@@ -9,6 +9,7 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 		prototype.externalCode = null;
 		prototype.path = null;
 		prototype.gitCommitHash = null;
+		prototype.gitRepositoryId = null;
 		
 		prototype.getId = function() {
 			return this.id;
@@ -40,6 +41,12 @@ define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) {
 		prototype.setGitCommitHash = function(gitCommitHash) {
 			this.gitCommitHash = gitCommitHash;
 		};
+		prototype.getGitRepositoryId = function() {
+			return this.gitRepositoryId;
+		};
+		prototype.setGitRepositoryId = function(gitRepositoryId) {
+			this.gitRepositoryId = gitRepositoryId;
+		};
 	}, {
 		id : "ContentCopyPermId",
 		externalDms : "ExternalDms"
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/create/ContentCopyCreation.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/create/ContentCopyCreation.js
index 1f9c6db1a6d..27a9e0f2939 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/create/ContentCopyCreation.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/create/ContentCopyCreation.js
@@ -7,6 +7,7 @@ define([ "stjs" ], function(stjs) {
     prototype.externalId = null;
     prototype.path = null;
     prototype.gitCommitHash = null;
+    prototype.gitRepositoryId = null;
     prototype.externalDmsId = null;
     
     prototype.getExternalId = function() {
@@ -27,6 +28,12 @@ define([ "stjs" ], function(stjs) {
     prototype.setGitCommitHash = function(gitCommitHash) {
       this.gitCommitHash = gitCommitHash;
     };
+    prototype.getGitRepositoryId = function() {
+      return this.gitRepositoryId;
+    };
+    prototype.setGitRepositoryId = function(gitRepositoryId) {
+      this.gitRepositoryId = gitRepositoryId;
+    };
     prototype.getExternalDmsId = function() {
       return this.externalDmsId;
     };
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/search/ContentCopySearchCriteria.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/search/ContentCopySearchCriteria.js
index 79d61a107f1..50d265efb99 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/search/ContentCopySearchCriteria.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/search/ContentCopySearchCriteria.js
@@ -2,7 +2,7 @@
  * @author anttil
  */
 define([ "require", "stjs", "as/dto/common/search/AbstractObjectSearchCriteria", "as/dto/dataset/search/ExternalDmsSearchCriteria", "as/dto/dataset/search/ExternalCodeSearchCriteria", "as/dto/dataset/search/PathSearchCriteria", "as/dto/dataset/search/GitCommitHashSearchCriteria",
-		"as/dto/common/search/AbstractCompositeSearchCriteria" ], function(require, stjs, AbstractObjectSearchCriteria) {
+	"as/dto/dataset/search/GitRepositoryIdSearchCriteria", "as/dto/common/search/AbstractCompositeSearchCriteria" ], function(require, stjs, AbstractObjectSearchCriteria) {
 	var ContentCopySearchCriteria = function() {
 		AbstractObjectSearchCriteria.call(this);
 	};
@@ -29,7 +29,12 @@ define([ "require", "stjs", "as/dto/common/search/AbstractObjectSearchCriteria",
 			var GitCommitHashSearchCriteria = require("as/dto/dataset/search/GitCommitHashSearchCriteria");
 			return this.addCriteria(new GitCommitHashSearchCriteria());
 		};
-		
+
+		prototype.withGitRepositoryId = function() {
+			var GitRepositoryIdSearchCriteria = require("as/dto/dataset/search/GitRepositoryIdSearchCriteria");
+			return this.addCriteria(new GitRepositoryIdSearchCriteria());
+		};
+
 	}, {
 		criteria : {
 			name : "Collection",
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/search/GitRepositoryIdSearchCriteria.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/search/GitRepositoryIdSearchCriteria.js
new file mode 100644
index 00000000000..8dfdc6d093e
--- /dev/null
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/dataset/search/GitRepositoryIdSearchCriteria.js
@@ -0,0 +1,15 @@
+define([ "stjs", "as/dto/common/search/StringFieldSearchCriteria", "as/dto/common/search/SearchFieldType" ], function(stjs, StringFieldSearchCriteria, SearchFieldType) {
+	var GitRepositoryIdSearchCriteria = function() {
+		StringFieldSearchCriteria.call(this, "gitRepositoryId", SearchFieldType.ATTRIBUTE);
+	};
+	stjs.extend(GitRepositoryIdSearchCriteria, StringFieldSearchCriteria, [ StringFieldSearchCriteria ], function(constructor, prototype) {
+		prototype['@type'] = 'as.dto.dataset.search.GitRepositoryIdSearchCriteria';
+		constructor.serialVersionUID = 1;
+	}, {
+		fieldType : {
+			name : "Enum",
+			arguments : [ "SearchFieldType" ]
+		}
+	});
+	return GitRepositoryIdSearchCriteria;
+})
\ No newline at end of file
-- 
GitLab