Checking the old property isPublic added as "<boolean>true</boolean>" by HL
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/storagehub-client-wrapper@174309 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
53b60d3e11
commit
db3c9eda54
|
@ -17,6 +17,7 @@ import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
|||
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
|
||||
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
|
||||
import org.gcube.common.storagehub.client.proxies.WorkspaceManagerClient;
|
||||
import org.gcube.common.storagehub.model.Metadata;
|
||||
import org.gcube.common.storagehub.model.acls.ACL;
|
||||
import org.gcube.common.storagehub.model.items.AbstractFileItem;
|
||||
import org.gcube.common.storagehub.model.items.FolderItem;
|
||||
|
@ -126,8 +127,6 @@ public class StorageHubClientService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the item.
|
||||
*
|
||||
|
@ -142,6 +141,22 @@ public class StorageHubClientService {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the metadata and returns the Item with metadata updated
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @param metadata the metadata
|
||||
* @return the item
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public Item setMetadata(String itemId, Metadata metadata) throws Exception{
|
||||
setContextProviders(scope, authorizationToken);
|
||||
ItemContainer<Item> itemCont = shcClient.open(itemId).asItem();
|
||||
itemCont.setMetadata(metadata);
|
||||
return itemCont.get();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the folder container.
|
||||
*
|
||||
|
|
|
@ -227,6 +227,17 @@ public final class WorkspaceStorageHubClientService implements Workspace{
|
|||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.common.storagehubwrapper.server.tohl.Workspace#markAsPublic(java.lang.String, boolean)
|
||||
*/
|
||||
@Override
|
||||
public Boolean markAsPublic(String itemId, boolean isPublic) {
|
||||
|
||||
//TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portal.storagehubwrapper.shared.Workspace#getOwner()
|
||||
|
@ -1203,5 +1214,4 @@ public final class WorkspaceStorageHubClientService implements Workspace{
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -184,13 +184,22 @@ public class HLMapper {
|
|||
}
|
||||
}
|
||||
|
||||
((WorkspaceFolder) theItem).setPublicFolder(folderItem.isPublicItem());
|
||||
boolean isPublicItem = folderItem.isPublicItem();
|
||||
//((WorkspaceFolder) theItem).setPublicFolder(folderItem.isPublicItem());
|
||||
//logger.debug("Wrapped as Folder");
|
||||
|
||||
// if(logger.isTraceEnabled()){
|
||||
// WorkspaceFolder theFolder = (WorkspaceFolder) theItem;
|
||||
// logger.debug("Wrapped as Folder");
|
||||
// }
|
||||
//TODO THIS MUST BE REMOVED. Checking the old property isPublic added as "<boolean>true</boolean>" by HL
|
||||
if(!isPublicItem){
|
||||
try{
|
||||
String isPublic = (String) item.getPropertyMap().getValues().get("isPublic");
|
||||
logger.debug("The item name: "+item.getName()+ " has isPublic property like: "+isPublic);
|
||||
isPublicItem = isPublic!=null?isPublic.toLowerCase().contains("true"):false;
|
||||
}catch(Exception e){
|
||||
//silent
|
||||
}
|
||||
}
|
||||
|
||||
((WorkspaceFolder) theItem).setPublicFolder(isPublicItem);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -312,6 +312,15 @@ public interface Workspace{
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Mark as public.
|
||||
*
|
||||
* @param isPublic the is public
|
||||
* @return the boolean
|
||||
*/
|
||||
public Boolean markAsPublic(String itemId, boolean isPublic);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -27,27 +27,27 @@ import org.junit.Test;
|
|||
*/
|
||||
public class WorkspaceInstance {
|
||||
|
||||
|
||||
|
||||
public static String USERNAME = "francesco.mangiacrapa";
|
||||
public static String SCOPE = "/gcube";
|
||||
//public static String SCOPE = "/d4science.research-infrastructures.eu";
|
||||
//public static String TOKEN = "0e2c7963-8d3e-4ea6-a56d-ffda530dd0fa-98187548";
|
||||
//public static String TOKEN = "bdc2e70f-36c3-4db4-8b03-829a973b3095-98187548"; //PREVRE
|
||||
public static String TOKEN = "57b42a99-6239-44c4-9a68-591c18363222-843339462"; //BiodiversityLab
|
||||
|
||||
|
||||
public static String USERNAME = "massimiliano.assante";
|
||||
//public static String USERNAME = "francesco.mangiacrapa";
|
||||
|
||||
public static String TOKEN; //YOU MUST SET THIS AS VM PARAMETER
|
||||
|
||||
|
||||
public static String FIND_FILE_NAME = "francesco";
|
||||
|
||||
public static String rootId = null;
|
||||
|
||||
StorageHubWrapper storageHubWrapper = null;
|
||||
//Workspace workspace = null;
|
||||
|
||||
private StorageHubWrapper storageHubWrapper = null;
|
||||
|
||||
@Before
|
||||
public void init(){
|
||||
|
||||
TOKEN = System.getProperty("token");
|
||||
|
||||
System.out.println("Read TOKEN: "+TOKEN);
|
||||
|
||||
//METHOD 1
|
||||
storageHubWrapper = new StorageHubWrapper(SCOPE, TOKEN);
|
||||
//workspace = storageHubWrapper.getWorkspace();
|
||||
|
@ -88,6 +88,13 @@ public class WorkspaceInstance {
|
|||
// System.out.println(++i+")"+workspaceItem);
|
||||
// System.out.println(workspaceItem.getType() +" "+workspaceItem.getClass());
|
||||
System.out.println(++i+")");
|
||||
|
||||
|
||||
if(workspaceItem.isFolder()){
|
||||
WorkspaceFolder folder = (WorkspaceFolder) workspaceItem;
|
||||
System.out.println("is public? "+folder.isPublicFolder());
|
||||
}
|
||||
|
||||
printMap(workspaceItem);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue