/*
  * Update the task with necessary information when the task is success.
  */
 private void updateSuccessTask(Task task, ProductInstance productInstance) {
   String piResource = getUrl(productInstance);
   task.setResult(new TaskReference(piResource));
   task.setEndTime(new Date());
   task.setStatus(TaskStates.SUCCESS);
   taskManager.updateTask(task);
 }
 /*
  * Update the task with necessary information when the task is wrong.
  */
 private void updateErrorTask(Task task, String message, Throwable t) {
   TaskError error = new TaskError(message);
   error.setMajorErrorCode(t.getMessage());
   error.setMinorErrorCode(t.getClass().getSimpleName());
   task.setEndTime(new Date());
   task.setStatus(TaskStates.ERROR);
   task.setError(error);
   taskManager.updateTask(task);
   log.info(
       "An error occurs while executing a product action. See task "
           + task.getHref()
           + "for more information");
 }