Class WorkspaceUtils


  • public class WorkspaceUtils
    extends Object
    The Class WorkspaceUtils.
    Author:
    Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) Feb 18, 2021
    • Constructor Detail

      • WorkspaceUtils

        public WorkspaceUtils()
    • Method Detail

      • isWithinPortal

        public static boolean isWithinPortal()
        Checks if is within portal.
        Returns:
        true if you're running into the portal, false if in development
      • getStorageHubWrapper

        public static org.gcube.common.storagehubwrapper.server.StorageHubWrapper getStorageHubWrapper​(javax.servlet.http.HttpServletRequest request,
                                                                                                       String scopeGroupId,
                                                                                                       org.gcube.vomanagement.usermanagement.model.GCubeUser user)
                                                                                                throws Exception
        Gets the storage hub wrapper.
        Parameters:
        request - the request
        scopeGroupId - the scope group id. If scopeGroupId is null the scope is read by using the request else by using the scopeGroupId
        user - the user
        Returns:
        the storage hub wrapper
        Throws:
        Exception - the exception
      • toWorkspaceResource

        public static void toWorkspaceResource​(String wsItemId,
                                               String userName,
                                               DatasetBean bean,
                                               org.gcube.common.storagehubwrapper.server.tohl.Workspace workspace)
                                        throws Exception
        This method receives an item-id within the user's workspace and setit in the dataset bean to be returned. revisited by Francesco
        Parameters:
        wsItemId - the ws item id
        userName - the user name
        bean - the bean
        workspace - the workspace
        Throws:
        Exception - the exception
      • getGcubeItemProperties

        public static Map<String,​String> getGcubeItemProperties​(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem item)
        Gets the gcube item properties.
        Parameters:
        item - the item
        Returns:
        the gcube item properties
      • toSimpleMap

        public static Map<String,​String> toSimpleMap​(org.gcube.common.storagehubwrapper.shared.tohl.items.PropertyMap propertyMap)
        To simple map.
        Parameters:
        propertyMap - the property map
        Returns:
        the map
      • toResources

        public static List<org.gcube.datacatalogue.utillibrary.shared.ResourceBean> toResources​(DatasetBean bean,
                                                                                                org.gcube.common.storagehubwrapper.server.tohl.Workspace workspace,
                                                                                                String username)
                                                                                         throws Exception
        Copy into the .catalogue area folder the checked resources. There is no difference among a single-file-publish and a folder-publish.
        Parameters:
        bean - the bean
        workspace - the workspace
        username - the username
        Returns:
        the list
        Throws:
        Exception - the exception