Package org.drools.jpdl.core

Examples of org.drools.jpdl.core.JpdlProcess


                org.jbpm.graph.def.ProcessDefinition.parseXmlResource(name);
        return loadJpdlProcess(processDefinition);
    }

    public JpdlProcess loadJpdlProcess(org.jbpm.graph.def.ProcessDefinition processDefinition) {
        JpdlProcess process = new JpdlProcess();
        process.setId(processDefinition.getName());
        process.setName(processDefinition.getName());
        process.setPackageName("org.drools");
        SwimlaneContext swimlaneContext = (SwimlaneContext) process.getDefaultContext(SwimlaneContext.SWIMLANE_SCOPE);
        process.setDefaultContext(swimlaneContext);
        org.jbpm.graph.def.Node startState = processDefinition.getStartState();
        String startStateName = startState == null ? null : startState.getName();

        List<org.jbpm.graph.def.Node> nodes = processDefinition.getNodes();

        Map<org.jbpm.graph.def.Node, Node> mapping = new HashMap<org.jbpm.graph.def.Node, Node>();

        for (org.jbpm.graph.def.Node jPDLnode : nodes) {
            JpdlNode node = classifyNode(processDefinition, jPDLnode, swimlaneContext);
            //@TODO: see how to include this following code into the classifyNode method

            if (node == null) {
                throw new IllegalArgumentException(
                        "Unknown node type: " + jPDLnode.getClass().getName() + " " + jPDLnode);
            }
            setDefaultNodeProperties(jPDLnode, (JpdlNode) node);
            node.setId(++nodeId);
            mapping.put(jPDLnode, node);
            process.addNode(node);
            if (startStateName != null && startStateName.equals(node.getName())) {
                process.setStartState(node);
            }
        }

        generateConnections(mapping);
View Full Code Here

TOP

Related Classes of org.drools.jpdl.core.JpdlProcess

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.