use of org.compiere.wf.MWFNode in project adempiere by adempiere.
the class WorkflowTest method testQuery.
public void testQuery() throws Exception {
//
// Check MWFActivity
int AD_Table_ID = MRequisition.Table_ID;
// dummy;
int Record_ID = 1;
MWFActivity.get(getCtx(), AD_Table_ID, Record_ID, false);
MWFActivity.get(getCtx(), AD_Table_ID, Record_ID, true);
//
// Check MWFEventAudit
// dummy
int AD_WF_Process_ID = 1;
// dummy
int AD_WF_Node_ID = 1;
MWFEventAudit.get(getCtx(), AD_WF_Process_ID, AD_WF_Node_ID, getTrxName());
MWFEventAudit.get(getCtx(), AD_WF_Process_ID, getTrxName());
//
// Check MWFProcess
MWFProcess proc = new Query(getCtx(), MWFProcess.Table_Name, null, getTrxName()).setClient_ID().setOrderBy(MWFProcess.COLUMNNAME_AD_WF_Process_ID).first();
if (proc != null) {
proc.getActivities(true, false, getTrxName());
proc.getActivities(true, true, getTrxName());
} else {
// TODO: check MWFProcess - need better test
}
//
// Check MWorkflow, MWFNode, MWFNodeNext etc
int AD_Client_ID = getAD_Client_ID();
// Process_Requisition
int AD_Workflow_ID = 115;
MWorkflow wf = MWorkflow.get(getCtx(), AD_Workflow_ID);
for (MWFNode node : wf.getNodes(false, AD_Client_ID)) {
MWFNodePara.getParameters(node.getCtx(), node.getAD_WF_Node_ID());
for (MWFNodeNext next : node.getTransitions(AD_Client_ID)) {
next.getConditions(true);
next.getConditions(false);
}
}
// Check MWorkflowProcessor
for (MWorkflowProcessor processor : MWorkflowProcessor.getActive(getCtx())) {
processor.getLogs();
}
//
//
}
use of org.compiere.wf.MWFNode in project adempiere by adempiere.
the class WWorkflow method doGet.
// init
/**
* Process the HTTP Get request - Initial Call.
* <br>
* http://localhost/adempiere/WWorkflow?AD_Menu_ID=123
* <br>
*
* Find the AD_Workflow_ID
* Load workflow and initial session atribute
* Create output
*
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//Log.trace(Log.l1_User, "WWorkflow.doGet");
//WUtil.debug(new String("In do get"),"");
// Get Session attributes
HttpSession sess = request.getSession();
WebSessionCtx wsc = WebSessionCtx.get(request);
ctx = wsc.ctx;
//String loginInfo = (String)sess.getAttribute(WebEnv.SA_LOGININFO);
if (ctx == null) {
WebUtil.createTimeoutPage(request, response, this, null);
return;
}
// Get Parameter: Menu_ID
int AD_Menu_ID = WebUtil.getParameterAsInt(request, "AD_Menu_ID");
// Get Parameter: Menu_ID
int AD_Window_ID = WebUtil.getParameterAsInt(request, "AD_Window_ID");
//set language
AD_Language = Env.getAD_Language(ctx);
//load AD_Workflow_ID
int AD_Workflow_ID = getAD_Workflow_ID(AD_Menu_ID);
//load workflow
loadWorkflow(ctx, AD_Workflow_ID, sess);
//get session attributes
MWorkflow wf = (MWorkflow) sess.getAttribute(WORKFLOW);
MWFNode[] nodes = (MWFNode[]) sess.getAttribute(NODES);
ArrayList nodes_ID = (ArrayList) sess.getAttribute(NODES_ID);
int[][] imageMap = (int[][]) sess.getAttribute(IMAGE_MAP);
int activeNode = ((Integer) sess.getAttribute(ACTIVE_NODE)).intValue();
//create output
WebDoc doc = preparePage("loginInfo");
doc = createLayout(doc, wf, activeNode, nodes, nodes_ID, imageMap);
WebUtil.createResponse(request, response, this, null, doc, false);
}
use of org.compiere.wf.MWFNode in project adempiere by adempiere.
the class WWorkflow method loadWorkflow.
//createLayout
/**
* Load workflw and initialize the session attributes.
*
*
* @param ctx
* @param AD_Workflow_ID
* @param sess
*
*/
private void loadWorkflow(Properties ctx, int AD_Workflow_ID, HttpSession sess) {
MWorkflow wf = new MWorkflow(ctx, AD_Workflow_ID, null);
//get the MWFNode in order
MWFNode[] nodes = wf.getNodes(true, Env.getContextAsInt(ctx, "#AD_Client_ID"));
MWFNode wfn = null;
ArrayList nodes_ID = new ArrayList();
for (int i = 0; i < nodes.length; i++) {
wfn = nodes[i];
nodes_ID.add(new Integer(wfn.getAD_WF_Node_ID()));
}
//for
int[][] imageMap = generateImageMap(nodes_ID);
//printMap(imageMap);
//set session attribtes
sess.setAttribute(WORKFLOW, wf);
sess.setAttribute(NODES, nodes);
sess.setAttribute(NODES_ID, nodes_ID);
sess.setAttribute(IMAGE_MAP, imageMap);
sess.setAttribute(ACTIVE_NODE, new Integer(-999));
}
use of org.compiere.wf.MWFNode in project adempiere by adempiere.
the class WWorkflow method doPost.
// doGet
/**
* Process the HTTP Post request - Initial Call.
*
* Execute the received command
* Update session attributes
* Create output
*
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//WUtil.debug(new String("In do Post"),"");
HttpSession sess = request.getSession();
WebSessionCtx wsc = WebSessionCtx.get(request);
Properties ctx = wsc.ctx;
if (ctx == null) {
WebUtil.createTimeoutPage(request, response, this, null);
return;
}
//String loginInfo = (String)sess.getAttribute(WEnv.SA_LOGININFO);
//get session attributes
MWorkflow wf = (MWorkflow) sess.getAttribute(WORKFLOW);
MWFNode[] nodes = (MWFNode[]) sess.getAttribute(NODES);
ArrayList nodes_ID = (ArrayList) sess.getAttribute(NODES_ID);
int[][] imageMap = (int[][]) sess.getAttribute(IMAGE_MAP);
int activeNode = ((Integer) sess.getAttribute(ACTIVE_NODE)).intValue();
//execute commnad
String m_command = request.getParameter(M_Command);
int j_command = WebUtil.getParameterAsInt(request, J_Command);
//WUtil.debug(m_command,"m_command");
//WUtil.debug(""+j_command,"j_command");
executeCommand(m_command, j_command, wf, activeNode, nodes, nodes_ID, sess);
//get updated session attributes
wf = (MWorkflow) sess.getAttribute(WORKFLOW);
nodes = (MWFNode[]) sess.getAttribute(NODES);
nodes_ID = (ArrayList) sess.getAttribute(NODES_ID);
imageMap = (int[][]) sess.getAttribute(IMAGE_MAP);
activeNode = ((Integer) sess.getAttribute(ACTIVE_NODE)).intValue();
//create layout
WebDoc doc = preparePage("loginInfo");
doc = createLayout(doc, wf, activeNode, nodes, nodes_ID, imageMap);
WebUtil.createResponse(request, response, this, null, doc, false);
}
Aggregations