Package org.apache.ode.bpel.dao

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


    /**
     * @see BpelRuntimeContext#readCorrelation(org.apache.ode.bpel.runtime.CorrelationSetInstance)
     */
    public CorrelationKey readCorrelation(CorrelationSetInstance cset) {
        ScopeDAO scopeDAO = _dao.getScope(cset.scopeInstance);
        CorrelationSetDAO cs = scopeDAO.getCorrelationSet(cset.declaration.name);
        return cs.getValue();
    }
View Full Code Here


    public Element fetchMyRoleEndpointReferenceData(PartnerLinkInstance pLink) {
        return _bpelProcess.getInitialMyRoleEPR(pLink.partnerLink).toXML().getDocumentElement();
    }

    private PartnerLinkDAO fetchPartnerLinkDAO(PartnerLinkInstance pLink) {
        ScopeDAO scopeDAO = _dao.getScope(pLink.scopeInstanceId);
        return scopeDAO.getPartnerLink(pLink.partnerLink.getId());
    }
View Full Code Here

        return _bpelProcess._engine._contexts.eprContext.convertEndpoint(nodeQName, sourceNode).toXML();
    }


  public Node readVariable(Long scopeInstanceId, String varname, boolean forWriting) throws FaultException {
    ScopeDAO scopedao = _dao.getScope(scopeInstanceId);
    XmlDataDAO var = scopedao.getVariable(varname);
    return var.isNull() ? null : var.get();
  }
View Full Code Here

    XmlDataDAO var = scopedao.getVariable(varname);
    return var.isNull() ? null : var.get();
  }
 
    public Node writeVariable(VariableInstance variable, Node changes) {
        ScopeDAO scopeDAO = _dao.getScope(variable.scopeInstance);
        XmlDataDAO dataDAO = scopeDAO.getVariable(variable.declaration.name);
        dataDAO.set(changes);

        writeProperties(variable, changes, dataDAO);
        return dataDAO.get();
    }
View Full Code Here

    /**
     * @see BpelRuntimeContext#writeCorrelation(org.apache.ode.bpel.runtime.CorrelationSetInstance,
     *      org.apache.ode.bpel.common.CorrelationKey)
     */
    public void writeCorrelation(CorrelationSetInstance cset, CorrelationKey correlation) {
        ScopeDAO scopeDAO = _dao.getScope(cset.scopeInstance);
        CorrelationSetDAO cs = scopeDAO.getCorrelationSet(cset.declaration.name);
        OScope.CorrelationSet csetdef = (OScope.CorrelationSet) _bpelProcess.getOProcess()
                .getChild(correlation.getCSetId());
        QName[] propNames = new QName[csetdef.properties.size()];
        for (int m = 0; m < csetdef.properties.size(); m++) {
            OProcess.OProperty oProperty = csetdef.properties.get(m);
View Full Code Here

      assertSame(inst.getProcess() , p );
      assertEquals(inst.getPreviousState() , 0);
      assertEquals(inst.getState() , 1);
     
      // Assert the Root ScopeDAO
      ScopeDAO rs = inst.getRootScope();
      assertNotNull( rs );
      assertNotNull(rs.getChildScopes());
      ScopeDAO child1 = null;
      for ( ScopeDAO childItr : rs.getChildScopes()){
        child1 = childItr;
        break;
      }
      assertNotNull(child1);
      assertNotNull(rs.getCorrelationSets());
      assertEquals(rs.getCorrelationSets().size() , 0 );
      assertEquals(rs.getModelId(),1);
      assertEquals(rs.getName(),"Root");
      assertTrue(rs.getParentScope() == null);
      assertNotNull(rs.getPartnerLinks());
      assertEquals(rs.getPartnerLinks().size() ,0);
      assertSame(rs.getProcessInstance(),inst);
      assertNotNull(rs.getScopeInstanceId());
      assertEquals(rs.getState(),ScopeStateEnum.ACTIVE);
      assertNotNull(rs.getVariables());
      assertEquals(rs.getVariables().size(),0);
     
   
      // Assert the ActivityRecoveryDAO
      assertNotNull(inst.getActivityRecoveries());
      ActivityRecoveryDAO rec1 = null;
      for (ActivityRecoveryDAO recItr : inst.getActivityRecoveries()) {
       if (recItr.getActivityId() == 3) {
         rec1 = recItr;break;
       }
      }
      assertNotNull(rec1);
      String tmpAct = rec1.getActions();
//      assertEquals(rec1.getActionsList(),actions);
      assertEquals(rec1.getActivityId(),3);
      assertEquals(rec1.getChannel(),"testChannel1");
      assertNotNull(rec1.getDateTime());
//      assertNotNull(rec1.getDetails());
      assertEquals(rec1.getReason(),"testReason1");
      assertEquals(rec1.getRetries(),2);
     
      // Assert the CorrelationSetDAO
      //assertNotNull(inst.getCorrelationSets());
      //CorrelationSetDAO cs1 = null;
      //for ( CorrelationSetDAO csItr : inst.getCorrelationSets() ) {
      //  cs1 = csItr;
      //  break;
      //}
      //assertNotNull(cs1);
     
      // Assert the FaultDAO
      FaultDAO fault = inst.getFault();
      assertNotNull(fault);
      assertEquals(fault.getActivityId(),1);
      assertNotNull(fault.getData());
      assertEquals(fault.getExplanation(),"testExplanation");
      assertEquals(fault.getLineNo(),1);
      assertEquals(fault.getName(),new QName(TEST_NS,"testFault"));
     
      // Assert MessageExchangeDAO
      CorrelatorDAO ic = inst.getInstantiatingCorrelator();
      assertNotNull(ic);
      assertEquals(ic.getCorrelatorId(),CORRELATOR_ID1);
      // The message is dequeued but not persisted
      MessageExchangeDAO me = ic.dequeueMessage(key1);
      assertNotNull(me);
      assertEquals(me.getCallee(),new QName(TEST_NS,"testCallee"));
      assertEquals(me.getPropagateTransactionFlag(),false);
      assertEquals(me.getChannel(),"testChannel");
      assertEquals(me.getCorrelationId(),"testCorrelationId");
      //assertNotNull(me.getCreateTime());
      assertEquals(me.getDirection(),'0');
      assertNotNull(me.getEPR());
      assertEquals(me.getFault().toString(),"testFault");
      assertEquals(me.getFaultExplanation(),"testFaultExplanation");
      assertSame(me.getInstance(),inst);
      assertEquals(me.getOperation(),"testOperation");
      assertNotNull(me.getPartnerLink());
      assertEquals(me.getPartnerLinkModelId(),1);
      assertEquals(me.getPattern(),"testPattern");
      assertEquals(me.getPortType(),new QName(TEST_NS,"testPortType"));
      assertSame(me.getProcess(),p);
      assertEquals(me.getProperty("testProp1Key"),"testProp1");
      assertNotNull(me.getRequest());
      assertNotNull(me.getResponse());
      assertEquals(me.getStatus(),"testStatus");
     
      // Assert MessageDAO
      MessageDAO m = me.getRequest();
      assertNotNull(m.getData());
      assertSame(m.getMessageExchange(),me);
      assertEquals(m.getType(),new QName(TEST_NS,"testRequest"));
     
     
      //Assert Child ScopeDAO
      assertNotNull(inst.getScopes());
      assertTrue(inst.getScopes().size() > 0);
      assertNotNull(inst.getScopes("Child1"));
      assertTrue(inst.getScopes("Child1").size() == 1);
      ScopeDAO childS = inst.getScopes("Child1").iterator().next();
      assertSame(childS,child1);
      assertSame(childS.getParentScope(),rs);
      assertNotNull(childS.getChildScopes());
      assertEquals(childS.getChildScopes().size(), 0);
      assertNotNull(childS.getVariables());
      assertTrue(childS.getVariables().size() > 0);
      assertNotNull(childS.getVariable("var1"));
      XmlDataDAO chsVar = childS.getVariable("var1");
      assertNotNull(childS.getPartnerLinks());
      assertTrue(childS.getPartnerLinks().size() > 0);
      PartnerLinkDAO spl = childS.getPartnerLinks().iterator().next();
      assertSame(spl,me.getPartnerLink());
      assertSame(spl,childS.getPartnerLink(spl.getPartnerLinkModelId()));
      assertNotNull(childS.getCorrelationSets());
      assertTrue(childS.getCorrelationSets().size() > 0);
      assertNotNull(childS.getCorrelationSet("TestCorrelationSet1"));
     
      // Assert CorrelationSetDAO
      CorrelationSetDAO cs = childS.getCorrelationSet("TestCorrelationSet1");
      assertEquals(cs.getName(),"TestCorrelationSet1");
      assertNotNull(cs.getProperties());
      assertTrue(cs.getProperties().size() > 0);
      assertSame(cs.getScope(),childS);
      assertNotNull(cs.getValue());
View Full Code Here

    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");
    XmlDataDAO var2 = child1.getVariable("var2");
    var2.set(DOMUtils.stringToDOM("<testData>testData</testData>"));
    var2.setProperty("key1", "prop1");
    var2.setProperty("key2", "prop2");
   
    CorrelationSetDAO cs1 = child1.getCorrelationSet("TestCorrelationSet1");
    cs1.setValue(names,key1);
   
    PartnerLinkDAO pl1 = child1.createPartnerLink(1, "Test PartnerLink1", "MyRole1", "PartnerRole1");
    pl1.setMyEPR(DOMUtils.stringToDOM("<testEPR>testMyEPR</testEPR>"));
    pl1.setMyRoleServiceName(new QName(TEST_NS,"testRoleService"));
    pl1.setMySessionId("TestMySessionID");
    pl1.setPartnerEPR(DOMUtils.stringToDOM("<testEPR>testPartnerEPR</testEPR>"));
    pl1.setPartnerSessionId("TestPartnerSessionID");
View Full Code Here

      assertSame(inst.getProcess() , p );
      assertEquals(inst.getPreviousState() , 0);
      assertEquals(inst.getState() , 1);
     
      // Assert the Root ScopeDAO
      ScopeDAO rs = inst.getRootScope();
      assertNotNull( rs );
      assertNotNull(rs.getChildScopes());
      ScopeDAO child1 = null;
      for ( ScopeDAO childItr : rs.getChildScopes()){
        child1 = childItr;
        break;
      }
      assertNotNull(child1);
      assertNotNull(rs.getCorrelationSets());
      assertEquals(rs.getCorrelationSets().size() , 0 );
      assertEquals(rs.getModelId(),1);
      assertEquals(rs.getName(),"Root");
      assertTrue(rs.getParentScope() == null);
      assertNotNull(rs.getPartnerLinks());
      assertEquals(rs.getPartnerLinks().size() ,0);
      assertSame(rs.getProcessInstance(),inst);
      assertNotNull(rs.getScopeInstanceId());
      assertEquals(rs.getState(),ScopeStateEnum.ACTIVE);
      assertNotNull(rs.getVariables());
      assertEquals(rs.getVariables().size(),0);
     
   
      // Assert the ActivityRecoveryDAO
      assertNotNull(inst.getActivityRecoveries());
      ActivityRecoveryDAO rec1 = null;
      for (ActivityRecoveryDAO recItr : inst.getActivityRecoveries()) {
        rec1 = recItr;
        break;
      }
      assertNotNull(rec1);
      String tmpAct = rec1.getActions();
//      assertEquals(rec1.getActionsList(),actions);
      assertEquals(rec1.getActivityId(),3);
      assertEquals(rec1.getChannel(),"testChannel1");
      assertNotNull(rec1.getDateTime());
//      assertNotNull(rec1.getDetails());
      assertEquals(rec1.getReason(),"testReason1");
      assertEquals(rec1.getRetries(),2);
     
      // Assert the CorrelationSetDAO
      //assertNotNull(inst.getCorrelationSets());
      //CorrelationSetDAO cs1 = null;
      //for ( CorrelationSetDAO csItr : inst.getCorrelationSets() ) {
      //  cs1 = csItr;
      //  break;
      //}
      //assertNotNull(cs1);
     
      // Assert the FaultDAO
      FaultDAO fault = inst.getFault();
      assertNotNull(fault);
      assertEquals(fault.getActivityId(),1);
      assertNotNull(fault.getData());
      assertEquals(fault.getExplanation(),"testExplanation");
      assertEquals(fault.getLineNo(),1);
      assertEquals(fault.getName(),new QName(TEST_NS,"testFault"));
     
      // Assert MessageExchangeDAO
      CorrelatorDAO ic = inst.getInstantiatingCorrelator();
      assertNotNull(ic);
      assertEquals(ic.getCorrelatorId(),CORRELATOR_ID1);
      // The message is dequeued but not persisted
      MessageExchangeDAO me = ic.dequeueMessage(key1);
      assertNotNull(me);
      assertEquals(me.getCallee(),new QName(TEST_NS,"testCallee"));
      assertEquals(me.getPropagateTransactionFlag(),false);
      assertEquals(me.getChannel(),"testChannel");
      assertEquals(me.getCorrelationId(),"testCorrelationId");
      //assertNotNull(me.getCreateTime());
      assertEquals(me.getDirection(),'0');
      assertNotNull(me.getEPR());
      assertEquals(me.getFault().toString(),"testFault");
      assertEquals(me.getFaultExplanation(),"testFaultExplanation");
      assertSame(me.getInstance(),inst);
      assertEquals(me.getOperation(),"testOperation");
      assertNotNull(me.getPartnerLink());
      assertEquals(me.getPartnerLinkModelId(),1);
      assertEquals(me.getPattern(),"testPattern");
      assertEquals(me.getPortType(),new QName(TEST_NS,"testPortType"));
      assertSame(me.getProcess(),p);
      assertEquals(me.getProperty("testProp1Key"),"testProp1");
      assertNotNull(me.getRequest());
      assertNotNull(me.getResponse());
      assertEquals(me.getStatus(),"testStatus");
     
      // Assert MessageDAO
      MessageDAO m = me.getRequest();
      assertNotNull(m.getData());
      assertSame(m.getMessageExchange(),me);
      assertEquals(m.getType(),new QName(TEST_NS,"testRequest"));
     
     
      //Assert Child ScopeDAO
      assertNotNull(inst.getScopes());
      assertTrue(inst.getScopes().size() > 0);
      assertNotNull(inst.getScopes("Child1"));
      assertTrue(inst.getScopes("Child1").size() == 1);
      ScopeDAO childS = inst.getScopes("Child1").iterator().next();
      assertSame(childS,child1);
      assertSame(childS.getParentScope(),rs);
      assertNotNull(childS.getChildScopes());
      assertEquals(childS.getChildScopes().size(), 0);
      assertNotNull(childS.getVariables());
      assertTrue(childS.getVariables().size() > 0);
      assertNotNull(childS.getVariable("var1"));
      XmlDataDAO chsVar = childS.getVariable("var1");
      assertNotNull(childS.getPartnerLinks());
      assertTrue(childS.getPartnerLinks().size() > 0);
      PartnerLinkDAO spl = childS.getPartnerLinks().iterator().next();
      assertSame(spl,me.getPartnerLink());
      assertSame(spl,childS.getPartnerLink(spl.getPartnerLinkModelId()));
      assertNotNull(childS.getCorrelationSets());
      assertTrue(childS.getCorrelationSets().size() > 0);
      assertNotNull(childS.getCorrelationSet("TestCorrelationSet1"));
     
      // Assert CorrelationSetDAO
      CorrelationSetDAO cs = childS.getCorrelationSet("TestCorrelationSet1");
      assertEquals(cs.getName(),"TestCorrelationSet1");
      assertNotNull(cs.getProperties());
      assertTrue(cs.getProperties().size() > 0);
      assertSame(cs.getScope(),childS);
      assertNotNull(cs.getValue());
View Full Code Here

        VariableInfoDocument ret = VariableInfoDocument.Factory.newInstance();
        final TVariableInfo vinf = ret.addNewVariableInfo();
        final TVariableRef sref = vinf.addNewSelf();
        dbexec(new BpelDatabase.Callable<Object>() {
            public Object run(BpelDAOConnection session) throws Exception {
                ScopeDAO scope = session.getScope(new Long(scopeId));
                if (scope == null) {
                    throw new InvalidRequestException("ScopeNotFound:" + scopeId);
                }

                sref.setSiid(scopeId);
                sref.setIid(scope.getProcessInstance().getInstanceId().toString());
                sref.setName(varName);

                XmlDataDAO var = scope.getVariable(varName);
                if (var == null) {
                    throw new InvalidRequestException("VarNotFound:" + varName);
                }

                Node nval = var.get();
View Full Code Here

        VariableInfoDocument ret = VariableInfoDocument.Factory.newInstance();
        final TVariableInfo vinf = ret.addNewVariableInfo();
        final TVariableRef sref = vinf.addNewSelf();
        dbexec(new BpelDatabase.Callable<Object>() {
            public Object run(BpelDAOConnection session) throws Exception {
                ScopeDAO scope = session.getScope(new Long(scopeId));
                if (scope == null) {
                    throw new InvalidRequestException("ScopeNotFound:" + scopeId);
                }

                sref.setSiid(scopeId);
                sref.setIid(scope.getProcessInstance().getInstanceId().toString());
                sref.setName(varName);

                XmlDataDAO var = scope.getVariable(varName);
                if (var == null) {
                    throw new InvalidRequestException("VarNotFound:" + varName);
                }
               
                {
View Full Code Here

TOP

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

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.