Updated the download facility adding also the versionName

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/storagehub-client-wrapper@173365 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-10-12 13:19:11 +00:00
parent 11b602fd59
commit 2ce82fc867
3 changed files with 13 additions and 7 deletions

View File

@ -349,13 +349,19 @@ public class StorageHubClientService {
* Download file.
*
* @param itemId the item id
* @param versionName the version name. If is null or empty returns the latest version of file
* @param nodeIdsToExclude the node ids to exclude
* @return the stream descriptor
* @throws Exception the exception
*/
public StreamDescriptor downloadFile(String itemId, String nodeIdsToExclude) throws Exception{
public StreamDescriptor downloadFile(String itemId, String versionName, String... nodeIdsToExclude) throws Exception{
StreamDescriptor streamDesc = shcClient.open(itemId).asFile().download(nodeIdsToExclude);
StreamDescriptor streamDesc;
if(versionName!=null && !versionName.isEmpty()){
streamDesc = shcClient.open(itemId).asFile().downloadSpecificVersion(versionName);
}else{
streamDesc = shcClient.open(itemId).asFile().download(nodeIdsToExclude);
}
return new StreamDescriptor(streamDesc.getStream(), streamDesc.getFileName());
}

View File

@ -642,15 +642,16 @@ public final class WorkspaceStorageHubClientService implements Workspace{
*
* @param itemId the item id
* @param fileName the file name
* @param versionName the version name
* @param nodeIdsToExclude the node ids to exclude
* @return the file stream descriptor
* @throws Exception the exception
*/
@Override
public ItemStreamDescriptor downloadFile(String itemId, String fileName, String nodeIdsToExclude) throws Exception{
public ItemStreamDescriptor downloadFile(String itemId, String fileName, String versionName, String... nodeIdsToExclude) throws Exception{
try {
StreamDescriptor streamDesc = storageHubClientService.downloadFile(itemId, nodeIdsToExclude);
StreamDescriptor streamDesc = storageHubClientService.downloadFile(itemId, versionName, nodeIdsToExclude);
return new org.gcube.common.storagehubwrapper.shared.tohl.impl.StreamDescriptor(streamDesc.getStream(), streamDesc.getFileName());
} catch (Exception e) {
logger.error("Error on downloading the file: "+fileName+ " with id: "+itemId, e);

View File

@ -769,13 +769,12 @@ public interface Workspace{
*
* @param itemId the item id
* @param fileName the file name
* @param versionName the version name. If is null or empty returns the latest version of file
* @param nodeIdsToExclude the node ids to exclude
* @return the item stream descriptor
* @throws Exception the exception
*/
ItemStreamDescriptor downloadFile(
String itemId, String fileName, String nodeIdsToExclude)
throws Exception;
ItemStreamDescriptor downloadFile(String itemId, String fileName, String versionName, String... nodeIdsToExclude) throws Exception;
/**