|
|
|
@ -1,14 +1,19 @@
|
|
|
|
|
package org.gcube.portlets.user.workspace.server;
|
|
|
|
|
|
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Properties;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.ServletContext;
|
|
|
|
|
|
|
|
|
|
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.utils.logging.GCUBEClientLog;
|
|
|
|
|
import org.gcube.common.core.utils.logging.GCUBELog;
|
|
|
|
|
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.workspace.Workspace;
|
|
|
|
@ -74,8 +79,8 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|
|
|
|
return Util.getNotificationProducer(Util.getAslSession(this.getThreadLocalRequest().getSession()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected String getUserId(){
|
|
|
|
|
return Util.getUserId(this.getThreadLocalRequest().getSession());
|
|
|
|
|
protected boolean isTestMode(){
|
|
|
|
|
return Util.isTestMode(Util.getAslSession(this.getThreadLocalRequest().getSession()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -747,6 +752,52 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void readFromApplicationProfile(String name, String value) throws Exception {
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
ASLSession session = Util.getAslSession(this.getThreadLocalRequest().getSession());
|
|
|
|
|
|
|
|
|
|
Properties prop = new Properties();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ServletContext servletContext = getServletContext();
|
|
|
|
|
|
|
|
|
|
System.out.println("context-path: "+servletContext.getRealPath(""));
|
|
|
|
|
System.out.println("context-path th: "+this.getThreadLocalRequest().getContextPath());
|
|
|
|
|
System.out.println("context-path cp: "+this.getServletContext().getContextPath());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// load a properties file from class path, inside static method
|
|
|
|
|
prop.load(servletContext.getResourceAsStream("portletClassName.properties"));
|
|
|
|
|
|
|
|
|
|
// get the property value and print it out
|
|
|
|
|
System.out.println(prop.getProperty("idreport"));
|
|
|
|
|
System.out.println(prop.getProperty("idtemplate"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (IOException ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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) {
|
|
|
|
|
workspaceLogger.error("setValueInSession", e);
|
|
|
|
|
throw new Exception(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setValueInSession(String name, String value) throws Exception {
|
|
|
|
|
|
|
|
|
@ -803,20 +854,30 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|
|
|
|
|
|
|
|
|
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
|
|
|
|
|
logger.info("get all contacts");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// WorkspaceItem parent = workspace.getItem(parentFileModel.getIdentifier()); //get item from workspace
|
|
|
|
|
// workspace.getAllScope();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
|
|
|
|
|
|
|
|
|
if(isTestMode()){
|
|
|
|
|
|
|
|
|
|
System.out.println("WORKSPACE PORTLET IS IN TEST MODE - RETURN TEST USERS");
|
|
|
|
|
List<InfoContactModel> listContactsModel = new ArrayList<InfoContactModel>();
|
|
|
|
|
// //TEST USERS
|
|
|
|
|
listContactsModel.add(new InfoContactModel("Federico.Test", "Federico.Test", "Federico de Faveri"));
|
|
|
|
|
listContactsModel.add(new InfoContactModel("Antonio.Test", "Antonio.Test", "Antonio Gioia"));
|
|
|
|
|
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("massimiliano.assante", "massimiliano.assante", "Massimiliano Assante"));
|
|
|
|
|
return listContactsModel;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return builder.buildGXTListContactsModel(workspace.getHome().getHomeManager().getUsers()); //TODO passare list items
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
workspaceLogger.error("Error in server get all contacts ", e);
|
|
|
|
|
// workspaceLogger.trace("Error in server get all contacts " + e.getMessage());
|
|
|
|
|
//GWT can't serialize all exceptions
|
|
|
|
|
throw new Exception(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1398,10 +1459,11 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|
|
|
|
NotificationsProducer np = getNotificationProducer();
|
|
|
|
|
List<InfoContactModel> contacts = getListUserSharedByFolderSharedId(folderSharedId);
|
|
|
|
|
|
|
|
|
|
// //TODO REMOVE THIS
|
|
|
|
|
// contacts = new ArrayList<InfoContactModel>();
|
|
|
|
|
// contacts.add(new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa"));
|
|
|
|
|
|
|
|
|
|
if(isTestMode()){
|
|
|
|
|
contacts = new ArrayList<InfoContactModel>();
|
|
|
|
|
contacts.add(new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
np.notifyFolderUnSharing(contacts, wsFolder);
|
|
|
|
|
}
|
|
|
|
|