} // wakeup private void DynamicPriority() { // suspened activities with dynamic priority node String sql = "SELECT * " + "FROM AD_WF_Activity a " + "WHERE Processed='N' AND WFState='OS'" // suspended + " AND EXISTS (SELECT * FROM AD_Workflow wf" + " INNER JOIN AD_WF_Node wfn ON (wf.AD_Workflow_ID=wfn.AD_Workflow_ID) " + "WHERE a.AD_WF_Node_ID=wfn.AD_WF_Node_ID AND wf.AD_WorkflowProcessor_ID=@AD_WorkflowProcessor_ID" + " AND wfn.DynPriorityUnit IS NOT NULL AND wfn.DynPriorityChange IS NOT NULL)"; int count = 0; try { SqlParameter[] param = new SqlParameter[1]; param[0] = new SqlParameter("@AD_WorkflowProcessor_ID", m_model.GetAD_WorkflowProcessor_ID()); DataSet ds = DB.ExecuteDataset(sql, param); foreach (DataRow dr in ds.Tables[0].Rows) { MWFActivity activity = new MWFActivity(GetCtx(), dr, null); if (activity.GetDynPriorityStart() == 0) { activity.SetDynPriorityStart(activity.GetPriority()); } long ms = CommonFunctions.CurrentTimeMillis() - CommonFunctions.CurrentTimeMillis(activity.GetCreated()); MWFNode node = activity.GetNode(); int prioDiff = node.CalculateDynamicPriority((int)(ms / 1000)); activity.SetPriority(activity.GetDynPriorityStart() + prioDiff); activity.Save(); count++; } } catch (Exception e) { log.Log(Level.SEVERE, sql, e); } m_summary.Append("DynPriority #").Append(count).Append(" - "); } // setPriority