Package org.apache.ode.bpel.dao

Examples of org.apache.ode.bpel.dao.ProcessInstanceDAO


            if(suspend){
                _step.remove(evt.getProcessInstanceId());
                try {
                    ProcessDAO process = _db.getProcessDAO();
                    ProcessInstanceDAO instance = process.getInstance(evt.getProcessInstanceId());
                    if(ProcessState.canExecute(instance.getState())){
                        // send event
                        ProcessInstanceStateChangeEvent changeEvent = new ProcessInstanceStateChangeEvent();
                        changeEvent.setOldState(instance.getState());
                        instance.setState(ProcessState.STATE_SUSPENDED);
                        changeEvent.setNewState(ProcessState.STATE_SUSPENDED);
                        changeEvent.setProcessInstanceId(instance.getInstanceId());

                        changeEvent.setProcessName(process.getType());
                        changeEvent.setProcessId(_db.getProcessId());

                        _process.saveEvent(changeEvent, instance);
View Full Code Here


        BpelProcess process = null;
        try {
            if (we.getProcessId() != null) {
                process = _activeProcesses.get(we.getProcessId());
            } else {
                ProcessInstanceDAO instance;
                if (we.getInMem()) instance = _contexts.inMemDao.getConnection().getInstance(we.getInstanceId());
                else instance = _contexts.dao.getConnection().getInstance(we.getInstanceId());

                if (instance == null) {
                    __log.debug(__msgs.msgScheduledJobReferencesUnknownInstance(we.getInstanceId()));
                    // nothing we can do, this instance is not in the database, it will always fail, not
                    // exactly an error since can occur in normal course of events.
                    return;
                }
                ProcessDAO processDao = instance.getProcess();
                process = _activeProcesses.get(processDao.getProcessId());
            }

            if (process == null) {
                // The process is not active, there's nothing we can do with this job
View Full Code Here

        Collection<ProcessInstanceDAO> list = new ArrayList<ProcessInstanceDAO>();
        int num = 0;
        for (Iterator iterator = ql.iterator(); iterator.hasNext();) {
            if(num++ > criteria.getLimit()) break;
            ProcessInstanceDAO processInstanceDAO = (ProcessInstanceDAO) iterator.next();
            list.add(processInstanceDAO);
        }

        return list;
    }
View Full Code Here

    void createStuff(BPELDAOConnectionFactoryImpl factory) throws Exception {
        BpelDAOConnection conn = factory.getConnection();

        CorrelatorDAO corr = createProcess(conn,"testPID1","testType");
        ProcessInstanceDAO pi1 = createProcessInstance(_process, corr);
    }
View Full Code Here

        _process.addCorrelator(CORRELATOR_ID2);
        return corr;
    }

    private ProcessInstanceDAO createProcessInstance(ProcessDAO process, CorrelatorDAO corr) throws SAXException, IOException {
        ProcessInstanceDAO pi = null;
        String[] actions = { "action1","action2" };
        String[] correlationKeys = { "key1", "key2" };
        CorrelationKey key1 = new CorrelationKey("key1",correlationKeys);
        CorrelationKey key2 = new CorrelationKey("key2",correlationKeys);
        CorrelationKey[] corrkeys = {key1,key2};
        QName[] names = { new QName(TEST_NS,"name1"), new QName(TEST_NS,"name2") };

        pi = process.createInstance(corr);

        pi.setExecutionState(new String("test execution state").getBytes());
        pi.setFault(new QName(TEST_NS,"testFault"), "testExplanation", 1, 1, DOMUtils.stringToDOM("<testFaultMessage>testMessage</testFaultMessage>"));
        pi.setLastActiveTime(cal.getTime());
        pi.setState((short) 1);

        pi.createActivityRecovery("testChannel1", 3, "testReason1", cal.getTime(), DOMUtils.stringToDOM("<testData>testData1</testData>"), actions, 2);
        pi.createActivityRecovery("testChannel2", 4, "testReason2", cal.getTime(), DOMUtils.stringToDOM("<testData>testData2</testData>"), actions, 2);

        ScopeDAO root = pi.createScope(null, "Root", 1);
        root.setState(ScopeStateEnum.ACTIVE);
        ScopeDAO child1 = pi.createScope(root, "Child1", 2);
        child1.setState(ScopeStateEnum.ACTIVE);
        XmlDataDAO var1 = child1.getVariable("var1");
        var1.set(DOMUtils.stringToDOM("<testData>testData</testData>"));
        var1.setProperty("key1", "prop1");
        var1.setProperty("key2", "prop2");
View Full Code Here

        // Assert the ProcessInstanceDAO
        for ( ProcessInstanceDAO inst : insts ) {
            Long id = inst.getInstanceId();
            assertNotNull( id );

            ProcessInstanceDAO inst2 = conn.getInstance(id);
            assertSame(inst2,inst);

            ProcessInstanceDAO inst3 = p.getInstance(id);
            assertSame( inst3 , inst );

            Long mon = inst.genMonotonic();
            assertEquals(inst.getActivityFailureCount() , 2);
            assertNotNull(inst.getActivityFailureDateTime() );
View Full Code Here

        return QName.valueOf(_process.getProcessId());
    }

    public ProcessInstanceDAO getInstance(Long iid) {
        entering("ProcessDaoImpl.getInstance");
        ProcessInstanceDAO instance = BpelDAOConnectionImpl._getInstance(_sm, getSession(), iid);
        if (instance == null || !instance.getProcess().getProcessId().equals(getProcessId()))
            return null;
        return instance;
    }
View Full Code Here

        return process;
    }

    public ProcessInstanceDAO getInstance(Long iid) {
        for (ProcessDaoImpl proc : _store.values()) {
            ProcessInstanceDAO instance = proc._instances.get(iid);
            if (instance != null)
                return instance;
        }
        return null;
    }
View Full Code Here

                __log.debug("Not creating a new instance for mex " + mex + "; interceptor prevented!");
            }
            throw new InvalidProcessException("Cannot instantiate process '" + _process.getPID() + "' any more.", InvalidProcessException.TOO_MANY_INSTANCES_CAUSE_CODE);
        }

        ProcessInstanceDAO newInstance = processDAO.createInstance(routing.correlator);

        BpelRuntimeContextImpl instance = _process
                .createRuntimeContext(newInstance, new PROCESS(_process.getOProcess()), mex);

        // send process instance event
        NewProcessInstanceEvent evt = new NewProcessInstanceEvent(new QName(_process.getOProcess().targetNamespace,
                _process.getOProcess().getName()), _process.getProcessDAO().getProcessId(), newInstance.getInstanceId());
        evt.setPortType(mex.getPortType().getQName());
        evt.setOperation(operation.getName());
        evt.setMexId(mex.getMessageExchangeId());
        _process._debugger.onEvent(evt);
        _process.saveEvent(evt, newInstance);
        mex.setCorrelationStatus(MyRoleMessageExchange.CorrelationStatus.CREATE_INSTANCE);
        mex.getDAO().setInstance(newInstance);
        if (mex.getDAO().getCreateTime() == null)
            mex.getDAO().setCreateTime(instance.getCurrentEventDateTime());

        _process._engine.acquireInstanceLock(newInstance.getInstanceId());
        instance.execute();
    }
View Full Code Here

        if (__log.isDebugEnabled()) {
            __log.debug("INPUTMSG: " + routing.correlator.getCorrelatorId() + ": ROUTING to existing instance "
                    + routing.messageRoute.getTargetInstance().getInstanceId());
        }

        ProcessInstanceDAO instanceDao = routing.messageRoute.getTargetInstance();
        BpelProcess process2 = _process._engine._activeProcesses.get(instanceDao.getProcess().getProcessId());

        // Reload process instance for DAO.
        BpelRuntimeContextImpl instance = process2.createRuntimeContext(instanceDao, null, null);
        instance.inputMsgMatch(routing.messageRoute.getGroupId(), routing.messageRoute.getIndex(), mex);

        // Kill the route so some new message does not get routed to
        // same process instance.
        routing.correlator.removeRoutes(routing.messageRoute.getGroupId(), instanceDao);

        // send process instance event
        CorrelationMatchEvent evt = new CorrelationMatchEvent(new QName(process2.getOProcess().targetNamespace,
                process2.getOProcess().getName()), process2.getProcessDAO().getProcessId(),
                instanceDao.getInstanceId(), routing.matchedKeySet);
        evt.setPortType(mex.getPortType().getQName());
        evt.setOperation(operation.getName());
        evt.setMexId(mex.getMessageExchangeId());

        process2._debugger.onEvent(evt);
View Full Code Here

TOP

Related Classes of org.apache.ode.bpel.dao.ProcessInstanceDAO

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.