Move WS Folder Utility
This commit is contained in:
parent
0bea1699a1
commit
2fc02e6411
|
@ -17,17 +17,16 @@ public class DescribeWSFolder {
|
||||||
static StorageHubClient shc =null;
|
static StorageHubClient shc =null;
|
||||||
|
|
||||||
public static void main(String[] args) throws StorageHubException {
|
public static void main(String[] args) throws StorageHubException {
|
||||||
// String context="/gcube/devsec/devVRE";
|
String context="/gcube/devsec/devVRE";
|
||||||
String context="/d4science.research-infrastructures.eu/D4OS/GeoNA-Prototype";
|
String folderID="...";
|
||||||
String folderID="46b376db-32d7-4411-ad04-ca3dadab5f5b";
|
Boolean recursive = false;
|
||||||
Boolean recursive = true;
|
|
||||||
|
|
||||||
TokenSetter.set(context);
|
TokenSetter.set(context);
|
||||||
shc= new StorageHubClient();
|
shc= new StorageHubClient();
|
||||||
shc.openVREFolder().get().getDescription();
|
shc.openVREFolder().get().getDescription();
|
||||||
|
|
||||||
// FolderContainer folder=shc.open(folderID).asFolder();
|
FolderContainer folder=shc.open(folderID).asFolder();
|
||||||
FolderContainer folder = WorkspaceManager.getApplicationBaseFolder(shc);
|
// FolderContainer folder = WorkspaceManager.getApplicationBaseFolder(shc);
|
||||||
|
|
||||||
FolderItem item=folder.get();
|
FolderItem item=folder.get();
|
||||||
System.out.print("PATH : "+item.getPath()+"\tHIDDEN : "+item.isHidden()+"\tDescription : "+item.getDescription());
|
System.out.print("PATH : "+item.getPath()+"\tHIDDEN : "+item.isHidden()+"\tDescription : "+item.getDescription());
|
||||||
|
|
|
@ -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");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue