removed cache for ASL Notifications Manager

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-uploader@128978 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-06-01 16:43:17 +00:00
parent b0090f0ef9
commit 7fec78a6b6
3 changed files with 33 additions and 36 deletions

View File

@ -28,7 +28,6 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/home/francesco-mangiacrapa/libraries/asm-5.0.3/lib/asm-5.0.3.jar"/>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -9,7 +9,10 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
import org.gcube.applicationsupportlayer.social.NotificationsManager;
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite;
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser;
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder;
import org.gcube.common.scope.impl.ScopeBean;
@ -40,11 +43,29 @@ public class NotificationsWorkspaceUploaderProducer {
* @param request the request
*/
public NotificationsWorkspaceUploaderProducer(ASLSession aslSession, HttpServletRequest request) {
this.notificationsMng = WsUtil.getNotificationManager(aslSession, request);
this.notificationsMng = getNotificationManager(aslSession, request);
this.aslSession = aslSession;
this.userId = aslSession.getUsername();
}
/**
* Gets the notification manager.
*
* @param session the session
* @param request the request
* @return the notification manager
*/
public NotificationsManager getNotificationManager(ASLSession session, HttpServletRequest request) {
try{
logger.trace("Create new NotificationsManager for user: "+session.getUsername());
logger.trace("New ApplicationNotificationsManager with portlet class name: "+WsUtil.NOTIFICATION_PORTLET_CLASS_ID);
SocialNetworkingSite site = new SocialNetworkingSite(request);
SocialNetworkingUser curser = new SocialNetworkingUser(session.getUsername(), session.getUserEmailAddress(), session.getUserFullName(), session.getUserAvatarId());
return new ApplicationNotificationsManager(site, session.getScope(), curser, WsUtil.NOTIFICATION_PORTLET_CLASS_ID);
}catch (Exception e) {
logger.error("An error occurred instancing ApplicationNotificationsManager for user: "+session.getUsername(),e);
return null;
}
}
/**
* Gets the notifications mng.
*

View File

@ -161,33 +161,10 @@ public class WsUtil {
}
/**
* Gets the notification manager.
*
* @param session the session
* @param request the request
* @return the notification manager
*/
public static NotificationsManager getNotificationManager(ASLSession session, HttpServletRequest request)
{
NotificationsManager notifMng = (NotificationsManager) session.getAttribute(NOTIFICATION_MANAGER);
if (notifMng == null) {
try{
logger.trace("Create new NotificationsManager for user: "+session.getUsername());
logger.trace("New ApplicationNotificationsManager with portlet class name: "+NOTIFICATION_PORTLET_CLASS_ID);
SocialNetworkingSite site = new SocialNetworkingSite(request);
SocialNetworkingUser curser = new SocialNetworkingUser(session.getUsername(), session.getUserEmailAddress(), session.getUserFullName(), session.getUserAvatarId());
notifMng = new ApplicationNotificationsManager(site, session.getScope(), curser, NOTIFICATION_PORTLET_CLASS_ID);
session.setAttribute(NOTIFICATION_MANAGER, notifMng);
}catch (Exception e) {
logger.error("An error occurred instancing ApplicationNotificationsManager for user: "+session.getUsername(),e);
}
}
return notifMng;
}
/**
* Gets the notification producer.