Reject a Task using DFC

Hi,

I have a workflow which contains a Reject Flow (the red arrow on designer) and a regular flow on a task (let's say task X).
I want to reject this task using DFC. However, the "reject" is not one of the operations that IDfWorkitem handle.

So, how can I make this operation? Is there a query or a DFC method for doing this operation?

Thanks,

Comments

  • From a runtime perspective, a reject flow is the same as regular flow.  You just need to tell specify which flow you wan to transition to.  Red arrow (and notion of reject) is purely a design time UI feature.
  • edited August 20
    Thanks, @DCTM_Guru
    I found something (http://www.javablog.fr/dctm-java-useful-dfc ) and I believe it works.
    Following code, takes the queue item's object id as input and rejects the task.

    public int rejectTask(String qitemId){
    IDfSession session = null;

    try{
    session = getSession();

    IDfQueueItem qitem = (IDfQueueItem) session.getObject(new DfId(qitemId));
    IDfWorkitem witem = qitem.getWorkitem();

    if(witem != null){
    if(witem.getRuntimeState() == 0)
    witem.acquire();

    IDfList activities = wi.getRejectActivities();
    IDfList list = new DfList();
    list.append(activities.get(0));
    wi.setOutputByActivities(list);
    wi.complete();

    return 0;
    }

    return 1;

    }
    catch(Exception e) {
    e.printStackTrace();
    return -1;
    }
    }


Sign In or Register to comment.