50 lines
1.6 KiB
Java
50 lines
1.6 KiB
Java
|
package org.gcube.portlets.user.reportgenerator.server.servlet;
|
||
|
|
||
|
import java.util.List;
|
||
|
|
||
|
import org.gcube.application.framework.core.session.ASLSession;
|
||
|
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
|
||
|
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
||
|
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
||
|
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceFolder;
|
||
|
import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItem;
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
* @author Massimiliano Assante ISTI-CNR
|
||
|
*
|
||
|
*/
|
||
|
public class NotificationsThread implements Runnable {
|
||
|
private static GCUBEClientLog _log = new GCUBEClientLog(NotificationsThread.class);
|
||
|
private static final String WORKSPACE_PORTLET_ID = "org.gcube.portlets.user.wsmail.server.WsMailServiceImpl";
|
||
|
|
||
|
|
||
|
private NotificationsManager nm;
|
||
|
private List<String> userIdsToBeNotified;
|
||
|
private WorkspaceItem subjectItem;
|
||
|
private WorkspaceFolder sharedFolder;
|
||
|
|
||
|
|
||
|
public NotificationsThread(ASLSession session, List<String> userIdsToBeNotified, WorkspaceItem item, WorkspaceFolder sharedFolder) {
|
||
|
nm = new ApplicationNotificationsManager(session, WORKSPACE_PORTLET_ID);
|
||
|
this.userIdsToBeNotified = userIdsToBeNotified;
|
||
|
subjectItem = item;
|
||
|
this.sharedFolder = sharedFolder;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void run() {
|
||
|
for (String userId : userIdsToBeNotified) {
|
||
|
try {
|
||
|
boolean notifResult = nm.notifyUpdatedItem(userId, subjectItem, sharedFolder);
|
||
|
_log.trace("Update Notification sent to " + userId + " result="+notifResult);
|
||
|
} catch (Exception e) {
|
||
|
e.printStackTrace();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|