added method getMetadata
updated changelog git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/storagehub-client-wrapper@174513 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
610504689b
commit
2572456fb3
|
@ -1,4 +1,9 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.common.storagehubwrapper.0-4-0"
|
||||
date="${buildDate}">
|
||||
<Change>Updated to new SHub interface</Change>
|
||||
<Change>Added method getMetadata</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.common.storagehubwrapper.0-3-0"
|
||||
date="${buildDate}">
|
||||
<Change>[Task #12059] added delete item</Change>
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.common.storagehubwrapper.server;
|
|||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
|
@ -180,8 +181,6 @@ public class StorageHubClientService {
|
|||
* Gets the item.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @param withAccounting the with accounting
|
||||
* @param withMetadata the with metadata
|
||||
* @return the item
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
|
@ -207,6 +206,25 @@ public class StorageHubClientService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the metadata.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @return the metadata
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public Map<String, Object> getMetadata(String itemId) throws Exception{
|
||||
setContextProviders(scope, authorizationToken);
|
||||
ItemContainer<Item> itemCont = shcClient.open(itemId).asItem();
|
||||
Metadata metadata = shcClient.open(itemId).asItem().get().getMetadata();
|
||||
if(metadata!=null)
|
||||
return metadata.getMap();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the folder container.
|
||||
*
|
||||
|
|
|
@ -894,6 +894,23 @@ public final class WorkspaceStorageHubClientService implements Workspace{
|
|||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.common.storagehubwrapper.server.tohl.Workspace#getMetadata(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getMetadata(String itemId) throws Exception {
|
||||
|
||||
try{
|
||||
|
||||
return storageHubClientService.getMetadata(itemId);
|
||||
|
||||
}catch(Exception e){
|
||||
logger.error("Error on getting Metadata for: "+itemId, e);
|
||||
throw new Exception("Error on getting Metadata for: "+itemId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -63,7 +63,6 @@ public interface Workspace{
|
|||
* Gets the children.
|
||||
*
|
||||
* @param id the id
|
||||
* @param withMetadata the with metadata
|
||||
* @return the children
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
|
@ -192,8 +191,6 @@ public interface Workspace{
|
|||
public List<WorkspaceItem> find(String name, String folderId) throws InternalErrorException, ItemNotFoundException, WrongItemTypeException;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the root shared folder.
|
||||
*
|
||||
|
@ -312,16 +309,26 @@ public interface Workspace{
|
|||
public ItemStreamDescriptor getThumbnailData(String itemId) throws Exception;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Mark as public.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @param isPublic the is public
|
||||
* @return the boolean
|
||||
*/
|
||||
public Boolean markAsPublic(String itemId, boolean isPublic);
|
||||
|
||||
|
||||
/**
|
||||
* Gets the metadata.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @return the metadata
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public Map<String, Object> getMetadata(String itemId) throws Exception;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue