TrackStudio Enterprise 3.2
Edit Task/INSTEAD OF:

The following trigger creates messages of the type log for each deadline change using the Current Task -> Task... -> Edit link. Create message type log before using this trigger.

SecuredTaskBean oldOne = new SecuredTaskBean(task.getId(),task.getSecure());
Object oldDeadline=oldOne.getDeadline();
Object newDeadline = task.getDeadline();
String actionType=null;

if (oldDeadline==null && newDeadLine!=null) {
   actionType="Deadline was set.";
} else if (oldDeadline!=null && newDeadLine==null) {
   actionType="Deadline was reset.";
} else if (oldDeadline!=null && newDeadLine!=null) {
   if (newDeadline.after(oldDeadline)) {
      actionType="Deadline was extended.";
   } else if (newDeadline.before(oldDeadline)) {
      actionType="Deadline was moved up.";
   }
}

Object newOne = task.update(false);
if (actionType!=null) {
   SecuredMessageTriggerBean bean = new SecuredMessageTriggerBean(null,actionType,null,null,
      task.getDeadline(), task.getBudget(), task.getId(), task.getSecure().getUserId(), null,
      task.getPriorityId(), task.getHandlerId(), task.getHandlerUserId(), task.getHandlerGroupId(),
      CSVImport.findMessageTypeIdByName("log",
      task.getCategory().getName()), null, task.getSecure()).create();
}
return newOne;
Copyright (c) 2002-2006. All rights reserved.