WS Utils
This commit is contained in:
parent
44b0d027e9
commit
6e49b095e4
|
@ -0,0 +1,43 @@
|
||||||
|
package org.gcube.application.cms.usecases.ws;
|
||||||
|
|
||||||
|
import org.gcube.application.cms.tests.TokenSetter;
|
||||||
|
import org.gcube.common.storagehub.client.dsl.FolderContainer;
|
||||||
|
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
||||||
|
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
|
||||||
|
import org.gcube.common.storagehub.model.items.Item;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ClearWS {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws StorageHubException {
|
||||||
|
String context="/gcube/devsec/devVRE";
|
||||||
|
String folderID="2a688014-cf98-464d-aa7c-38f1667f5542";
|
||||||
|
Boolean recursive = false;
|
||||||
|
|
||||||
|
TokenSetter.set(context);
|
||||||
|
final StorageHubClient shc = new StorageHubClient();
|
||||||
|
shc.openVREFolder().get().getDescription();
|
||||||
|
|
||||||
|
FolderContainer folder=shc.open(folderID).asFolder();
|
||||||
|
|
||||||
|
List<? extends Item> items = folder.list().getItems();
|
||||||
|
System.out.println("Folder "+folder.get().getPath()+" has elements : "+ items.size());
|
||||||
|
|
||||||
|
//folder.delete();
|
||||||
|
|
||||||
|
//
|
||||||
|
// items.forEach(item -> {
|
||||||
|
// try {
|
||||||
|
// System.out.println("Deleting "+item.getPath());
|
||||||
|
// shc.open(item.getId()).asFolder().delete();
|
||||||
|
// } catch (StorageHubException e) {
|
||||||
|
// e.printStackTrace(System.err);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.application.geoportal.service.ws;
|
package org.gcube.application.cms.usecases.ws;
|
||||||
|
|
||||||
import org.gcube.application.cms.tests.TokenSetter;
|
import org.gcube.application.cms.tests.TokenSetter;
|
||||||
import org.gcube.common.storagehub.client.dsl.FolderContainer;
|
import org.gcube.common.storagehub.client.dsl.FolderContainer;
|
||||||
|
@ -19,8 +19,8 @@ public class DescribeWSFolder {
|
||||||
|
|
||||||
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 folderID="...";
|
String folderID="2a688014-cf98-464d-aa7c-38f1667f5542";
|
||||||
Boolean recursive = false;
|
Boolean recursive = true;
|
||||||
|
|
||||||
TokenSetter.set(context);
|
TokenSetter.set(context);
|
||||||
shc= new StorageHubClient();
|
shc= new StorageHubClient();
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.application.geoportal.service.ws;
|
package org.gcube.application.cms.usecases.ws;
|
||||||
|
|
||||||
import org.gcube.application.cms.implementations.WorkspaceManager;
|
import org.gcube.application.cms.implementations.WorkspaceManager;
|
||||||
import org.gcube.application.cms.tests.TokenSetter;
|
import org.gcube.application.cms.tests.TokenSetter;
|
Loading…
Reference in New Issue