git-svn-id: https://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/Common/storagehub-client@167831 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
2e7f2c5997
commit
0d88de7118
|
@ -187,6 +187,27 @@ public class DefaultItemManager implements ItemManagerClient {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToTrash(String id) {
|
||||
Call<WebTarget, Void> call = new Call<WebTarget, Void>() {
|
||||
@Override
|
||||
public Void call(WebTarget manager) throws Exception {
|
||||
WebTarget myManager = manager.path(id)
|
||||
.path("moveToTrash");
|
||||
Invocation.Builder builder = myManager.request();
|
||||
|
||||
builder.put(Entity.text("Thrash"), Response.class);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
try {
|
||||
delegate.make(call);
|
||||
}catch(Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<? extends Item> getAnchestors(String id, String... excludeNodes) {
|
||||
Call<WebTarget, ItemList> call = new Call<WebTarget, ItemList>() {
|
||||
|
|
|
@ -32,5 +32,7 @@ public interface ItemManagerClient {
|
|||
FolderItem createFolder(String parentId, String name, String description);
|
||||
|
||||
List<ACL> getACL(String id);
|
||||
|
||||
void moveToTrash(String id);
|
||||
|
||||
}
|
||||
|
|
|
@ -48,11 +48,11 @@ public class TestCall {
|
|||
List<? extends Item> items = itemclient.getChildren(ws.getId(),10, 5, "hl:accounting", "jcr:content");
|
||||
List<? extends Item> Vreitems = client.getVreFolders("hl:accounting");
|
||||
List<? extends Item> VreitemsPaged = client.getVreFolders(5,5, "hl:accounting");
|
||||
|
||||
|
||||
System.out.println("items are "+items.size());
|
||||
|
||||
|
||||
System.out.println("vreItems are "+Vreitems.size());
|
||||
|
||||
|
||||
System.in.read();
|
||||
}
|
||||
|
||||
|
@ -60,26 +60,35 @@ public class TestCall {
|
|||
public void getById() throws Exception{
|
||||
final ItemManagerClient client = AbstractPlugin.item().build();
|
||||
List<? extends Item> items = client.getAnchestors("29b417e2-dc2f-419a-be0b-7f49e76c9d7c", "hl:accounting", "jcr:content");
|
||||
|
||||
|
||||
System.out.println("items are "+items.size());
|
||||
|
||||
|
||||
for (Item item: items)
|
||||
System.out.println(item.getName()+ " "+item.getPath());
|
||||
|
||||
|
||||
System.in.read();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void moveToThrash() throws Exception{
|
||||
final ItemManagerClient client = AbstractPlugin.item().build();
|
||||
client.moveToTrash("ac630298-e45e-4003-afca-950447612ff6");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getACL() throws Exception{
|
||||
final ItemManagerClient client = AbstractPlugin.item().build();
|
||||
try {
|
||||
List<ACL> acls = client.getACL("790e4c52-fbca-48e9-b267-67ea2ce708c0");
|
||||
|
||||
System.out.println("items are "+acls.size());
|
||||
|
||||
|
||||
for (ACL acl: acls)
|
||||
System.out.println(acl.getPricipal()+ " "+acl.getAccessTypes());
|
||||
List<ACL> acls = client.getACL("790e4c52-fbca-48e9-b267-67ea2ce708c0");
|
||||
|
||||
System.out.println("items are "+acls.size());
|
||||
|
||||
|
||||
for (ACL acl: acls)
|
||||
System.out.println(acl.getPricipal()+ " "+acl.getAccessTypes());
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -108,20 +117,20 @@ public class TestCall {
|
|||
final ItemManagerClient client = AbstractPlugin.item().build();
|
||||
long start = System.currentTimeMillis();
|
||||
System.out.println("found "+client.childrenCount("07cd8d55-a35b-4445-9680-c98f158c55de")+" children");
|
||||
|
||||
|
||||
System.out.println("count took: "+(System.currentTimeMillis()-start) );
|
||||
|
||||
|
||||
System.in.read();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getVreFolder() {
|
||||
ItemManagerClient itemclient = AbstractPlugin.item().build();
|
||||
WorkspaceManagerClient wsclient = AbstractPlugin.workspace().build();
|
||||
wsclient.getVreFolders("hl:accounting");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void createFolder() {
|
||||
long start= System.currentTimeMillis();
|
||||
|
@ -129,20 +138,20 @@ public class TestCall {
|
|||
WorkspaceManagerClient wsclient = AbstractPlugin.workspace().build();
|
||||
String id = wsclient.getWorkspace("hl:accounting", "jcr:content").getId();
|
||||
System.out.println("getting the WS id took "+(System.currentTimeMillis()-start));
|
||||
|
||||
|
||||
itemclient.createFolder(id,"quinto tentativo","5 tentativo");
|
||||
System.out.println("creating folder took total "+(System.currentTimeMillis()-start));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void search() {
|
||||
|
||||
|
||||
Query<SearchableItem<?>> query = Queries.queryFor(AbstractFileItem.class);
|
||||
/*
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.YEAR, 2015);
|
||||
*/
|
||||
|
||||
*/
|
||||
|
||||
WorkspaceManagerClient wsclient = AbstractPlugin.workspace().build();
|
||||
String path = wsclient.getVreFolder("hl:accounting").getPath();
|
||||
System.out.println("path is "+path);
|
||||
|
@ -154,9 +163,9 @@ public class TestCall {
|
|||
System.out.println(item.getName()+" "+item.getLastModificationTime().getTimeInMillis());
|
||||
}
|
||||
System.out.println("items are "+items.size());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void createFolder() throws Exception{
|
||||
|
|
Loading…
Reference in New Issue