statistical-algorithms-impo.../src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/social/AlgorithmNotification.java

81 lines
2.4 KiB
Java

package org.gcube.portlets.user.statisticalalgorithmsimporter.server.social;
import java.util.ArrayList;
import java.util.Arrays;
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.homelibrary.util.WorkspaceUtil;
import org.gcube.portal.databook.shared.NotificationType;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.Constants;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* TDMNotification notification sharing TR, templates or rules
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class AlgorithmNotification extends Thread {
private static Logger logger = LoggerFactory
.getLogger(AlgorithmNotification.class);
private ASLSession aslSession;
private NotificationType notificationType;
private Project project;
public AlgorithmNotification(ASLSession aslSession, Project project) {
this.aslSession = aslSession;
this.project = project;
//this.notificationType = NotificationType.SAI_ALGORITHM_PUBLICATION;
}
public void run() {
algorithmPublicationNotify();
}
private void algorithmPublicationNotify() {
NotificationsManager nm = new ApplicationNotificationsManager(
aslSession, Constants.APPLICATION_ID);
/*
List<String> members = Arrays.asList("gianpaolo.coro",
"giancarlo.panichi", "roberto.cirillo");
for (String member : members) {
try {
nm.notifyAlgorithmPublicationRequest(
member,
project.getInputData().getProjectInfo()
.getAlgorithmName(),
new String(
Constants.STATISTICAL_ALGORITHMS_IMPORTER_JAR_PUBLIC_LINK
+ "="
+ project.getProjectTarget()
.getCodeJar().getPublicLink()));
} catch (Exception e) {
logger.error("Error in the notification(Type: "
+ notificationType
+ " - "
+ aslSession.getUsername()
+ " ="
+ "Algorithm [AlgorithmName="
+ project.getInputData().getProjectInfo()
.getAlgorithmName()
+ ", JarPublicLink="
+ project.getProjectTarget().getCodeJar()
.getPublicLink() + "] to " + member + "): "
+ e.getLocalizedMessage());
e.printStackTrace();
}
}*/
}
}