Move WS Folder Utility

This commit is contained in:
Fabio Sinibaldi 2022-01-28 17:12:32 +01:00
parent 0bea1699a1
commit 2fc02e6411
2 changed files with 36 additions and 6 deletions

View File

@ -17,17 +17,16 @@ public class DescribeWSFolder {
static StorageHubClient shc =null;
public static void main(String[] args) throws StorageHubException {
// String context="/gcube/devsec/devVRE";
String context="/d4science.research-infrastructures.eu/D4OS/GeoNA-Prototype";
String folderID="46b376db-32d7-4411-ad04-ca3dadab5f5b";
Boolean recursive = true;
String context="/gcube/devsec/devVRE";
String folderID="...";
Boolean recursive = false;
TokenSetter.set(context);
shc= new StorageHubClient();
shc.openVREFolder().get().getDescription();
// FolderContainer folder=shc.open(folderID).asFolder();
FolderContainer folder = WorkspaceManager.getApplicationBaseFolder(shc);
FolderContainer folder=shc.open(folderID).asFolder();
// FolderContainer folder = WorkspaceManager.getApplicationBaseFolder(shc);
FolderItem item=folder.get();
System.out.print("PATH : "+item.getPath()+"\tHIDDEN : "+item.isHidden()+"\tDescription : "+item.getDescription());

View File

@ -0,0 +1,31 @@
package org.gcube.application.geoportal.service.ws;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.service.engine.WorkspaceManager;
import org.gcube.common.storagehub.client.dsl.FolderContainer;
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
public class MoveWSFolder {
public static void main(String[] args) throws StorageHubException {
// Get original folder id
// Set original VRE token
TokenSetter.set("...");
// Get appBaseFolder ID
StorageHubClient shc = new StorageHubClient();
FolderContainer toMoveFolder= WorkspaceManager.getApplicationBaseFolder(shc);
System.out.println("TO MOVE FOLDR ID IS "+toMoveFolder.getId());
// Set token for target VRE
// MV
String destinationFolderID = "...";
FolderContainer destinationFolder = shc.open(destinationFolderID).asFolder();
System.out.println("MOVING NOW ..");
toMoveFolder.move(destinationFolder);
System.out.println("DONE");
}
}