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:
parent
11b602fd59
commit
2ce82fc867
|
@ -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());
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue