@Override
    public void completed(ProcessEvent event) {
      taskEntity.setDateEnd(System.currentTimeMillis());
      taskEntity.setMessage(toString(event.getTask()));
      roundProgression(event);

      ParameterValueGroup output = event.getOutput();
      if (output != null) {
        try {
          taskEntity.setTaskOutput(ParamUtilities.writeParameterJSON(output));
        } catch (JsonProcessingException e) {
          LOGGER.log(Level.WARNING, "Process output serialization failed", e);
        }
      }

      // If a warning occurred, send exception to the user.
      if (!warnings.isEmpty()) {
        taskEntity.setState(TaskState.WARNING.name());
        taskEntity.setMessage(processWarningMessage());
      } else {
        taskEntity.setState(TaskState.SUCCEED.name());
      }

      updateTask(taskEntity);
    }
 @Override
 public void resumed(ProcessEvent event) {
   taskEntity.setState(TaskState.RUNNING.name());
   taskEntity.setMessage(toString(event.getTask()));
   roundProgression(event);
   updateTask(taskEntity);
 }
 @Override
 public void started(ProcessEvent event) {
   taskEntity.setState(TaskState.RUNNING.name());
   taskEntity.setDateStart(System.currentTimeMillis());
   taskEntity.setMessage(toString(event.getTask()));
   roundProgression(event);
   updateTask(taskEntity);
 }
    @Override
    public void failed(ProcessEvent event) {
      taskEntity.setState(TaskState.FAILED.name());
      taskEntity.setDateEnd(System.currentTimeMillis());

      final Exception exception = event.getException();
      final String exceptionStr = printException(exception);
      taskEntity.setMessage(toString(event.getTask()) + " cause : " + exceptionStr);
      // taskEntity.setProgress((double) event.getProgress());
      updateTask(taskEntity);
    }
    @Override
    public void progressing(ProcessEvent event) {
      taskEntity.setState(TaskState.RUNNING.name());
      taskEntity.setMessage(toString(event.getTask()));
      roundProgression(event);

      ParameterValueGroup output = event.getOutput();
      if (output != null) {
        try {
          taskEntity.setTaskOutput(ParamUtilities.writeParameterJSON(output));
        } catch (JsonProcessingException e) {
          LOGGER.log(Level.WARNING, "Process output serialization failed", e);
        }
      }

      if (event.getException() != null) {
        warnings.add(event);
      }

      updateTask(taskEntity);
    }