Package org.apache.agila.model

Examples of org.apache.agila.model.Node


    public void testRequiredVariables() {
        assertTrue( getRequiredVariables() == 1 );
    }

    public void testPropertiesSet() {
        Node node = businessProcess.getNode(new NodeID(3));
        assertTrue("Not found node!", node instanceof LeaveApplicationTask);

        LeaveApplicationTask task = (LeaveApplicationTask) node;
        assertEquals("foo property", "hello", task.getFoo());
        assertEquals("bar property", 123, task.getBar());
View Full Code Here


    public void addConnection(int startNodeID, int endNodeID, String name) {

        // System.out.println("addConnection() : startid = " + startNodeID
        //        + " endid = " + endNodeID + " name = " + name);

        Node startNode = (Node) nodeMap.get(new NodeID(startNodeID));
        Node endNode = (Node) nodeMap.get(new NodeID(endNodeID));

        ConnectionImpl c = new ConnectionImpl(name);

        c.setParentNode(startNode);
        c.setChildNode(endNode);

        startNode.addOutboundConnection(c);
        endNode.addInboundConnection(c);
    }
View Full Code Here

         */

        BusinessProcess graph = wm.getGraphByID(
                eiSvc.getInstanceByID(tk.getInstanceID()).getBusinessProcessID());

        Node n = graph.getNode(tk.getCurrentNodeID());

        NodeContextImpl nc = new NodeContextImpl(n, ei, timerService,
                taskService, notificationService);

        nc.setAppData(msg.getAppData());

        /*
         * now examine the state of this token and process accordingly.
         */

        switch(tk.getCurrentState()) {

            /*
             *  in 'pre start' state for this node.  Setup, call the doStart()
             *  method, and then based on the return from doStart(), either
             *  create and fling another message back into the queue, or stop
             *  and wait for response from outside
             */

            case Token.PRE : {

                logger.debug("processMessage : Current state = PRE for " + tk);

                /**
                 *  must send new token b/c it can be used as the current token...
                 */

                Token newToken = tokenService.newToken(tk.getInstanceID(),
                                                      tk.getCurrentNodeID(),
                                                      Token.MID);

                nc.setCurrentExecutionToken(tk);
                nc.setNextExecutionToken(newToken);

                boolean ret = n.doStart(nc);

                if (ret == true) {

                    EngineMessage newMsg = new EngineMessageImpl();

                    newMsg.setCurrentTokenID(newToken.getTokenID());

                    queue.enqueue(newMsg);
                }

                break;
            }

            /*
             *  this state is 'between' doStart() and doEnd().  So prepare
             *  context and call doEnd()
             */

            case Token.MID : {

                logger.debug("processMessage : Current state = MID for " + tk);

                nc.setCurrentExecutionToken(tk);

                /*
                 *  call doEnd() and get the set of conenctions that we need
                 *  to traverse, or null if we are to stop
                 */
                Connection[] c = n.doEnd(nc);

                if (c != null && c.length > 0) {

                    Token[] newTokens = tokenService.nextToken(c, tk);

View Full Code Here

         */
        String classname = node.attribute("class").getValue();


        // TODO may wish to also use the Thread context class loader
        Node n = (Node) Class.forName(classname).newInstance();

        n.setNodeId(new NodeID(Integer.parseInt(node.attribute("id").getValue())));

        if (node.attribute("type").getValue().equals("start")) {
            graph.setRoot(n);
        }

        n.setDisplayName(node.attribute("display_name").getValue());

        /*
         *  set node properties
         */

        List properties = node.selectNodes("property");

        Iterator it = properties.iterator();

        while(it.hasNext()) {

            Element property = (Element) it.next();

            String name = property.attributeValue("name");
            String value = property.attributeValue("value");
            if (value == null || value.equals("")) {
                value = property.getText();
            }

            setProperty(n, name, value);
        }

        /*
         *  get actors
         */

        List actors = node.selectNodes("actors/actor");

        it = actors.iterator();

        while(it.hasNext()) {

            Element actor = (Element) it.next();

            Actor actorObj = new Actor(actor.attribute("name").getValue());

            n.addActor(actorObj);
        }

        /*
         * and now the bindings
         */

        List bindings = node.selectNodes("bindings/binding");

        it = bindings.iterator();

        while(it.hasNext()) {

            Element bindingNode = (Element) it.next();

            String name = getValueOfAttribute("name", bindingNode);
            String type = getValueOfAttribute("type", bindingNode);
            String input = getValueOfAttribute("input", bindingNode);
            String output = getValueOfAttribute("output", bindingNode);

            String value = bindingNode.getTextTrim();

            Binding binding = new Binding(name, value,
                    ("EL".equals(type.toUpperCase()) ? Binding.EL : Binding.STATIC),
                    ("TRUE".equals(input.toUpperCase())),
                    ("TRUE".equals(output.toUpperCase())));

            n.addBinding(binding);
        }
        graph.addNode(n);

    }
View Full Code Here

         */

        BusinessProcess bp =  businessProcessService.getGraphByID(instance.getBusinessProcessID());

        InstanceID instanceID = instance.getInstanceID();
        Node root = bp.getRoot();
        NodeID nodeId = root.getNodeId();
        Token token = tokenService.newToken(instanceID, nodeId, Token.PRE);

        /*
         * and a message
         */
 
View Full Code Here

    }

    public Renderer getRendererForTask(TaskID taskID, Class rendererType) {

        Token token = getTokenForTaskID(taskID);
        Node node = getNodeForToken(token);

        NodeContextImpl ctx = new NodeContextImpl(node,
                instanceService.getInstanceByID(token.getInstanceID()),
                timerService, this, notificationService);
View Full Code Here

    public ResponseHandler getResponseHandlerForTask(TaskID taskID, Class handlerType) {


        Token token = getTokenForTaskID(taskID);
        Node node = getNodeForToken(token);

        NodeContextImpl ctx = new NodeContextImpl(node,
                instanceService.getInstanceByID(token.getInstanceID()),
                timerService, this, notificationService);
View Full Code Here

TOP

Related Classes of org.apache.agila.model.Node

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.