Package au.edu.qut.yawl.elements.state

Examples of au.edu.qut.yawl.elements.state.YIdentifier


        super(name);
    }


    public void setUp() throws Exception{
        _identifier = new YIdentifier();
        _childIdentifier = _identifier.createChild(null);
        _workItemID = new YWorkItemID(_identifier, "task-123");
        _workItem = new YWorkItem(null, "ASpecID", _workItemID, true, false);
    }
View Full Code Here


            Thread.sleep(10);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        YWorkItem child = _workItem.createChild(null, _childIdentifier);
        YIdentifier id = _childIdentifier.createChild(null);
        assertEquals(child.getParent(), _workItem);
        assertNull(child.createChild(null, id));
        assertNull(_workItem.createChild(null, new YIdentifier()));
        assertNull(child.getChildren());
        assertNull(_workItem.getParent());
        assertEquals(_workItem.getChildren().iterator().next(), child);
        assertTrue(child.getStatus().equals("Fired"));
        assertNotNull(child.getEnablementTime());
View Full Code Here

    public static void clear(YEngine engine) throws YPersistenceException {
        while (engine.getSpecIDs().iterator().hasNext()) {
            String specID = (String) engine.getSpecIDs().iterator().next();
            Set caseIDs = engine.getCasesForSpecification(specID);
            for (Iterator iterator2 = caseIDs.iterator(); iterator2.hasNext();) {
                YIdentifier identifier = (YIdentifier) iterator2.next();
                engine.cancelCase(identifier);
            }
            try {
                engine.unloadSpecification(specID);
            } catch (YStateException e) {
View Full Code Here

    public void testExpectedNormalOperation() throws YDataStateException, YStateException, YQueryException, YSchemaBuildingException, YPersistenceException {
        synchronized (this) {
            EngineClearer.clear(_engine);
            _engine.loadSpecification(_specification);
            YIdentifier id = _engine.startCase(null, null, _specification.getID(), null, null);
            _netRunner = (YNetRunner) _engine._caseIDToNetRunnerMap.get(id);
            {
                //execute task "decideName"
                Set availableItems = _engine.getAvailableWorkItems();
                assertTrue(availableItems.size() == 1);
View Full Code Here

        }
    }


    public void testFireAtomicTask() throws YStateException, YDataStateException, YQueryException, YSchemaBuildingException, YPersistenceException {
        _c1.add(null, new YIdentifier());
        List l = null;
        l = _atomicTask1.t_fire(null);

        Iterator i = l.iterator();
        while(i.hasNext() && _atomicTask1.t_isBusy()){
            YIdentifier id = (YIdentifier) i.next();
            _atomicTask1.t_start(null, id);
            Document d = new Document(new Element("data"));
            _atomicTask1.t_complete(null, id, d);
        }
        assertFalse(_atomicTask1.t_isBusy());
View Full Code Here

      e.removeFromCancelledBySet(this);
    }
   
  }
    public synchronized List t_fire(YPersistenceManager pmgr) throws YStateException, YDataStateException, YQueryException, YPersistenceException {
        YIdentifier id = getI();
        if (!t_enabled(id)) {
            throw new YStateException(
                    this + " cannot fire due to not being enabled");
        }
        _i = id;
        _i.addLocation(pmgr, this);
        List conditions = new Vector(getPresetElements());
        Iterator conditionsIt = getPresetElements().iterator();
        long numToSpawn = determineHowManyInstancesToCreate();
        List childIdentifiers = new Vector();
        for (int i = 0; i < numToSpawn; i++) {
            YIdentifier childID = createFiredIdentifier(pmgr);
            try {
                prepareDataForInstanceStarting(childID);
            } catch (YAWLException e) {

                //if there was a problem firing the task then roll back the case.
View Full Code Here

        }
        if (t_addEnabled(siblingWithPermission)) {
            List newData = new Vector();
            newData.add(newInstanceData);
            _multiInstanceSpecificParamsIterator = newData.iterator();
            YIdentifier newInstance = createFiredIdentifier(pmgr);
            prepareDataForInstanceStarting(newInstance);
            return newInstance;
        }
        return null;
    }
View Full Code Here

    private synchronized void t_exit(YPersistenceManager pmgr) throws YDataStateException, YStateException, YQueryException, YSchemaBuildingException, YPersistenceException {
        if (!t_isExitEnabled()) {
            throw new RuntimeException(this + "_exit() is not enabled.");
        }
        performDataAssignmentsAccordingToOutputExpressions(pmgr);
        YIdentifier i = _i;
        if (this instanceof YCompositeTask) {
            cancel(pmgr);
        }
        //remove tokens from cancellation set
        for (Iterator removeIter = _removeSet.iterator(); removeIter.hasNext();) {
            YExternalNetElement netElement = (YExternalNetElement) removeIter.next();
            if (netElement instanceof YTask) {
                ((YTask) netElement).cancel(pmgr);
            } else if (netElement instanceof YCondition) {
                ((YCondition) netElement).removeAll(pmgr);
            }
        }
        _mi_active.removeAll(pmgr);
        _mi_complete.removeAll(pmgr);
        _mi_entered.removeAll(pmgr);
        _mi_executing.removeAll(pmgr);
        synchronized (_random) {
            switch (_splitType) {
                case YTask._AND:
                    doAndSplit(pmgr, i);
                    break;
                case YTask._OR:
                    doOrSplit(pmgr, i);
                    break;
                case YTask._XOR:
                    doXORSplit(pmgr, i);
                    break;
            }
        }
        i.removeLocation(pmgr, this);
        logger.info("YTask::" + getID() + ".exit() caseID(" + _i + ") " +
                "_parentDecomposition.getInternalDataDocument() = "
                + new XMLOutputter(Format.getPrettyFormat()).outputString(_net.getInternalDataDocument()).trim());
        _i = null;
    }
View Full Code Here

    protected abstract void startOne(YPersistenceManager pmgr, YIdentifier id) throws YDataStateException, YSchemaBuildingException, YPersistenceException;


    protected YIdentifier createFiredIdentifier(YPersistenceManager pmgr) throws YPersistenceException {
        YIdentifier childCaseID = _i.createChild(pmgr);
        _mi_active.add(pmgr, childCaseID);
        _mi_entered.add(pmgr, childCaseID);
        return childCaseID;
    }
View Full Code Here

        File yawlXMLFile = new File(fileURL.getFile());
        YSpecification specification = null;
        specification = (YSpecification) YMarshal.
                        unmarshalSpecifications(yawlXMLFile.getAbsolutePath()).get(0);
        _loopedNet = specification.getRootNet();
        _id1 = new YIdentifier();

        _id1.addLocation(null, (YCondition) _loopedNet.getNetElement("c{d_f}"));
        _id1.addLocation(null, (YCondition) _loopedNet.getNetElement("c{d_f}"));
        _id1.addLocation(null, (YCondition) _loopedNet.getNetElement("cC"));
        _id2 = new YIdentifier();
        _id2.addLocation(null, (YCondition) _loopedNet.getNetElement("c{d_f}"));
        _id2.addLocation(null, (YCondition) _loopedNet.getNetElement("cA"));
        _id3 = new YIdentifier();
        _id3.addLocation(null, (YCondition) _loopedNet.getNetElement("cC"));
        _id4 = new YIdentifier();
        _id4.addLocation(null, (YCondition) _loopedNet.getNetElement("i-top"));
        _id4.addLocation(null, (YCondition) _loopedNet.getNetElement("c{d_f}"));
        _id5 = new YIdentifier();
        _id5.addLocation(null, (YCondition) _loopedNet.getNetElement("c{d_f}"));
        _id5.addLocation(null, (YCondition) _loopedNet.getNetElement("c{b_w}"));
        _id6 = new YIdentifier();
        _id6.addLocation(null, (YTask) _loopedNet.getNetElement("d"));
        _id6.addLocation(null, (YCondition) _loopedNet.getNetElement("c{d_f}"));
        _id7 = new YIdentifier();
        _id7.addLocation(null, (YCondition) _loopedNet.getNetElement("cA"));
        _id7.addLocation(null, (YCondition) _loopedNet.getNetElement("cB"));
        _id7.addLocation(null, (YCondition) _loopedNet.getNetElement("c{q_f}"));
        _id8 = new YIdentifier();
        _id8.addLocation(null, (YCondition) _loopedNet.getNetElement("cA"));
        _id8.addLocation(null, (YCondition) _loopedNet.getNetElement("cB"));
        _id8.addLocation(null, (YCondition) _loopedNet.getNetElement("cC"));
        _id8.addLocation(null, (YCondition) _loopedNet.getNetElement("c{q_f}"));
//        _id8.addLocation((YCondition)_loopedNet.getNetElement("c{YAtomicTask:a, YAtomicTask:d}"));
View Full Code Here

TOP

Related Classes of au.edu.qut.yawl.elements.state.YIdentifier

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.