Thursday, 20 November 2014

Dispatch Work Item in FileNet Process Engine (Process Engine API)

   
    //Fetch the Work Item
    VWWorkObject vwWorkObj=null;
      try{
          VWRoster roster=peSession.getRoster(rosterName);
          int queryFlags=VWRoster.QUERY_NO_OPTIONS;
          String Name = "abcd";
          String filter="Doc_Name="+Name;//Change Accrordigly (Based on Process Administaration tool fields)
             
          VWRosterQuery query=roster.createQuery(null, null, null, queryFlags, filter, null, VWFetchType.FETCH_TYPE_WORKOBJECT);
          log.info("Total records for Work ITem: "+query.fetchCount());
         
          while(query.hasNext()){
              vwWorkObj=(VWWorkObject) query.next(); 
          }
         
      }catch(VWException vwe){
          log.error("Exception found at PEManager.getVWWorkObject():"+vwe,vwe);
          vwe.printStackTrace();
      }catch(Exception vwe){
          log.error("Exception found at PEManager.getVWWorkObject():"+vwe,vwe);
          vwe.printStackTrace();
      }
     
//Terminate(Dispatch) work Item
try{

if(vwWorkObj!=null){

String Response = "Cancel";
VWStepElement vwStepObj=vwWorkObj.fetchStepElement();
vwStepObj.doLock(true);
vwStepObj.setSelectedResponse(Response);

vwStepObj.doDispatch();
}else{
                           
log.info("VWWorkObject is NULL");
                       
}
                       
}catch(Exception ex){
                           
ex.printStackTrace();
                       
}   

No comments:

Post a Comment