added implementaton for getting property by id
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@169397 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e3da069d02
commit
e96de8c2a2
|
@ -3,11 +3,14 @@ package org.gcube.portlets.widgets.wsexplorer.server;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
||||
import org.gcube.common.storagehub.model.Metadata;
|
||||
import org.gcube.common.storagehub.model.items.AbstractFileItem;
|
||||
import org.gcube.common.storagehub.model.items.FolderItem;
|
||||
import org.gcube.common.storagehub.model.items.Item;
|
||||
|
@ -459,26 +462,17 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> getGcubePropertiesForWorspaceId(String id) throws Exception {
|
||||
_log.trace("getGcubePropertiesForWorspaceId "+id);
|
||||
//TODO
|
||||
return null;
|
||||
// try {
|
||||
//
|
||||
// if(id==null || id.isEmpty()){
|
||||
// logger.info(id +" is null or empty returing empty map as GcubeProperties");
|
||||
// return new HashMap<String, String>(1);
|
||||
// }
|
||||
//
|
||||
// Workspace workspace = getWorkspace();
|
||||
// WorkspaceItem item = workspace.getItem(id);
|
||||
//
|
||||
// return ItemBuilder.getGcubePropertiesForItem(item);
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// logger.error("Error during folder retrieving", e);
|
||||
// throw new WorkspaceNavigatorServiceException("Sorry, an error occurred when performing get folder");
|
||||
// }
|
||||
public Map<String, String> getGcubePropertiesForWorspaceId(String itemId) throws Exception {
|
||||
_log.trace("getGcubePropertiesForWorspaceId "+itemId);
|
||||
try {
|
||||
StorageHubClient shc = new StorageHubClient();
|
||||
Item item = shc.open(itemId).asItem().get();
|
||||
return ItemBuilder.getGcubePropertiesForItem(item);
|
||||
|
||||
} catch (Throwable e) {
|
||||
_log.error(e.getLocalizedMessage(), e);
|
||||
return new HashMap<String, String>();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
Loading…
Reference in New Issue