Removed ASL Dependency, ported to gCube Client Context
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@134592 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
518a13c028
commit
174f27112a
|
@ -1,4 +1,7 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="portlets-widgets.workspace-explorer.1-6-0" date="2016-11-21">
|
||||
<Change>Removed ASL Dependency, ported to gCube Client Context</Change>
|
||||
</Changeset>
|
||||
<Changeset component="portlets-widgets.workspace-explorer.1-5-0"
|
||||
date="2016-09-21">
|
||||
<Change>[Feature #5091] Added load for folder ID to SelectDialog and SelectPanel</Change>
|
||||
|
|
20
pom.xml
20
pom.xml
|
@ -10,7 +10,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>workspace-explorer</artifactId>
|
||||
<version>1.5.0-SNAPSHOT</version>
|
||||
<version>1.6.0-SNAPSHOT</version>
|
||||
<name>gCube Workspace Explorer</name>
|
||||
<description>
|
||||
gCube Workspace Explorer widget allows to navigate (gCube) Workspace
|
||||
|
@ -81,8 +81,8 @@
|
|||
<!-- END FWS -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslcore</artifactId>
|
||||
<groupId>org.gcube.common.portal</groupId>
|
||||
<artifactId>portal-manager</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -90,37 +90,25 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library-model</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library-jcr</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library</artifactId>
|
||||
<!-- <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> -->
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>asm-all</artifactId>
|
||||
<groupId>asm</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- TO USE LIFERAY 6.2 -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
<artifactId>usermanagement-core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- TO USE LIFERAY 6.2 -->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.liferay.portal</groupId>
|
||||
<artifactId>portal-service</artifactId>
|
||||
|
|
|
@ -10,8 +10,6 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.gcube.application.framework.core.session.SessionManager;
|
||||
import org.gcube.common.homelibary.model.items.type.WorkspaceItemType;
|
||||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||
import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
|
||||
|
@ -24,6 +22,7 @@ import org.gcube.common.homelibrary.home.workspace.exceptions.InsufficientPrivil
|
|||
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemAlreadyExistException;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
||||
import org.gcube.common.homelibrary.home.workspace.folder.FolderItem;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerConstants;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService;
|
||||
|
@ -43,7 +42,7 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
|||
* The Class WorkspaceExplorerServiceImpl.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Sep 21, 2016
|
||||
* @author Massimiliano Assante, CNR-ISTI
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implements WorkspaceExplorerService {
|
||||
|
@ -55,56 +54,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
// public static final String PRODUCTION_SCOPE = "/d4science.research-infrastructures.eu/gCubeApps"; //PRODUCTION
|
||||
|
||||
/**
|
||||
* Gets the ASL session.
|
||||
*
|
||||
* @param httpSession the http session
|
||||
* @return the ASL session
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
private ASLSession getASLSession(HttpSession httpSession) throws Exception {
|
||||
String sessionID = httpSession.getId();
|
||||
String user = (String) httpSession.getAttribute(USERNAME_ATTRIBUTE);
|
||||
ASLSession session;
|
||||
|
||||
//TODO we check for the older attribute name
|
||||
if (user == null) {
|
||||
user = (String) httpSession.getAttribute("user");
|
||||
}
|
||||
|
||||
if (user == null) {
|
||||
|
||||
/*USE ANOTHER ACCOUNT (OTHERWHISE BY TEST_USER) FOR RUNNING
|
||||
* COMMENT THIS IN DEVELOP ENVIROMENT (UNCOMMENT IN PRODUCTION)*/
|
||||
user=TEST_USER;
|
||||
|
||||
logger.warn("WORKSPACE EXPLORER STARTING IN TEST MODE - NO USER FOUND - USING FOLLOWING SETTINGS:");
|
||||
|
||||
if (!UserUtil.isWithinPortal()) { //DEV MODE
|
||||
user = "francesco.mangiacrapa";
|
||||
}
|
||||
|
||||
logger.warn("session id: "+sessionID);
|
||||
logger.warn("TEST_USER: "+user);
|
||||
logger.warn("TEST_SCOPE: "+TEST_SCOPE);
|
||||
logger.warn("USERNAME_ATTRIBUTE: "+USERNAME_ATTRIBUTE);
|
||||
session = SessionManager.getInstance().getASLSession(sessionID, user);
|
||||
if(session==null)
|
||||
throw new Exception("ASLSession is null");
|
||||
|
||||
session.setScope(TEST_SCOPE);
|
||||
|
||||
//SET HTTP SESSION ATTRIBUTE
|
||||
httpSession.setAttribute(USERNAME_ATTRIBUTE, user);
|
||||
|
||||
return session;
|
||||
}
|
||||
else {
|
||||
logger.trace("user found in session "+user);
|
||||
}
|
||||
return SessionManager.getInstance().getASLSession(sessionID, user);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the workspace.
|
||||
*
|
||||
|
@ -112,11 +62,11 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
protected Workspace getWorkspace() throws Exception {
|
||||
ASLSession session = getASLSession(this.getThreadLocalRequest().getSession());
|
||||
PortalContext pContext = PortalContext.getConfiguration();
|
||||
Workspace workspace;
|
||||
try{
|
||||
ScopeProvider.instance.set(session.getScope());
|
||||
workspace = HomeLibrary.getUserWorkspace(session.getUsername());
|
||||
ScopeProvider.instance.set(pContext.getCurrentScope(getThreadLocalRequest()));
|
||||
workspace = HomeLibrary.getUserWorkspace(pContext.getCurrentUser(getThreadLocalRequest()).getUsername());
|
||||
}catch(InternalErrorException | HomeNotFoundException | WorkspaceFolderNotFoundException e){
|
||||
String msg = "Sorry, an error occurred when retrieving workspace item, Refresh an try again";
|
||||
logger.error("HL error: ",e);
|
||||
|
@ -231,8 +181,8 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
switch(category){
|
||||
case HOME:{
|
||||
WorkspaceItem root = workspace.getRoot();
|
||||
ASLSession session = getASLSession(this.getThreadLocalRequest().getSession());
|
||||
String fullName = UserUtil.getUserFullName(session.getUsername());
|
||||
PortalContext pContext = PortalContext.getConfiguration();
|
||||
String fullName = pContext.getCurrentUser(getThreadLocalRequest()).getFullname();
|
||||
if(fullName.indexOf(" ")>0){
|
||||
fullName = fullName.substring(0, fullName.indexOf(" "));
|
||||
}else if(fullName.indexOf(".")>0){
|
||||
|
@ -309,8 +259,8 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
public boolean checkName(String name) throws WorkspaceNavigatorServiceException {
|
||||
logger.trace("checkName name: "+name);
|
||||
try {
|
||||
ASLSession session = getASLSession(this.getThreadLocalRequest().getSession());
|
||||
Workspace workspace = HomeLibrary.getUserWorkspace(session.getUsername());
|
||||
PortalContext pContext = PortalContext.getConfiguration();
|
||||
Workspace workspace = HomeLibrary.getUserWorkspace(pContext.getCurrentUser(getThreadLocalRequest()).getUsername());
|
||||
return workspace.isValidName(name);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error during folder retrieving", e);
|
||||
|
|
Loading…
Reference in New Issue