git-svn-id: https://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/Common/storagehub-client@179675 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
77e7075e29
commit
3227f32990
|
@ -4,6 +4,7 @@ import java.io.InputStream;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.common.authorization.library.AuthorizationEntry;
|
||||
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
|
||||
import org.gcube.common.storagehub.model.acls.ACL;
|
||||
import org.gcube.common.storagehub.model.acls.AccessType;
|
||||
|
@ -58,6 +59,10 @@ public class FolderContainer extends ItemContainer<FolderItem>{
|
|||
return itemclient.getACL(this.itemId);
|
||||
}
|
||||
|
||||
public boolean canWrite() throws Exception {
|
||||
return itemclient.canWriteInto(this.itemId);
|
||||
}
|
||||
|
||||
public ListResolver findByName(String namePattern) throws StorageHubException {
|
||||
return new ListResolver((onlyType, includeHidden, excludes) -> itemclient.findChildrenByNamePattern(itemId, namePattern , excludes), itemclient);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package org.gcube.common.storagehub.client.proxies;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StreamCorruptedException;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -10,7 +8,6 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.ProcessingException;
|
||||
import javax.ws.rs.client.Entity;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.MultivaluedHashMap;
|
||||
|
@ -889,6 +886,44 @@ public class DefaultItemManager implements ItemManagerClient {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canWriteInto(String id) throws StorageHubException {
|
||||
Call<GXWebTargetAdapterRequest, Boolean> call = new Call<GXWebTargetAdapterRequest, Boolean>() {
|
||||
@Override
|
||||
public Boolean call(GXWebTargetAdapterRequest manager) throws Exception {
|
||||
Objects.requireNonNull(id, "id cannot be null");
|
||||
|
||||
GXWebTargetAdapterRequest myManager = manager.path(id).path("acls").path("write");
|
||||
|
||||
|
||||
GXInboundResponse response = myManager.get();
|
||||
|
||||
if (response.isErrorResponse()) {
|
||||
if (response.hasException())
|
||||
throw response.getException();
|
||||
else
|
||||
throw new BackendGenericError();
|
||||
}
|
||||
|
||||
|
||||
return response.getSource().readEntity(Boolean.class);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
try {
|
||||
return delegate.make(call);
|
||||
}catch(StorageHubException e) {
|
||||
throw e;
|
||||
}catch(Exception e1) {
|
||||
throw new RuntimeException(e1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String changeACL(String id, String user, AccessType accessType) throws StorageHubException {
|
||||
Call<GXWebTargetAdapterRequest, String> call = new Call<GXWebTargetAdapterRequest, String>() {
|
||||
|
|
|
@ -94,6 +94,8 @@ public interface ItemManagerClient {
|
|||
|
||||
void delete(String id, boolean force) throws StorageHubException;
|
||||
|
||||
boolean canWriteInto(String id) throws StorageHubException;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue