From 73e1003326f822b19dd16f36516472364acfec53 Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Tue, 8 Jan 2019 14:24:42 +0000 Subject: [PATCH] added getPublicLinkForFileVersion git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/storagehub-client-wrapper@176368 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../server/StorageHubClientService.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java b/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java index b09f534..077520a 100644 --- a/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java +++ b/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java @@ -678,6 +678,24 @@ public class StorageHubClientService { } + /** + * Gets the public link for file version. + * + * @param fileItemId the file item id + * @return the public link for file version + * @throws Exception the exception + */ + public URL getPublicLinkForFileVersion(String fileItemId, String version) throws Exception{ + + Validate.notNull(fileItemId, "Bad request of getPublicLinkForFile, the fileItemId is null"); + Validate.notNull(version, "Bad request of getPublicLinkForFileVersion, the version is null"); + Validate.notEmpty(version, "Bad request of getPublicLinkForFileVersion, the version is empty"); + setContextProviders(scope, authorizationToken); + return shcClient.open(fileItemId).asFile().getPublicLink(version); + + } + + /** * Gets the list versions. *