public boolean process(PO document,int AD_Table_ID){
  m_noCalled++;
  MWorkflow[] wfs=MWorkflow.getDocValue(document.getCtx(),document.getAD_Client_ID(),AD_Table_ID,document.get_TrxName());
  if (wfs == null || wfs.length == 0)   return false;
  boolean started=false;
  for (int i=0; i < wfs.length; i++) {
    MWorkflow wf=wfs[i];
    String logic=wf.getDocValueLogic();
    if (logic == null || logic.length() == 0) {
      log.severe("Workflow has no Logic - " + wf.getName());
      continue;
    }
    if (wf.getAD_Client_ID() != document.getAD_Client_ID())     continue;
    boolean sql=logic.startsWith("SQL=");
    if (sql && !testStart(wf,document)) {
      log.fine("SQL Logic evaluated to false (" + logic + ")");
      continue;
    }
    if (!sql && !Evaluator.evaluateLogic(document,logic)) {
      log.fine("Logic evaluated to false (" + logic + ")");
      continue;
    }
    log.fine(logic);
    int AD_Process_ID=305;
    ProcessInfo pi=new ProcessInfo(wf.getName(),AD_Process_ID,AD_Table_ID,document.get_ID());
    pi.setAD_User_ID(Env.getAD_User_ID(document.getCtx()));
    pi.setAD_Client_ID(document.getAD_Client_ID());
    if (wf.start(pi,document.get_TrxName()) != null) {
      log.config(wf.getName());
      m_noStarted++;
      started=true;
    }
  }
  return started;
}

public boolean process ( PO document , int AD_Table_ID ) { m_noCalled ++ ; MWorkflow [ ] wfs = MWorkflow . getDocValue ( document . getCtx ( ) , document . getAD_Client_ID ( ) , AD_Table_ID , document . get_TrxName ( ) ) ; if ( wfs == null || wfs . length == 0 ) return false ; boolean started = false ; for ( int i = 0 ; i < wfs . length ; i ++ ) { MWorkflow wf = wfs [ i ] ; String logic = wf . getDocValueLogic ( ) ; if ( logic == null || logic . length ( ) == 0 ) { log . severe ( "Workflow has no Logic - " + wf . getName ( ) ) ; continue ; } if ( wf . getAD_Client_ID ( ) != document . getAD_Client_ID ( ) ) continue ; boolean sql = logic . startsWith ( "SQL=" ) ; if ( sql && ! testStart ( wf , document ) ) { log . fine ( "SQL Logic evaluated to false (" + logic + ")" ) ; continue ; } if ( ! sql && ! Evaluator . evaluateLogic ( document , logic ) ) { log . fine ( "Logic evaluated to false (" + logic + ")" ) ; continue ; } log . fine ( logic ) ; int AD_Process_ID = 305 ; ProcessInfo pi = new ProcessInfo ( wf . getName ( ) , AD_Process_ID , AD_Table_ID , document . get_ID ( ) ) ; pi . setAD_User_ID ( Env . getAD_User_ID ( document . getCtx ( ) ) ) ; pi . setAD_Client_ID ( document . getAD_Client_ID ( ) ) ; if ( wf . start ( pi , document . get_TrxName ( ) ) != null ) { log . config ( wf . getName ( ) ) ; m_noStarted ++ ; started = true ; } } return started ; }
process document value workflow
