/*
  * 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 and the
  * product instance exists in the system.
  */
 private void updateErrorTask(
     ProductInstance productInstance, Task task, String message, Throwable t) {
   String piResource = getUrl(productInstance);
   task.setResult(new TaskReference(piResource));
   updateErrorTask(task, message, t);
 }