bug fixed: open report and open report template
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@69322 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
5d725789a1
commit
3e539fb5ca
|
@ -119,6 +119,7 @@ import com.extjs.gxt.ui.client.widget.Info;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.HasWidgets;
|
import com.google.gwt.user.client.ui.HasWidgets;
|
||||||
|
|
||||||
|
@ -205,23 +206,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
@Override
|
@Override
|
||||||
public void onCreateSharedFolder(CreateSharedFolderEvent createSharedFolderEvent) {
|
public void onCreateSharedFolder(CreateSharedFolderEvent createSharedFolderEvent) {
|
||||||
|
|
||||||
|
|
||||||
// rpcWorkspaceService.readFromApplicationProfile("aaa", "bbb", new AsyncCallback<Void>() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onFailure(Throwable caught) {
|
|
||||||
// // TODO Auto-generated method stub
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onSuccess(Void result) {
|
|
||||||
// // TODO Auto-generated method stub
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
final FileModel sourceFileModel = createSharedFolderEvent.getFileSourceModel();
|
final FileModel sourceFileModel = createSharedFolderEvent.getFileSourceModel();
|
||||||
|
|
||||||
//IF ITEM IS SHAREABLE
|
//IF ITEM IS SHAREABLE
|
||||||
|
@ -1212,28 +1196,51 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
// System.out.println("id " +openReportsEvent.getSourceFileModel().getIdentifier());
|
// System.out.println("id " +openReportsEvent.getSourceFileModel().getIdentifier());
|
||||||
// System.out.println("name " +openReportsEvent.getSourceFileModel().getName());
|
// System.out.println("name " +openReportsEvent.getSourceFileModel().getName());
|
||||||
|
|
||||||
rpcWorkspaceService.setValueInSession(ConstantsExplorer.IDREPORT, openReportsEvent.getSourceFileModel().getIdentifier(), new AsyncCallback<Void>() {
|
|
||||||
|
|
||||||
|
rpcWorkspaceService.getURLFromApplicationProfile(ConstantsExplorer.IDREPORT, openReportsEvent.getSourceFileModel().getIdentifier(), new AsyncCallback<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
// Log.error("Error setting session attribute idreport",caught);
|
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting application profile - attribute idreport", null);
|
||||||
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " setting session attribute idreport", null);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Void result) {
|
public void onSuccess(String url) {
|
||||||
String currentUrl = portalURL();
|
|
||||||
int last = currentUrl.lastIndexOf("/");
|
String reportUrl = url;
|
||||||
String reportUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.REPORTGENERATION;
|
// int last = currentUrl.lastIndexOf("/");
|
||||||
|
// String reportUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.REPORTGENERATION;
|
||||||
// Log.trace("Url: "+reportUrl);
|
// Log.trace("Url: "+reportUrl);
|
||||||
System.out.println("currentUrl " +currentUrl);
|
// System.out.println("currentUrl " +currentUrl);
|
||||||
System.out.println("reportUrl " +reportUrl);
|
System.out.println("reportUrl " +reportUrl);
|
||||||
new WindowOpenUrl(reportUrl, "_self", "");
|
new WindowOpenUrl(reportUrl, "_self", "");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// rpcWorkspaceService.setValueInSession(ConstantsExplorer.IDREPORT, openReportsEvent.getSourceFileModel().getIdentifier(), new AsyncCallback<Void>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onFailure(Throwable caught) {
|
||||||
|
// new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " setting session attribute idreport", null);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onSuccess(Void result) {
|
||||||
|
// String currentUrl = portalURL();
|
||||||
|
// int last = currentUrl.lastIndexOf("/");
|
||||||
|
// String reportUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.REPORTGENERATION;
|
||||||
|
//// Log.trace("Url: "+reportUrl);
|
||||||
|
// System.out.println("currentUrl " +currentUrl);
|
||||||
|
// System.out.println("reportUrl " +reportUrl);
|
||||||
|
// new WindowOpenUrl(reportUrl, "_self", "");
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doClickOpenReportTemplate(OpenReportsEvent openReportTemplateEvent) {
|
private void doClickOpenReportTemplate(OpenReportsEvent openReportTemplateEvent) {
|
||||||
|
@ -1242,28 +1249,50 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
// System.out.println("id " +openReportTemplateEvent.getSourceFileModel().getIdentifier());
|
// System.out.println("id " +openReportTemplateEvent.getSourceFileModel().getIdentifier());
|
||||||
// System.out.println("name " +openReportTemplateEvent.getSourceFileModel().getName());
|
// System.out.println("name " +openReportTemplateEvent.getSourceFileModel().getName());
|
||||||
|
|
||||||
rpcWorkspaceService.setValueInSession(ConstantsExplorer.IDTEMPLATE, openReportTemplateEvent.getSourceFileModel().getIdentifier(), new AsyncCallback<Void>() {
|
rpcWorkspaceService.getURLFromApplicationProfile(ConstantsExplorer.IDTEMPLATE, openReportTemplateEvent.getSourceFileModel().getIdentifier(), new AsyncCallback<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
// Log.error("Error setting session attribute idtemplate",caught);
|
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting application profile - attribute idreport", null);
|
||||||
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR +" setting session attribute idtemplate", null);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Void result) {
|
public void onSuccess(String url) {
|
||||||
String currentUrl = portalURL();
|
|
||||||
int last = currentUrl.lastIndexOf("/");
|
String templateUrl = url;
|
||||||
String templateUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.TEMPLATECREATION;
|
// int last = currentUrl.lastIndexOf("/");
|
||||||
|
// String templateUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.TEMPLATECREATION;
|
||||||
// Log.trace("Url: "+templateUrl);
|
// Log.trace("Url: "+templateUrl);
|
||||||
System.out.println("currentUrl " +currentUrl);
|
// System.out.println("currentUrl " +currentUrl);
|
||||||
System.out.println("reportUrl " +templateUrl);
|
// System.out.println("reportUrl " +templateUrl);
|
||||||
new WindowOpenUrl(templateUrl, "_self", "");
|
new WindowOpenUrl(templateUrl, "_self", "");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// rpcWorkspaceService.setValueInSession(ConstantsExplorer.IDTEMPLATE, openReportTemplateEvent.getSourceFileModel().getIdentifier(), new AsyncCallback<Void>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onFailure(Throwable caught) {
|
||||||
|
//// Log.error("Error setting session attribute idtemplate",caught);
|
||||||
|
// new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR +" setting session attribute idtemplate", null);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onSuccess(Void result) {
|
||||||
|
// String currentUrl = portalURL();
|
||||||
|
// int last = currentUrl.lastIndexOf("/");
|
||||||
|
// String templateUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.TEMPLATECREATION;
|
||||||
|
//// Log.trace("Url: "+templateUrl);
|
||||||
|
// System.out.println("currentUrl " +currentUrl);
|
||||||
|
// System.out.println("reportUrl " +templateUrl);
|
||||||
|
// new WindowOpenUrl(templateUrl, "_self", "");
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 315 B After Width: | Height: | Size: 527 B |
Binary file not shown.
Before Width: | Height: | Size: 527 B After Width: | Height: | Size: 315 B |
|
@ -112,7 +112,7 @@ public interface GWTWorkspaceService extends RemoteService{
|
||||||
|
|
||||||
public List<FileModel> getListParentsByItemIdentifier(String itemIdentifier) throws Exception;
|
public List<FileModel> getListParentsByItemIdentifier(String itemIdentifier) throws Exception;
|
||||||
|
|
||||||
void readFromApplicationProfile(String name, String value) throws Exception;
|
public String getURLFromApplicationProfile(String name, String value) throws Exception;
|
||||||
|
|
||||||
// public ArrayList<List<FileModel>> getChildrenListsByParentsIdentifier(String itemIdentifier) throws Exception;
|
// public ArrayList<List<FileModel>> getChildrenListsByParentsIdentifier(String itemIdentifier) throws Exception;
|
||||||
|
|
||||||
|
|
|
@ -117,8 +117,8 @@ public interface GWTWorkspaceServiceAsync {
|
||||||
void getListParentsByItemIdentifier(String itemIdentifier,
|
void getListParentsByItemIdentifier(String itemIdentifier,
|
||||||
AsyncCallback<List<FileModel>> callback);
|
AsyncCallback<List<FileModel>> callback);
|
||||||
|
|
||||||
void readFromApplicationProfile(String name, String value,
|
void getURLFromApplicationProfile(String name, String value,
|
||||||
AsyncCallback<Void> callback);
|
AsyncCallback<String> callback);
|
||||||
|
|
||||||
// void getListParentsByItemIdentifier(String itemIdentifier,AsyncCallback<ArrayList<String>> callback);
|
// void getListParentsByItemIdentifier(String itemIdentifier,AsyncCallback<ArrayList<String>> callback);
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package org.gcube.portlets.user.workspace.server;
|
package org.gcube.portlets.user.workspace.server;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -10,9 +7,8 @@ import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
|
||||||
|
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
|
import org.gcube.applicationsupportlayer.social.SocialPortalBridge;
|
||||||
import org.gcube.common.core.scope.GCUBEScope;
|
import org.gcube.common.core.scope.GCUBEScope;
|
||||||
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
||||||
import org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException;
|
import org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException;
|
||||||
|
@ -47,7 +43,6 @@ import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
||||||
import org.gcube.portlets.user.workspace.server.notifications.NotificationsProducer;
|
import org.gcube.portlets.user.workspace.server.notifications.NotificationsProducer;
|
||||||
import org.gcube.portlets.user.workspace.server.util.AllScope;
|
import org.gcube.portlets.user.workspace.server.util.AllScope;
|
||||||
import org.gcube.portlets.user.workspace.server.util.Util;
|
import org.gcube.portlets.user.workspace.server.util.Util;
|
||||||
import org.gcube.portlets.user.workspace.shared.FieldVerifier;
|
|
||||||
|
|
||||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
|
||||||
|
@ -82,7 +77,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isTestMode(){
|
protected boolean isTestMode(){
|
||||||
return Util.isTestMode(Util.getAslSession(this.getThreadLocalRequest().getSession()));
|
return Util.withoutPortal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -755,43 +750,42 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromApplicationProfile(String name, String value) throws Exception {
|
public String getURLFromApplicationProfile(String property, String value) throws Exception {
|
||||||
|
|
||||||
|
String urlPortlet = "";
|
||||||
|
String appId = "";
|
||||||
|
|
||||||
try{
|
try{
|
||||||
ASLSession session = Util.getAslSession(this.getThreadLocalRequest().getSession());
|
ASLSession session = Util.getAslSession(this.getThreadLocalRequest().getSession());
|
||||||
|
|
||||||
Properties prop = new Properties();
|
Properties prop = new Properties();
|
||||||
|
|
||||||
try {
|
InputStream in = (InputStream) GWTWorkspaceServiceImpl.class.getResourceAsStream("portletClassName.properties");
|
||||||
|
|
||||||
InputStream in = (InputStream) FieldVerifier.class.getResourceAsStream("portletClassName.properties");
|
// load a properties file
|
||||||
|
prop.load(in);
|
||||||
|
|
||||||
// load a properties file from class path, inside static method
|
// get the property value - the application Id
|
||||||
prop.load(in);
|
appId = prop.getProperty(property);
|
||||||
|
|
||||||
// get the property value and print it out
|
//print it out
|
||||||
System.out.println(prop.getProperty("idreport"));
|
System.out.println(prop.getProperty(property));
|
||||||
System.out.println(prop.getProperty("idtemplate"));
|
|
||||||
|
//set property in ASL session
|
||||||
|
setValueInSession(property,value);
|
||||||
|
|
||||||
|
|
||||||
} catch (IOException ex) {
|
SocialPortalBridge spb = new SocialPortalBridge(session,appId);
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
urlPortlet = spb.getApplicationProfile().getUrl();
|
||||||
// SocialPortalBridge spb = new SocialPortalBridge(session,)
|
|
||||||
//
|
|
||||||
// ASLSession session = Util.getAslSession(this.getThreadLocalRequest().getSession());
|
|
||||||
// session.setAttribute(name, value);
|
|
||||||
// workspaceLogger.trace("set value in session with name: "+name+", value: "+value);
|
|
||||||
// workspaceLogger.debug("WS Session Id = " + session.getExternalSessionID());
|
|
||||||
//// System.out.println("set value in session with name: "+name+", value: "+value);
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
workspaceLogger.error("setValueInSession", e);
|
workspaceLogger.error("getURLFromApplicationProfile", e);
|
||||||
throw new Exception(e.getMessage());
|
throw new Exception("Sorry, an error occurred in retrieve application profile, try again");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return urlPortlet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -820,7 +814,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
Workspace workspace = getWorkspace();
|
Workspace workspace = getWorkspace();
|
||||||
|
|
||||||
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
|
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
|
||||||
logger.info("get all scope");
|
logger.trace("get all scope");
|
||||||
|
|
||||||
// WorkspaceItem parent = workspace.getItem(parentFileModel.getIdentifier()); //get item from workspace
|
// WorkspaceItem parent = workspace.getItem(parentFileModel.getIdentifier()); //get item from workspace
|
||||||
// workspace.getAllScope();
|
// workspace.getAllScope();
|
||||||
|
@ -849,7 +843,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
Workspace workspace = getWorkspace();
|
Workspace workspace = getWorkspace();
|
||||||
|
|
||||||
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
|
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
|
||||||
logger.info("get all contacts");
|
logger.trace("get all contacts");
|
||||||
|
|
||||||
// WorkspaceItem parent = workspace.getItem(parentFileModel.getIdentifier()); //get item from workspace
|
// WorkspaceItem parent = workspace.getItem(parentFileModel.getIdentifier()); //get item from workspace
|
||||||
// workspace.getAllScope();
|
// workspace.getAllScope();
|
||||||
|
@ -858,7 +852,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
|
|
||||||
if(isTestMode()){
|
if(isTestMode()){
|
||||||
|
|
||||||
System.out.println("WORKSPACE PORTLET IS IN TEST MODE - RETURN TEST USERS");
|
logger.warn("WORKSPACE PORTLET IS IN TEST MODE - RETURN TEST USERS");
|
||||||
List<InfoContactModel> listContactsModel = new ArrayList<InfoContactModel>();
|
List<InfoContactModel> listContactsModel = new ArrayList<InfoContactModel>();
|
||||||
// //TEST USERS
|
// //TEST USERS
|
||||||
listContactsModel.add(new InfoContactModel("Federico.Test", "Federico.Test", "Federico de Faveri"));
|
listContactsModel.add(new InfoContactModel("Federico.Test", "Federico.Test", "Federico de Faveri"));
|
||||||
|
@ -866,6 +860,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
listContactsModel.add(new InfoContactModel("Fabio.Test", "Fabio.Test", "Fabio Sinibaldi"));
|
listContactsModel.add(new InfoContactModel("Fabio.Test", "Fabio.Test", "Fabio Sinibaldi"));
|
||||||
listContactsModel.add(new InfoContactModel(Util.TEST_USER, Util.TEST_USER, Util.TEST_USER));
|
listContactsModel.add(new InfoContactModel(Util.TEST_USER, Util.TEST_USER, Util.TEST_USER));
|
||||||
listContactsModel.add(new InfoContactModel("massimiliano.assante", "massimiliano.assante", "Massimiliano Assante"));
|
listContactsModel.add(new InfoContactModel("massimiliano.assante", "massimiliano.assante", "Massimiliano Assante"));
|
||||||
|
listContactsModel.add(new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa"));
|
||||||
return listContactsModel;
|
return listContactsModel;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1058,7 +1053,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
|
|
||||||
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
|
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
|
||||||
|
|
||||||
|
|
||||||
List<FolderBulkCreator> listFBC = workspace.getFolderBulkCreatorManager().getActiveFolderBulkCreators();
|
List<FolderBulkCreator> listFBC = workspace.getFolderBulkCreatorManager().getActiveFolderBulkCreators();
|
||||||
|
|
||||||
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
||||||
|
|
|
@ -1,2 +1,28 @@
|
||||||
idtemplate=template
|
# Property files
|
||||||
idreport=report
|
#
|
||||||
|
# author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
# created 02/2013
|
||||||
|
#
|
||||||
|
# Property = key value
|
||||||
|
#
|
||||||
|
# property - is the type of Folder Item set in HL
|
||||||
|
# value - (see property (2))
|
||||||
|
#
|
||||||
|
|
||||||
|
REPORT_TEMPLATE = idtemplate
|
||||||
|
REPORT = idreport
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Property = gCube App URL
|
||||||
|
#
|
||||||
|
# property (2) - is the key that must be set in ASL Session with value OID (OID is the "object id" of the object that must be open)
|
||||||
|
# value - is the AppId the must be read from Application Profile to retrieve the url application (gCube Apps) that must open the object wih OID
|
||||||
|
|
||||||
|
# Ex. idtemplate = "12345" - "12345" is the value (OID set in ASL session at run-time) , that must be read from Report Application to
|
||||||
|
# open directly the object
|
||||||
|
#
|
||||||
|
|
||||||
|
idtemplate=org.gcube.portlets.user.reportgenerator.server.servlet.ReportServiceImpl
|
||||||
|
idreport=org.gcube.portlets.user.templates.server.TemplateServiceImpl
|
|
@ -11,6 +11,7 @@ import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
|
||||||
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
||||||
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
||||||
import org.gcube.common.core.utils.logging.GCUBELog;
|
import org.gcube.common.core.utils.logging.GCUBELog;
|
||||||
|
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||||
import org.gcube.portlets.user.homelibrary.home.HomeLibrary;
|
import org.gcube.portlets.user.homelibrary.home.HomeLibrary;
|
||||||
import org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException;
|
import org.gcube.portlets.user.homelibrary.home.exceptions.HomeNotFoundException;
|
||||||
import org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException;
|
import org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException;
|
||||||
|
@ -26,7 +27,7 @@ import org.gcube.portlets.user.workspace.server.notifications.NotificationsProdu
|
||||||
*/
|
*/
|
||||||
public class Util {
|
public class Util {
|
||||||
|
|
||||||
public static final String USERNAME_ATTRIBUTE = "username";
|
public static final String USERNAME_ATTRIBUTE = ScopeHelper.USERNAME_ATTRIBUTE;
|
||||||
public static final String FOLDERIMPORTER_ATTRIBUTE = "FOLDER_IMPORTER";
|
public static final String FOLDERIMPORTER_ATTRIBUTE = "FOLDER_IMPORTER";
|
||||||
public static final String METADATACONVERTER_ATTRIBUTE = "METADATA_CONVERTER";
|
public static final String METADATACONVERTER_ATTRIBUTE = "METADATA_CONVERTER";
|
||||||
public static final String WORKSPACE_EVENT_COLLECTOR_ATTRIBUTE = "EVENT_COLLECTOR";
|
public static final String WORKSPACE_EVENT_COLLECTOR_ATTRIBUTE = "EVENT_COLLECTOR";
|
||||||
|
@ -44,46 +45,42 @@ public class Util {
|
||||||
// public static final String TEST_USER = "federico.defaveri";
|
// public static final String TEST_USER = "federico.defaveri";
|
||||||
// public static final String TEST_USER = "massimiliano.assante";
|
// public static final String TEST_USER = "massimiliano.assante";
|
||||||
// public static final String TEST_USER = "pasquale.pagano";
|
// public static final String TEST_USER = "pasquale.pagano";
|
||||||
public static final String TEST_USER = "francesco.mangiacrapa";
|
public static final String TEST_USER = "test.user";
|
||||||
public static final String TEST_USER_FULL_NAME = "Francesco Mangiacrapa";
|
public static final String TEST_USER_FULL_NAME = "Test User";
|
||||||
|
|
||||||
public static GCUBEClientLog defaultLogger = new GCUBEClientLog("WorkspacePortlet");
|
public static GCUBEClientLog defaultLogger = new GCUBEClientLog("WorkspacePortlet");
|
||||||
|
|
||||||
|
public static boolean withoutPortal = false;
|
||||||
|
|
||||||
public static ASLSession getAslSession(HttpSession httpSession)
|
public static ASLSession getAslSession(HttpSession httpSession)
|
||||||
{
|
{
|
||||||
String sessionID = httpSession.getId();
|
String sessionID = httpSession.getId();
|
||||||
String user = (String) httpSession.getAttribute(USERNAME_ATTRIBUTE);
|
String user = (String) httpSession.getAttribute(USERNAME_ATTRIBUTE);
|
||||||
|
ASLSession session;
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
|
|
||||||
defaultLogger.error("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND");
|
|
||||||
System.out.println("http session id "+sessionID);
|
|
||||||
//for test only
|
//for test only
|
||||||
httpSession.setAttribute(USERNAME_ATTRIBUTE, TEST_USER);
|
// httpSession.setAttribute(USERNAME_ATTRIBUTE, TEST_USER);
|
||||||
ASLSession session = SessionManager.getInstance().getASLSession(sessionID, TEST_USER);
|
session = SessionManager.getInstance().getASLSession(sessionID, TEST_USER);
|
||||||
session.setScope(TEST_SCOPE);
|
if(!withoutPortal){ //TEMPORARY SOLUTION
|
||||||
session.setUserAvatarId(TEST_USER + "Avatar");
|
defaultLogger.error("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND");
|
||||||
session.setUserFullName(TEST_USER_FULL_NAME);
|
session.setScope(TEST_SCOPE);
|
||||||
|
session.setUserAvatarId(TEST_USER + "Avatar");
|
||||||
|
session.setUserFullName(TEST_USER_FULL_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
session.setAttribute(WS_RUN_IN_TEST_MODE, true);
|
withoutPortal = true;
|
||||||
|
|
||||||
return session;
|
}else{
|
||||||
|
|
||||||
|
session = SessionManager.getInstance().getASLSession(sessionID, user);
|
||||||
|
withoutPortal = false;
|
||||||
}
|
}
|
||||||
ASLSession session = SessionManager.getInstance().getASLSession(sessionID, user);
|
|
||||||
session.setAttribute(WS_RUN_IN_TEST_MODE, false);
|
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isTestMode(ASLSession session){
|
|
||||||
|
|
||||||
Boolean test = (Boolean) session.getAttribute(WS_RUN_IN_TEST_MODE);
|
|
||||||
|
|
||||||
if(test == null || test==true)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Workspace getWorkspace(final HttpSession httpSession) throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException
|
public static Workspace getWorkspace(final HttpSession httpSession) throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue