public WfAssignment delegate(String workEffortId, String fromPartyId, String fromRoleTypeId, Timestamp fromFromDate, String toPartyId, String toRoleTypeId, Timestamp toFromDate) throws WfException {
WfActivity activity = WfFactory.getWfActivity(delegator, workEffortId);
WfAssignment fromAssign = null;
// check status and delegateAfterStart attribute
if (activity.state().equals("open.running") && !activity.getDefinitionObject().getBoolean("delegateAfterStart").booleanValue())
throw new WfException("This activity cannot be delegated once it has been started");
if (fromPartyId == null && fromRoleTypeId == null && fromFromDate == null) {
Iterator i = activity.getIteratorAssignment();
fromAssign = (WfAssignment) i.next();