added email subjects and redirect link for TDM
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@115375 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b200758ce6
commit
0a30c4474d
1
pom.xml
1
pom.xml
|
@ -60,6 +60,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>social-networking-library</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
|
|
|
@ -29,6 +29,8 @@ import org.gcube.vomanagement.usermanagement.model.UserModel;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.liferay.portal.kernel.util.Tuple;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Massimiliano Assante, ISTI-CNR
|
||||
|
@ -815,21 +817,52 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean notifyTDMTabularResourceSharing(String userIdToNotify,
|
||||
String tabularResourceName, String encodedTabularResourceParams) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return true;
|
||||
public boolean notifyTDMTabularResourceSharing(String userIdToNotify, String tabularResourceName, String encodedTabularResourceParams) throws Exception {
|
||||
Notification not = new Notification(
|
||||
UUID.randomUUID().toString(),
|
||||
NotificationType.TDM_TAB_RESOURCE_SHARE,
|
||||
userIdToNotify, //user no notify
|
||||
tabularResourceName,
|
||||
new Date(),
|
||||
getApplicationUrl()+"?"+encodedTabularResourceParams,
|
||||
"shared the Tabular Resource \""+ tabularResourceName +"\" with you",
|
||||
false,
|
||||
aslSession.getUsername(),
|
||||
aslSession.getUserFullName(),
|
||||
aslSession.getUserAvatarId());
|
||||
|
||||
return saveNotification(not);
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean notifyTDMObjectSharing(String userIdToNotify,
|
||||
NotificationType type, String tdmObjectName,
|
||||
String encodedTabularResourceParams)
|
||||
throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return true;
|
||||
public boolean notifyTDMObjectSharing(String userIdToNotify, NotificationType type, String tdmObjectName, String encodedTabularResourceParams) throws Exception {
|
||||
if (type != NotificationType.TDM_RULE_SHARE || type != NotificationType.TDM_TEMPLATE_SHARE)
|
||||
throw new IllegalArgumentException("Type must be either TDM_RULE_SHARE or TDM_TEMPLATE_SHARE");
|
||||
|
||||
String notificationText = "shared the Tabular Data Manager";
|
||||
notificationText += (type == NotificationType.TDM_RULE_SHARE) ? " Rule " : " Template ";
|
||||
notificationText += tdmObjectName + " with you";
|
||||
|
||||
String url = getApplicationUrl();
|
||||
if (encodedTabularResourceParams != null && encodedTabularResourceParams.compareTo("") != 0)
|
||||
url += "?"+encodedTabularResourceParams;
|
||||
|
||||
Notification not = new Notification(
|
||||
UUID.randomUUID().toString(),
|
||||
type,
|
||||
userIdToNotify, //user no notify
|
||||
tdmObjectName,
|
||||
new Date(),
|
||||
url,
|
||||
notificationText,
|
||||
false,
|
||||
aslSession.getUsername(),
|
||||
aslSession.getUserFullName(),
|
||||
aslSession.getUserAvatarId());
|
||||
|
||||
return saveNotification(not);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -316,6 +316,12 @@ public class EmailPlugin {
|
|||
return vreName +": Edited event in a shared calendar";
|
||||
case CALENDAR_DELETED_EVENT:
|
||||
return vreName +": Deleted in a shared calendar";
|
||||
case TDM_TAB_RESOURCE_SHARE:
|
||||
return notification2Save.getSenderFullName() + " shared a Tabular Resource with you on " + vreName;
|
||||
case TDM_RULE_SHARE:
|
||||
return notification2Save.getSenderFullName() + " shared a Tabular Data Manager Rule with you on " + vreName;
|
||||
case TDM_TEMPLATE_SHARE:
|
||||
return notification2Save.getSenderFullName() + " shared a Tabular Data Manager Template with you on " + vreName;
|
||||
default:
|
||||
return "You have a new Notification";
|
||||
}
|
||||
|
@ -408,6 +414,11 @@ public class EmailPlugin {
|
|||
case CALENDAR_DELETED_EVENT:
|
||||
actionLink.append("\">.").append(" Go to Calendar").append("</a>");
|
||||
break;
|
||||
case TDM_TAB_RESOURCE_SHARE:
|
||||
case TDM_RULE_SHARE:
|
||||
case TDM_TEMPLATE_SHARE:
|
||||
actionLink.append("\">.").append(" Go to Tabular Data Manager").append("</a>");
|
||||
|
||||
default:
|
||||
actionLink.append("\">.").append("").append("</a>");
|
||||
break;
|
||||
|
|
|
@ -1,38 +1,35 @@
|
|||
package org.gcube.applicationsupportlayer.social;
|
||||
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.gcube.application.framework.core.session.SessionManager;
|
||||
import org.gcube.applicationsupportlayer.social.mailing.EmailPlugin;
|
||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||
import org.gcube.portal.databook.shared.Notification;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.gcube.application.framework.core.session.SessionManager;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class AppTest
|
||||
extends TestCase
|
||||
extends TestCase
|
||||
{
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
* @param testName name of the test case
|
||||
*/
|
||||
public AppTest( String testName )
|
||||
{
|
||||
super( testName );
|
||||
}
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
* @param testName name of the test case
|
||||
*/
|
||||
public AppTest( String testName )
|
||||
{
|
||||
super( testName );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the suite of tests being tested
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
return new TestSuite( AppTest.class );
|
||||
}
|
||||
/**
|
||||
* @return the suite of tests being tested
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
return new TestSuite( AppTest.class );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -40,19 +37,20 @@ public class AppTest
|
|||
* @return the session
|
||||
*/
|
||||
private ASLSession getTestSession() {
|
||||
|
||||
ASLSession toReturn = SessionManager.getInstance().getASLSession("11", "test.user");
|
||||
toReturn.setScope("/gcube");
|
||||
toReturn.setUserFullName("Pico Pallino");
|
||||
toReturn.setUserEmailAddress("test@test123.com");
|
||||
|
||||
ASLSession toReturn = SessionManager.getInstance().getASLSession("11", "andrea.rossi");
|
||||
toReturn.setScope("/gcube/devsec/devVRE");
|
||||
toReturn.setUserFullName("Andrea Rossi");
|
||||
toReturn.setUserEmailAddress("m.assante@gmail.com");
|
||||
toReturn.setGroupModelInfos("TheGroup", 123L);
|
||||
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void testApp() {
|
||||
assertTrue( true );
|
||||
}
|
||||
/**
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
public void testApp() throws Exception {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue