2017-07-05 17:50:42 +02:00
|
|
|
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 ***REMOVED***
|
|
|
|
|
|
|
|
private Exception executionException;
|
|
|
|
|
|
|
|
public NotificationHelper() ***REMOVED***
|
|
|
|
***REMOVED***
|
|
|
|
|
|
|
|
private String getSubjectHeader() ***REMOVED***
|
2017-07-06 14:54:04 +02:00
|
|
|
return "[DataMinerGhostInstallationRequestReport]";
|
2017-07-05 17:50:42 +02:00
|
|
|
***REMOVED***
|
2017-07-24 12:32:18 +02:00
|
|
|
|
|
|
|
private String getSubjectHeaderRelease() ***REMOVED***
|
|
|
|
return "[DataMinerReleaseInstallationRequestReport]";
|
|
|
|
***REMOVED***
|
2017-07-05 17:50:42 +02:00
|
|
|
|
|
|
|
private boolean isError() ***REMOVED***
|
|
|
|
return this.executionException!=null;
|
|
|
|
***REMOVED***
|
|
|
|
|
|
|
|
public void setExecutionException(Exception executionException) ***REMOVED***
|
|
|
|
this.executionException = executionException;
|
|
|
|
***REMOVED***
|
|
|
|
|
2017-07-06 17:34:45 +02:00
|
|
|
public String getSuccessSubject() ***REMOVED***
|
|
|
|
return this.getSubjectHeader()+" is SUCCESS";
|
2017-07-05 17:50:42 +02:00
|
|
|
***REMOVED***
|
|
|
|
|
2017-07-24 12:32:18 +02:00
|
|
|
public String getSuccessSubjectRelease() ***REMOVED***
|
|
|
|
return this.getSubjectHeaderRelease()+" is SUCCESS";
|
|
|
|
***REMOVED***
|
|
|
|
|
|
|
|
|
|
|
|
public String getFailedSubjectRelease() ***REMOVED***
|
|
|
|
return this.getSubjectHeaderRelease()+" is FAILED";
|
|
|
|
***REMOVED***
|
|
|
|
|
|
|
|
|
2017-07-06 17:34:45 +02:00
|
|
|
public String getFailedSubject() ***REMOVED***
|
|
|
|
return String.format(this.getSubjectHeader()+" is FAILED");
|
2017-07-05 17:50:42 +02:00
|
|
|
***REMOVED***
|
2017-07-06 17:34:45 +02:00
|
|
|
|
2017-07-24 12:32:18 +02:00
|
|
|
public String getSuccessBody(String info) ***REMOVED***
|
2017-07-06 17:34:45 +02:00
|
|
|
String message = String.format("The installation of the algorithm in the ghost dataminer is completed successfully.");
|
2017-07-24 12:32:18 +02:00
|
|
|
message+="\n\nYou can retrieve experiment results under the '/DataMiner' e-Infrastructure Workspace folder or from the DataMiner interface.\n\n"+ info;
|
2017-07-05 17:50:42 +02:00
|
|
|
return message;
|
|
|
|
***REMOVED***
|
|
|
|
|
2017-07-06 17:34:45 +02:00
|
|
|
public String getFailedBody(String message) ***REMOVED***
|
|
|
|
String body = String.format("An error occurred while deploying your algorithm");
|
|
|
|
body+= "\n\nHere are the error details:\n\n" + message;
|
|
|
|
return body;
|
2017-07-05 17:50:42 +02:00
|
|
|
***REMOVED***
|
|
|
|
|
2017-07-24 12:32:18 +02:00
|
|
|
public String getSuccessBodyRelease(String info) ***REMOVED***
|
|
|
|
String message = String.format("SVN REPOSITORY CORRECTLY UPDATED.");
|
|
|
|
message+="\n\n The CRON job will install the algorithm in the target VRE \n\n"+ info;
|
|
|
|
return message;
|
|
|
|
***REMOVED***
|
|
|
|
|
2017-07-25 15:51:25 +02:00
|
|
|
public String getFailedBodyRelease(String info) ***REMOVED***
|
|
|
|
String message = String.format("SVN REPOSITORY UPDATE FAILED.");
|
|
|
|
message+="\n\n The CRON job will NOT be able to install the algorithm in the target VRE \n\n"+ info;
|
|
|
|
return message;
|
|
|
|
***REMOVED***
|
|
|
|
|
2017-07-06 17:34:45 +02:00
|
|
|
***REMOVED*** public String getSubject() ***REMOVED***
|
|
|
|
***REMOVED*** if(this.isError()) ***REMOVED***
|
|
|
|
***REMOVED*** return this.getFailedSubject();
|
|
|
|
***REMOVED*** ***REMOVED*** else ***REMOVED***
|
|
|
|
***REMOVED*** return this.getSuccessSubject();
|
|
|
|
***REMOVED*** ***REMOVED***
|
|
|
|
***REMOVED*** ***REMOVED***
|
|
|
|
***REMOVED***
|
|
|
|
***REMOVED*** public String getBody() ***REMOVED***
|
|
|
|
***REMOVED*** if(this.isError()) ***REMOVED***
|
|
|
|
***REMOVED*** return this.getFailedBody();
|
|
|
|
***REMOVED*** ***REMOVED*** else ***REMOVED***
|
|
|
|
***REMOVED*** return this.getSuccessBody();
|
|
|
|
***REMOVED*** ***REMOVED***
|
|
|
|
***REMOVED*** ***REMOVED***
|
2017-07-05 17:50:42 +02:00
|
|
|
|
|
|
|
***REMOVED***
|