@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 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);
    }