git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@128232 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7790c9d91d
commit
632ba2cf77
|
@ -7,12 +7,12 @@ import java.util.UUID;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
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.mailing.EmailPlugin;
|
||||||
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser;
|
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser;
|
||||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder;
|
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder;
|
||||||
|
import org.gcube.common.portal.GCubePortalConstants;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.portal.databook.shared.ApplicationProfile;
|
import org.gcube.portal.databook.shared.ApplicationProfile;
|
||||||
import org.gcube.portal.databook.shared.Notification;
|
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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.liferay.portal.kernel.exception.PortalException;
|
||||||
|
import com.liferay.portal.kernel.exception.SystemException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Massimiliano Assante, ISTI-CNR
|
* @author Massimiliano Assante, ISTI-CNR
|
||||||
|
@ -40,38 +43,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
||||||
private String portalName;
|
private String portalName;
|
||||||
private String senderEmail;
|
private String senderEmail;
|
||||||
private String portalURL;
|
private String portalURL;
|
||||||
/**
|
private String siteLandingPagePath;
|
||||||
* @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();
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Use this constructor if you do not need notifications to point back to your applications
|
* Use this constructor if you do not need notifications to point back to your applications
|
||||||
* @param scope the current scope
|
* @param scope the current scope
|
||||||
|
@ -100,9 +72,12 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
||||||
/**
|
/**
|
||||||
* set the current portal context (name, emal, url)
|
* set the current portal context (name, emal, url)
|
||||||
* @param request
|
* @param request
|
||||||
|
* @throws SystemException
|
||||||
|
* @throws PortalException
|
||||||
*/
|
*/
|
||||||
private void setContext(HttpServletRequest request) {
|
private void setContext(HttpServletRequest request) {
|
||||||
PortalContext context = PortalContext.getConfiguration();
|
PortalContext context = PortalContext.getConfiguration();
|
||||||
|
siteLandingPagePath = context.getSiteLandingPagePath(request);
|
||||||
portalName = context.getGatewayName(request);
|
portalName = context.getGatewayName(request);
|
||||||
senderEmail = context.getSenderEmail(request);
|
senderEmail = context.getSenderEmail(request);
|
||||||
portalURL = context.getGatewayURL(request);
|
portalURL = context.getGatewayURL(request);
|
||||||
|
@ -152,8 +127,8 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
||||||
return applicationProfile.getUrl();
|
return applicationProfile.getUrl();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_log.warn("applicationProfile NULL or url is empty returning " + "/group/data-e-infrastructure-gateway");
|
_log.warn("applicationProfile NULL or url is empty returning " + siteLandingPagePath);
|
||||||
return "/group/data-e-infrastructure-gateway";
|
return siteLandingPagePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -492,7 +467,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
||||||
userIdToNotify, //user no notify
|
userIdToNotify, //user no notify
|
||||||
messageId, //the unique identifier of the message
|
messageId, //the unique identifier of the message
|
||||||
new Date(),
|
new Date(),
|
||||||
"/group/data-e-infrastructure-gateway/messages",
|
siteLandingPagePath + GCubePortalConstants.USER_MESSAGES_FRIENDLY_URL,
|
||||||
"sent you a message: "
|
"sent you a message: "
|
||||||
+ "<br/><div style=\"margin-top: 10px; margin-bottom: 10px; margin-left: 50px; padding-left: 15px; border-left: 3px solid #ccc; font-style: italic;\">"
|
+ "<br/><div style=\"margin-top: 10px; margin-bottom: 10px; margin-left: 50px; padding-left: 15px; border-left: 3px solid #ccc; font-style: italic;\">"
|
||||||
+ messageText +"</div>"
|
+ messageText +"</div>"
|
||||||
|
|
Loading…
Reference in New Issue