Search in sources :

Example 1 with X_I_Workflow

use of org.eevolution.model.X_I_Workflow in project adempiere by adempiere.

the class ImportWorkflow method doIt.

@Override
protected String doIt() throws Exception {
    if (m_DeleteOldImported) {
        int no = 0;
        for (X_I_Workflow importWorkflow : getRecords(true, false)) {
            importWorkflow.deleteEx(true);
            no++;
        }
        log.fine("Delete Old Impored =" + no);
    }
    fillIDValues();
    importRecords();
    return "Imported: " + imported;
}
Also used : X_I_Workflow(org.eevolution.model.X_I_Workflow)

Example 2 with X_I_Workflow

use of org.eevolution.model.X_I_Workflow in project adempiere by adempiere.

the class ImportWorkflow method fillIDValues.

/**
	 * fill IDs values based on Search Key
	 */
public void fillIDValues() {
    for (X_I_Workflow importWorkflow : getRecords(false, false)) {
        int AD_Org_ID = getID(MOrg.Table_Name, "Value = ?", new Object[] { importWorkflow.getOrgValue() });
        if (AD_Org_ID > 0)
            importWorkflow.setAD_Org_ID(AD_Org_ID);
        int S_Resource_ID = getID(MResource.Table_Name, "Value=?", new Object[] { importWorkflow.getResourceValue() });
        if (S_Resource_ID > 0)
            importWorkflow.setS_Resource_ID(S_Resource_ID);
        String errorMsg = "";
        if (MWorkflow.WORKFLOWTYPE_Manufacturing.equals(importWorkflow.getWorkflowType())) {
            if (importWorkflow.getS_Resource_ID() <= 0) {
                errorMsg += "@S_Resource_ID@ @NotFound@, ";
            }
        }
        if (importWorkflow.getDocumentNo() == null)
            errorMsg += "@DocumentNo@ @NotFound@, ";
        if (importWorkflow.getName() == null)
            errorMsg += "@Name@ @NotFound@, ";
        if (importWorkflow.getAccessLevel() == null)
            errorMsg += "@AccessLevel@ @NotFound@, ";
        if (importWorkflow.getAuthor() == null)
            errorMsg += "@Author@ @NotFound@, ";
        if (importWorkflow.getAuthor() == null)
            errorMsg += "@Author@ @NotFound@, ";
        if (importWorkflow.getEntityType() == null)
            errorMsg += "@EntityType@ @NotFound@, ";
        if (importWorkflow.getPublishStatus() == null)
            errorMsg += "@PublishStatus@ @NotFound@, ";
        if (importWorkflow.getValue() == null)
            errorMsg += "@Value@ @NotFound@, ";
        if (importWorkflow.getVersion() <= 0)
            errorMsg += "@Version@ @NotFound@, ";
        if (importWorkflow.getWorkflowType() == null)
            errorMsg += "@WorkflowType@ @NotFound@, ";
        if (importWorkflow.getDurationUnit() == null)
            errorMsg += "@DurationUnit@ @NotFound@, ";
        if (errorMsg != null && errorMsg.length() > 0) {
            importWorkflow.setI_ErrorMsg(Msg.parseTranslation(getCtx(), errorMsg));
        }
        importWorkflow.saveEx();
    }
}
Also used : X_I_Workflow(org.eevolution.model.X_I_Workflow)

Example 3 with X_I_Workflow

use of org.eevolution.model.X_I_Workflow in project adempiere by adempiere.

the class ImportWorkflow method importRecords.

/**
	 * import records from I_Workflow to AD_Workflow table
	 */
public void importRecords() {
    List<X_I_Workflow> iworkflows = getRecords(false, m_IsImportOnlyNoErrors);
    for (X_I_Workflow importWorkflow : iworkflows) {
        MWFNode node = null;
        MWorkflow workflow = getWorkflow(importWorkflow);
        if (workflow != null) {
            node = getWorkflowNode(importWorkflow, workflow);
        }
        if (node != null) {
            if (workflow.getAD_WF_Node_ID() <= 0) {
                workflow.setAD_WF_Node_ID(node.get_ID());
                workflow.saveEx();
            }
            importWorkflow.setAD_WF_Node_ID(node.get_ID());
            importWorkflow.setAD_Workflow_ID(workflow.get_ID());
            imported++;
        }
        importWorkflow.setI_IsImported(true);
        importWorkflow.setProcessed(true);
        importWorkflow.saveEx();
    }
    // create the transition
    for (X_I_Workflow importWorkflow : iworkflows) {
        MWFNode node = (MWFNode) importWorkflow.getAD_WF_Node();
        if (node != null) {
            int node_id = getID(MWFNode.Table_Name, "AD_Workflow_ID= ? AND Value=?", new Object[] { importWorkflow.getAD_Workflow_ID(), importWorkflow.getNodeNextValue() });
            if (node_id > 0) {
                MWFNode next = new MWFNode(getCtx(), node_id, get_TrxName());
                createTransition(node, next);
            }
        }
    }
}
Also used : X_I_Workflow(org.eevolution.model.X_I_Workflow) MWorkflow(org.compiere.wf.MWorkflow) MWFNode(org.compiere.wf.MWFNode)

Aggregations

X_I_Workflow (org.eevolution.model.X_I_Workflow)3 MWFNode (org.compiere.wf.MWFNode)1 MWorkflow (org.compiere.wf.MWorkflow)1