|
|
|
@ -14,12 +14,12 @@ import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite;
|
|
|
|
|
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser;
|
|
|
|
|
import org.gcube.common.homelibrary.home.HomeLibrary;
|
|
|
|
|
import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
|
|
|
|
|
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
|
|
|
|
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
|
|
|
|
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
|
|
|
|
import org.gcube.common.portal.PortalContext;
|
|
|
|
|
import org.gcube.common.scope.api.ScopeProvider;
|
|
|
|
|
import org.gcube.common.storagehubwrapper.server.StorageHubWrapper;
|
|
|
|
|
import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.InternalErrorException;
|
|
|
|
|
import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.WorkspaceFolderNotFoundException;
|
|
|
|
|
import org.gcube.portlets.user.urlshortener.UrlShortener;
|
|
|
|
|
import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
|
|
|
|
|
import org.gcube.portlets.user.workspace.server.GWTWorkspaceBuilder;
|
|
|
|
@ -129,17 +129,20 @@ public class WsUtil {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the workspace.
|
|
|
|
|
*
|
|
|
|
|
* @param httpServletRequest the http servlet request
|
|
|
|
|
* @return the workspace
|
|
|
|
|
* @throws WorkspaceFolderNotFoundException the workspace folder not found exception
|
|
|
|
|
* @throws InternalErrorException the internal error exception
|
|
|
|
|
* @throws HomeNotFoundException the home not found exception
|
|
|
|
|
* @throws WorkspaceFolderNotFoundException the workspace folder not found exception
|
|
|
|
|
*/
|
|
|
|
|
public static Workspace getWorkspace(HttpServletRequest httpServletRequest) throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException
|
|
|
|
|
public static Workspace getWorkspace(HttpServletRequest httpServletRequest) throws org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException, org.gcube.common.homelibrary.home.exceptions.InternalErrorException, HomeNotFoundException
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
logger.trace("Get Workspace");
|
|
|
|
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
|
|
|
|
logger.trace("PortalContextInfo: "+info);
|
|
|
|
@ -160,10 +163,12 @@ public class WsUtil {
|
|
|
|
|
* @param user the user
|
|
|
|
|
* @return the workspace
|
|
|
|
|
* @throws InternalErrorException the internal error exception
|
|
|
|
|
* @throws InternalErrorException the internal error exception
|
|
|
|
|
* @throws HomeNotFoundException the home not found exception
|
|
|
|
|
* @throws WorkspaceFolderNotFoundException the workspace folder not found exception
|
|
|
|
|
* @throws WorkspaceFolderNotFoundException the workspace folder not found exception
|
|
|
|
|
*/
|
|
|
|
|
public static Workspace getWorkspace(HttpServletRequest httpServletRequest, String contextID, GCubeUser user) throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException
|
|
|
|
|
public static Workspace getWorkspace(HttpServletRequest httpServletRequest, String contextID, GCubeUser user) throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException, org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException, org.gcube.common.homelibrary.home.exceptions.InternalErrorException
|
|
|
|
|
{
|
|
|
|
|
logger.info("Get workspace using contextID: "+contextID +", current user: "+user.getUsername());
|
|
|
|
|
String currentScope;
|
|
|
|
@ -420,11 +425,9 @@ public class WsUtil {
|
|
|
|
|
* @param scopeGroupId the scope group id. If scopeGroupId is null the scope is read by using the request else by using the scopeGroupId
|
|
|
|
|
* @param user the user
|
|
|
|
|
* @return the storage hub wrapper
|
|
|
|
|
* @throws InternalErrorException the internal error exception
|
|
|
|
|
* @throws WorkspaceFolderNotFoundException the workspace folder not found exception
|
|
|
|
|
* @throws Exception the exception
|
|
|
|
|
*/
|
|
|
|
|
public static StorageHubWrapper getStorageHubWrapper(final HttpServletRequest request, String scopeGroupId, GCubeUser user) throws InternalErrorException, WorkspaceFolderNotFoundException, Exception{
|
|
|
|
|
public static StorageHubWrapper getStorageHubWrapper(final HttpServletRequest request, String scopeGroupId, GCubeUser user) throws Exception{
|
|
|
|
|
|
|
|
|
|
if(user==null || user.getUsername().isEmpty())
|
|
|
|
|
throw new Exception("Session expired");
|
|
|
|
@ -444,7 +447,7 @@ public class WsUtil {
|
|
|
|
|
return new StorageHubWrapper(scope, token);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("Error during getting storageHub wrapper", e);
|
|
|
|
|
throw new InternalErrorException("Error on gettig the StorageHub wrapper for userId: "+user);
|
|
|
|
|
throw new Exception("Error on gettig the StorageHub wrapper for userId: "+user);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|