diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java index 282b52b..e694785 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java @@ -7,12 +7,12 @@ import java.util.UUID; import javax.servlet.http.HttpServletRequest; -import org.gcube.application.framework.core.session.ASLSession; import org.gcube.applicationsupportlayer.social.mailing.EmailPlugin; import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser; import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; import org.gcube.common.homelibrary.home.workspace.WorkspaceItem; import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder; +import org.gcube.common.portal.GCubePortalConstants; import org.gcube.common.portal.PortalContext; import org.gcube.portal.databook.shared.ApplicationProfile; import org.gcube.portal.databook.shared.Notification; @@ -28,6 +28,9 @@ import org.gcube.vomanagement.usermanagement.model.GCubeUser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.liferay.portal.kernel.exception.PortalException; +import com.liferay.portal.kernel.exception.SystemException; + /** * * @author Massimiliano Assante, ISTI-CNR @@ -40,38 +43,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen private String portalName; private String senderEmail; private String portalURL; - /** - * @deprecated:please use ApplicationNotificationsManager(String scope, {@link SocialNetworkingUser} currUser, String portletClassName) - * Use this constructor if you do not need notifications to point back to your applications - * @param ASLSession the ASLSession instance - */ - @Deprecated - public ApplicationNotificationsManager(ASLSession session) { - super(session); - PortalContext context = PortalContext.getConfiguration(); - portalName = context.getGatewayName(); - senderEmail = context.getSenderEmail(); - portalURL = context.getGatewayURL(); - _log.warn("Asked for Simple Notification (without redirect to creator)"); - } - /** - * @deprecated: please use ApplicationNotificationsManager(String scope, {@link SocialNetworkingUser} currUser, String portletClassName) - * Use this constructor if you do need notifications to point back to your applications, - * make sure you create your application profile on the infrastructure. - * - * @see http://wiki.gcube-system.org/gcube/index.php/Social_Networking_Library#Create_Your_Application_Profile - * - * @param ASLSession the ASLSession instance - * @param portletClassName your portlet class name will be used ad unique identifier for your applicationProfile - */ - @Deprecated - public ApplicationNotificationsManager(ASLSession session, String portletClassName) { - super(session, portletClassName); - PortalContext context = PortalContext.getConfiguration(); - portalName = context.getGatewayName(); - senderEmail = context.getSenderEmail(); - portalURL = context.getGatewayURL(); - } + private String siteLandingPagePath; /** * Use this constructor if you do not need notifications to point back to your applications * @param scope the current scope @@ -100,9 +72,12 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen /** * set the current portal context (name, emal, url) * @param request + * @throws SystemException + * @throws PortalException */ private void setContext(HttpServletRequest request) { PortalContext context = PortalContext.getConfiguration(); + siteLandingPagePath = context.getSiteLandingPagePath(request); portalName = context.getGatewayName(request); senderEmail = context.getSenderEmail(request); portalURL = context.getGatewayURL(request); @@ -152,8 +127,8 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen return applicationProfile.getUrl(); } else { - _log.warn("applicationProfile NULL or url is empty returning " + "/group/data-e-infrastructure-gateway"); - return "/group/data-e-infrastructure-gateway"; + _log.warn("applicationProfile NULL or url is empty returning " + siteLandingPagePath); + return siteLandingPagePath; } } /** @@ -492,7 +467,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify messageId, //the unique identifier of the message new Date(), - "/group/data-e-infrastructure-gateway/messages", + siteLandingPagePath + GCubePortalConstants.USER_MESSAGES_FRIENDLY_URL, "sent you a message: " + "
" + messageText +"
"