From 557494215e0fe4d686e5a76503110ddde197c0c7 Mon Sep 17 00:00:00 2001 From: elias Date: Thu, 25 Apr 2024 10:37:42 +0200 Subject: [PATCH] #3341: removed doi.org request --- .../relatedPublicationBuilder.service.js | 41 +++---------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/mdm-frontend/src/app/legacy/relatedpublicationmanagement/services/relatedPublicationBuilder.service.js b/mdm-frontend/src/app/legacy/relatedpublicationmanagement/services/relatedPublicationBuilder.service.js index d9012a62a8..d7f8472cfd 100644 --- a/mdm-frontend/src/app/legacy/relatedpublicationmanagement/services/relatedPublicationBuilder.service.js +++ b/mdm-frontend/src/app/legacy/relatedpublicationmanagement/services/relatedPublicationBuilder.service.js @@ -6,20 +6,10 @@ angular.module('metadatamanagementApp') function(RelatedPublicationResource, CleanJSObjectService, RelatedPublicationIdBuilderService, $http, $q) { - const updatePublicationObj = function(publicationObj, doi) { - if (doi) { - return findByDOI(doi).then(function(data) { - publicationObj.journal = data.data["container-title"] ? data.data["container-title"] : null; - if (data.data.hasOwnProperty("journal-issue")){ - publicationObj.issue = data.data["journal-issue"].issue ? data.data["journal-issue"].issue : null; - } - return new RelatedPublicationResource(CleanJSObjectService.removeEmptyJsonObjects(publicationObj)); - }); - } else { - return $q((resolve, reject) => { - resolve(new RelatedPublicationResource(CleanJSObjectService.removeEmptyJsonObjects(publicationObj))) - }); - } + const updatePublicationObj = function(publicationObj) { + return $q((resolve, reject) => { + resolve(new RelatedPublicationResource(CleanJSObjectService.removeEmptyJsonObjects(publicationObj))) + }); } var getRelatedPublications = async function(relatedPublications) { @@ -27,7 +17,6 @@ angular.module('metadatamanagementApp') var promises = []; for (var i = 0; i < relatedPublications.length; i++) { var data = relatedPublications[i]; - var doi = getPropertyByKeyPattern(data, /^DOI$/i); var bibTexKey = getPropertyByKeyPattern(data, /^BibTeX Key$/i); var publicationObj = { @@ -37,7 +26,7 @@ angular.module('metadatamanagementApp') bibTexKey) : undefined, sourceReference: getPropertyByKeyPattern(data, /^sourceReference.*$/i), - doi: doi, + doi: getPropertyByKeyPattern(data, /^DOI$/i), title: getPropertyByKeyPattern(data, /^Titel$/i), authors: getPropertyByKeyPattern(data, /^Autor.*$/i), language: getPropertyByKeyPattern(data, /^Sprache$/i), @@ -56,7 +45,7 @@ angular.module('metadatamanagementApp') publicationAbstract: getPropertyByKeyPattern(data, /^Abstract$/i) /* jshint +W069 */ }; - promises.push(updatePublicationObj(publicationObj, doi)); + promises.push(updatePublicationObj(publicationObj)); }; return await new Promise((resolve, reject) => { @@ -72,24 +61,6 @@ angular.module('metadatamanagementApp') })[0]]; }; - /** - * This function sends a request to http://doi.org/{doi} - * and returns the response as Promise. - * @param doi A DOI code, e.g. "10.5771/0038-6073-2023-2-173" - */ - var findByDOI = function(doi) { - return $http({ - method: 'GET', - url: 'http://doi.org/' + doi, - headers: { - 'Accept': 'application/json' - } - }).then(function(data) { - var response = angular.fromJson(data); - return response; - }); - } - return { getRelatedPublications: getRelatedPublications };