diff --git a/core/src/main/java/org/opencdmp/deposit/zenodorepository/model/builder/ZenodoBuilder.java b/core/src/main/java/org/opencdmp/deposit/zenodorepository/model/builder/ZenodoBuilder.java index 31c18f8..3955e70 100644 --- a/core/src/main/java/org/opencdmp/deposit/zenodorepository/model/builder/ZenodoBuilder.java +++ b/core/src/main/java/org/opencdmp/deposit/zenodorepository/model/builder/ZenodoBuilder.java @@ -280,14 +280,14 @@ public class ZenodoBuilder { List dmpGrants = this.getReferenceModelOfType(dmp, zenodoServiceProperties.getGrantReferenceCode()); List dmpFunders = this.getReferenceModelOfType(dmp, zenodoServiceProperties.getFunderReferenceCode()); - if (dmpGrants != null && !dmpGrants.isEmpty()) { + if (!dmpGrants.isEmpty()) { ReferenceModel depositGrant = dmpGrants.stream().filter(x-> x.getSource().equalsIgnoreCase(zenodoServiceProperties.getOpenaireGrantSourceCode())).findFirst().orElse(null); if (depositGrant != null) { String grantReferenceTail = depositGrant.getReference().split(":")[2]; List doiFunders = this.funderProperties.getAvailable(); - if (dmpFunders != null && !dmpFunders.isEmpty()) { - ReferenceModel depositFunder = dmpFunders.get(0); + if (!dmpFunders.isEmpty()) { + ReferenceModel depositFunder = dmpFunders.getFirst(); FunderProperties.DoiFunder doiFunder = doiFunders.stream() .filter(doiFunder1 -> depositFunder.getLabel().contains(doiFunder1.getFunder()) || doiFunder1.getFunder().contains(depositFunder.getLabel())) .findFirst().orElse(null); diff --git a/core/src/main/java/org/opencdmp/deposit/zenodorepository/service/zenodo/ZenodoDepositServiceImpl.java b/core/src/main/java/org/opencdmp/deposit/zenodorepository/service/zenodo/ZenodoDepositServiceImpl.java index aae9242..50b76a6 100644 --- a/core/src/main/java/org/opencdmp/deposit/zenodorepository/service/zenodo/ZenodoDepositServiceImpl.java +++ b/core/src/main/java/org/opencdmp/deposit/zenodorepository/service/zenodo/ZenodoDepositServiceImpl.java @@ -369,7 +369,10 @@ public class ZenodoDepositServiceImpl implements ZenodoDepositService { return WebClient.builder().filters(exchangeFilterFunctions -> { exchangeFilterFunctions.add(logRequest()); exchangeFilterFunctions.add(logResponse()); - }).build(); + }).codecs(codecs -> codecs + .defaultCodecs() + .maxInMemorySize(this.zenodoServiceProperties.getMaxInMemorySizeInBytes()) + ).build(); } private static ExchangeFilterFunction logRequest() { diff --git a/core/src/main/java/org/opencdmp/deposit/zenodorepository/service/zenodo/ZenodoServiceProperties.java b/core/src/main/java/org/opencdmp/deposit/zenodorepository/service/zenodo/ZenodoServiceProperties.java index 7180d24..7a1eae8 100644 --- a/core/src/main/java/org/opencdmp/deposit/zenodorepository/service/zenodo/ZenodoServiceProperties.java +++ b/core/src/main/java/org/opencdmp/deposit/zenodorepository/service/zenodo/ZenodoServiceProperties.java @@ -22,6 +22,7 @@ public class ZenodoServiceProperties { private String licensesReferenceCode; private String openaireGrantSourceCode; private String orcidResearcherSourceCode; + private int maxInMemorySizeInBytes; public String getLogo() { return logo; @@ -118,4 +119,12 @@ public class ZenodoServiceProperties { public void setOrcidResearcherSourceCode(String orcidResearcherSourceCode) { this.orcidResearcherSourceCode = orcidResearcherSourceCode; } + + public int getMaxInMemorySizeInBytes() { + return maxInMemorySizeInBytes; + } + + public void setMaxInMemorySizeInBytes(int maxInMemorySizeInBytes) { + this.maxInMemorySizeInBytes = maxInMemorySizeInBytes; + } } diff --git a/web/src/main/resources/config/app.env b/web/src/main/resources/config/app.env new file mode 100644 index 0000000..6ca6a0f --- /dev/null +++ b/web/src/main/resources/config/app.env @@ -0,0 +1,14 @@ +IDP_ISSUER_URI=http://dev03.local.cite.gr:60201/realms/dmp-development + +WEB_PORT=8082 + +ZENODO_AUTHORIZATION_URL=https://sandbox.zenodo.org/oauth/authorize +ZENODO_ACCESS_TOKEN_URL=https://sandbox.zenodo.org/oauth/token +ZENODO_CLIENT_ID=mdwl77ZpDaY4DKxzaHdfpUz4vpjtusfSdLuHzfxe +ZENODO_CLIENT_SECRET=cvTkkzmfkO7OBYIJQ2ZEWfc309ELwJBJe3rtOHZL2ITcX27woE7IUAw5NMsU +ZENODO_ACCESS_TOKEN=uUwXiySNn637uWQpcsfOtifsmLfP0lgp0N8uOssppb7ajeJCq5WicHbcC2Vk +ZENODO_URL=https://sandbox.zenodo.org/api/ +ZENODO_RECORD_URL=https://sandbox.zenodo.org/record/ +REDIRECT_URL=http://localhost:4200/login/external/zenodo + +STORAGE_PATH=/storage \ No newline at end of file diff --git a/web/src/main/resources/config/zenodo-devel.yml b/web/src/main/resources/config/zenodo-devel.yml index bf49661..e49852e 100644 --- a/web/src/main/resources/config/zenodo-devel.yml +++ b/web/src/main/resources/config/zenodo-devel.yml @@ -4,15 +4,5 @@ zenodo: domain: https://argos.openaire.eu/ logo: classpath:zenodo.jpg depositConfiguration: - deposit-type: 2 - repository-id: zenodo - access-token: ${ZENODO_ACCESS_TOKEN} - repository-url: https://sandbox.zenodo.org/api/ - repository-authorization-url: https://sandbox.zenodo.org/oauth/authorize - repository-record-url: https://sandbox.zenodo.org/record/ - repository-access-token-url: https://sandbox.zenodo.org/oauth/token - repository-client-id: - repository-client-secret: - redirect-uri: http://localhost:4200/login/external/zenodo has-logo: true useSharedStorage: false diff --git a/web/src/main/resources/config/zenodo.yml b/web/src/main/resources/config/zenodo.yml index 0ddfbfb..e0246de 100644 --- a/web/src/main/resources/config/zenodo.yml +++ b/web/src/main/resources/config/zenodo.yml @@ -9,4 +9,17 @@ zenodo: publicationReferenceCode: "publications" openaireGrantSourceCode: "openaire" orcidResearcherSourceCode: "ORCID" - \ No newline at end of file + maxInMemorySizeInBytes: 6554000 + depositConfiguration: + deposit-type: 2 + repository-id: zenodo + access-token: ${ZENODO_ACCESS_TOKEN} + repository-url: ${ZENODO_URL} + repository-authorization-url: ${ZENODO_AUTHORIZATION_URL} + repository-record-url: ${ZENODO_RECORD_URL} + repository-access-token-url: ${ZENODO_ACCESS_TOKEN_URL} + repository-client-id: ${ZENODO_CLIENT_ID} + repository-client-secret: ${ZENODO_CLIENT_SECRET} + redirect-uri: ${REDIRECT_URL} + has-logo: true + useSharedStorage: false \ No newline at end of file