66 lines
2.0 KiB
Java
66 lines
2.0 KiB
Java
package org.gcube.dataanalysis.dataminer.poolmanager.util;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Calendar;
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
import scala.actors.threadpool.Arrays;
|
|
|
|
public class NotificationHelper {
|
|
|
|
private Exception executionException;
|
|
|
|
public NotificationHelper() {
|
|
***REMOVED***
|
|
|
|
private String getSubjectHeader() {
|
|
return "[DataMinerGhostInstallationRequestReport]";
|
|
***REMOVED***
|
|
|
|
private boolean isError() {
|
|
return this.executionException!=null;
|
|
***REMOVED***
|
|
|
|
public void setExecutionException(Exception executionException) {
|
|
this.executionException = executionException;
|
|
***REMOVED***
|
|
|
|
public String getSuccessSubject() {
|
|
return this.getSubjectHeader()+" is SUCCESS";
|
|
***REMOVED***
|
|
|
|
public String getFailedSubject() {
|
|
return String.format(this.getSubjectHeader()+" is FAILED");
|
|
***REMOVED***
|
|
|
|
public String getSuccessBody() {
|
|
String message = String.format("The installation of the algorithm in the ghost dataminer is completed successfully.");
|
|
message+="\n\nYou can retrieve experiment results under the '/DataMiner' e-Infrastructure Workspace folder or from the DataMiner interface.";
|
|
return message;
|
|
***REMOVED***
|
|
|
|
public String getFailedBody(String message) {
|
|
String body = String.format("An error occurred while deploying your algorithm");
|
|
body+= "\n\nHere are the error details:\n\n" + message;
|
|
return body;
|
|
***REMOVED***
|
|
|
|
***REMOVED*** public String getSubject() {
|
|
***REMOVED*** if(this.isError()) {
|
|
***REMOVED*** return this.getFailedSubject();
|
|
***REMOVED*** ***REMOVED*** else {
|
|
***REMOVED*** return this.getSuccessSubject();
|
|
***REMOVED*** ***REMOVED***
|
|
***REMOVED*** ***REMOVED***
|
|
***REMOVED***
|
|
***REMOVED*** public String getBody() {
|
|
***REMOVED*** if(this.isError()) {
|
|
***REMOVED*** return this.getFailedBody();
|
|
***REMOVED*** ***REMOVED*** else {
|
|
***REMOVED*** return this.getSuccessBody();
|
|
***REMOVED*** ***REMOVED***
|
|
***REMOVED*** ***REMOVED***
|
|
|
|
***REMOVED***
|