From 1e1889d671eef1bf0e30d0f482767eac4e82302a Mon Sep 17 00:00:00 2001 From: Aldo Mihasi Date: Tue, 17 Jan 2023 14:43:10 +0200 Subject: [PATCH] add repository logo --- .../zenodorepository/config/ConfigLoader.java | 1 + .../config/ConfigLoaderImpl.java | 17 ++++++++++++++++- .../zenodorepository/config/ZenodoConfig.java | 10 ++++++++++ .../interfaces/ZenodoDeposit.java | 10 ++++++++++ src/main/resources/application.properties | 1 + src/main/resources/zenodo.jpg | Bin 0 -> 9365 bytes 6 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/zenodo.jpg diff --git a/src/main/java/eu/eudat/depositinterface/zenodorepository/config/ConfigLoader.java b/src/main/java/eu/eudat/depositinterface/zenodorepository/config/ConfigLoader.java index 72873bf..e279014 100644 --- a/src/main/java/eu/eudat/depositinterface/zenodorepository/config/ConfigLoader.java +++ b/src/main/java/eu/eudat/depositinterface/zenodorepository/config/ConfigLoader.java @@ -4,5 +4,6 @@ import java.util.List; public interface ConfigLoader { List getDOIFunders(); + byte[] getLogo(); ZenodoConfig getZenodoConfig(); } diff --git a/src/main/java/eu/eudat/depositinterface/zenodorepository/config/ConfigLoaderImpl.java b/src/main/java/eu/eudat/depositinterface/zenodorepository/config/ConfigLoaderImpl.java index 0d7160d..450072a 100644 --- a/src/main/java/eu/eudat/depositinterface/zenodorepository/config/ConfigLoaderImpl.java +++ b/src/main/java/eu/eudat/depositinterface/zenodorepository/config/ConfigLoaderImpl.java @@ -39,7 +39,6 @@ public class ConfigLoaderImpl implements ConfigLoader{ @Override public ZenodoConfig getZenodoConfig() { - logger.debug("configuration.zenodo = " + environment.getProperty("configuration.zenodo")); if (zenodoConfig == null) { try { zenodoConfig = mapper.readValue(getStreamFromPath(environment.getProperty("configuration.zenodo")), ZenodoConfig.class); @@ -51,6 +50,22 @@ public class ConfigLoaderImpl implements ConfigLoader{ return zenodoConfig; } + @Override + public byte[] getLogo() { + String logo = "zenodo.jpg"; + if(logo != null && !logo.isEmpty()){ + InputStream logoStream = getStreamFromPath(logo); + try { + return logoStream.readAllBytes(); + } + catch (IOException e){ + logger.error(e.getMessage(), e); + return null; + } + } + return null; + } + private InputStream getStreamFromPath(String filePath) { try { return new FileInputStream(filePath); diff --git a/src/main/java/eu/eudat/depositinterface/zenodorepository/config/ZenodoConfig.java b/src/main/java/eu/eudat/depositinterface/zenodorepository/config/ZenodoConfig.java index 763981e..02aafdb 100644 --- a/src/main/java/eu/eudat/depositinterface/zenodorepository/config/ZenodoConfig.java +++ b/src/main/java/eu/eudat/depositinterface/zenodorepository/config/ZenodoConfig.java @@ -52,6 +52,8 @@ public class ZenodoConfig { private String repositoryClientSecret; @JsonProperty("redirectUri") private String redirectUri; + @JsonProperty("hasLogo") + private boolean hasLogo; public int getDepositType() { return depositType; @@ -123,6 +125,13 @@ public class ZenodoConfig { this.redirectUri = redirectUri; } + public boolean isHasLogo() { + return hasLogo; + } + public void setHasLogo(boolean hasLogo) { + this.hasLogo = hasLogo; + } + public RepositoryDepositConfiguration toRepoConfig() { RepositoryDepositConfiguration config = new RepositoryDepositConfiguration(); config.setDepositType(this.depositType); @@ -135,6 +144,7 @@ public class ZenodoConfig { config.setRepositoryClientId(this.repositoryClientId); config.setRepositoryClientSecret(this.repositoryClientSecret); config.setRedirectUri(this.redirectUri); + config.setHasLogo(this.hasLogo); return config; } } diff --git a/src/main/java/eu/eudat/depositinterface/zenodorepository/interfaces/ZenodoDeposit.java b/src/main/java/eu/eudat/depositinterface/zenodorepository/interfaces/ZenodoDeposit.java index dc41987..6436424 100644 --- a/src/main/java/eu/eudat/depositinterface/zenodorepository/interfaces/ZenodoDeposit.java +++ b/src/main/java/eu/eudat/depositinterface/zenodorepository/interfaces/ZenodoDeposit.java @@ -228,6 +228,16 @@ public class ZenodoDeposit implements RepositoryDeposit { return null; } + @Override + public String getLogo() { + RepositoryDepositConfiguration conf = this.getConfiguration(); + if(conf.isHasLogo()){ + byte[] logo = this.configLoader.getLogo(); + return (logo != null && logo.length != 0) ? Base64.getEncoder().encodeToString(logo) : null; + } + return null; + } + private String getUnpublishedDOI(String zenodoUrl, String DOI, String token, Integer version) { try { RestTemplate restTemplate = new RestTemplate(); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index affb021..edb8c21 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,3 +1,4 @@ configuration.doi_funder=DOI_Funder.json +configuration.logo=zenodo.jpg storage.temp=${STORAGE_TMP_ZENODO} configuration.zenodo=${CONFIGURATION_ZENODO} diff --git a/src/main/resources/zenodo.jpg b/src/main/resources/zenodo.jpg new file mode 100644 index 0000000000000000000000000000000000000000..fb919d4ac34d0d50191ddcba5c8de46113f1d9d4 GIT binary patch literal 9365 zcmb_>cT`hL*ZxTl5K5@hLq{MYy>~(pklsPWfb`x$R1^_GKu}P6M~ZX-LFpn*M0!=4 zH0ekckT2Z(e(T=vpWj-)wcbh21WbL) z$UudFKL7v{y1VjkLhp>RcSA|6XYW)|hi#_?<9cLB*kcR_6Z9m@6+y8GF^x^{s5EFKc z8lVSQ01ki`zyiX61Rw(_0yy9rpbHoQ=D-aA4>$sDfHx2T+yTOX2p}4G1|$M0Kqim} z6ai&G6;KC!09t`hKriqW7y+h$Szr-Z1Ga$!-~7TG6&rRIe^?jexN&`hoERs0w@KP4Jravg6cu7pl;9rXaY0`S_SQbeuE)k6qp*! z4CV$4f+fL9U@fo_*c$8r_5ufk!@;rOSKu7*8*nYS72FFR0ndWh!21vYLIRnmINz+)xbJnBd|r-0UQpeh4a8A z;2LmqxHCKi{uG`LFNe3l2jC0veFOqQkKjkhA#@S82wy}5A{p@p(To^GEFzAOBuG}I zFj5U^fpkYcKqeuJkxj@!`WX+{EE1YxPy3__!kKY2|I}ti9U%F$$gSnBo!oGBy%LkC`uF`N(E(w@)Wili2#zNE3FMWpSd-${?isK~C6X_DEI-6KmSt0fyG+axC<=OR}kzd;^M zoMqMl-mVjoR~7DDTy-Ox|b#prJI3MGP)n-WK9M;T6; zO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