The following trigger chooses a random handler for the task:
String group = task.getHandlerGroupId(); String handler= task.getHandlerUserId(); if (task.getHandlerGroupId()!=null){ ArrayList hand = AdapterManager.getInstance().getSecuredStepAdapterManager() .getTaskEditHandlerList(task.getSecure(), task.getId(), task.getCategoryId()); int size = hand.size(); if (size>0){ int pointer = new Random().nextInt(size); handler= ((SecuredUserBean)hand.get(pointer)).getId(); group = null; } } if (task.getParentId()!=null){ SecuredTaskTriggerBean nb = new SecuredTaskTriggerBean(task.getId(),task.getDescription(), task.getName(), task.getShortname(), task.getSubmitdate(), task.getUpdatedate(), task.getClosedate(), task.getActualBudget(), task.getBudget(), task.getDeadline(), task.getNumber(), task.getSubmitterId(), task.getHandlerId(), handler, group, task.getParentId(), task.getCategoryId(), task.getWorkflowId(), task.getStatusId(), task.getResolutionId(), task.getPriorityId(),task.getUdfValues(), task.getSecure()); return nb.create(false); } else return nb;
Copyright (c) 2002-2006. All rights reserved.
|