private List<Object> serializeAsList() { Date now = new Date(); String humanDuration = Utils.getDuration(this.beginDate, now); List<Object> dataCol = new ArrayList<Object>(); dataCol.add(this.runId); dataCol.add(Utils.getHostname()); dataCol.add(Utils.formatOnlyDay(this.beginDate)); dataCol.add(Utils.formatCompleteDate(this.beginDate)); dataCol.add(Utils.formatCompleteDate(now)); dataCol.add(humanDuration); dataCol.add(this.status); dataCol.add(this.nbBuilds); return dataCol; }
public void notifyEnd() { String subject = "Process "+processName+" on "+Utils.getHostname()+" finished"; Date endDate = new Date(); String message = "The following process: "+ processName +" launched on "+ Utils.getHostname()+ " the "+ this.launchDate.toString()+" and finished "+endDate.toString()+". " + "It ran for a total time of "+Utils.getDuration(this.launchDate, endDate); for (NotifierEngine engine : this.engines) { engine.notify(subject, message); } } }
private JsonElement serializeAsJson() { JsonObject result = new JsonObject(); Date now = new Date(); String humanDuration = Utils.getDuration(this.beginDate, now); result.addProperty("runId", this.runId); result.addProperty("hostname", Utils.getHostname()); result.addProperty("beginDay", Utils.formatOnlyDay(this.beginDate)); result.addProperty("beginDateStr", Utils.formatCompleteDate(this.beginDate)); this.addDate(result, "beginDate", this.beginDate); result.addProperty("endDateStr", Utils.formatCompleteDate(now)); this.addDate(result, "endDate", now); result.addProperty("duration", humanDuration); result.addProperty("endStatus", this.status); result.addProperty("nbBuilds", this.nbBuilds); return result; }