Package org.gpel.model

Examples of org.gpel.model.GpelActivity


      return;
    }
   
    gpelProcess.xml().setAttributeValue(NAME,
        StringUtil.convertToJavaIdentifier(workflowName));
    GpelActivity activity = gpelProcess.getActivity();
   
    addImports(gpelProcess, workflowWSDL, wsdls);

    if (activity instanceof GpelSequence) {
     
      LinkedList<GpelAssign> result = new LinkedList<GpelAssign>();
     
     
      formatXpathFromValueCopy(((GpelSequence) activity).activities().iterator());
      evaluateFlowAndSequenceForAddingInits(wsdls, workflowWSDL, ((GpelSequence) activity).activities().iterator(), result);
      addVariableManipulationBeforeInvoke(((GpelSequence) activity).activities().iterator());
      findReplaceAssign(((GpelSequence) activity).activities().iterator());
      Iterator<GpelActivity> iterator = ((GpelSequence) activity).activities().iterator();
      while (iterator.hasNext()) {
        GpelActivity next = iterator.next();
        if (next instanceof GpelReceive) {
          ((GpelReceive) next).xml().setAttributeValue(
              CREATE_INSTANCE_STR, YES_STR);
          break;
        }
View Full Code Here


 
  /**
   * @param invokeList
   */
  private void findInvokes(Iterator<GpelActivity> iterator, LinkedList<GpelInvoke> invokeList) {
    GpelActivity last = null;
    while(iterator.hasNext()){
      GpelActivity next = iterator.next();
      if(isSequence(next) || isFlow(next) || isIf(next) ){
        findInvokes(next, invokeList);
      }else if(isInvoke(next)){
        invokeList.add((GpelInvoke)next);
      }
View Full Code Here

      findReplaceAssign(iterator);
    }
  }

  private void findReplaceAssign(Iterator<GpelActivity> iterator){
    GpelActivity last = null;
    while(iterator.hasNext()){
      GpelActivity next = iterator.next();
      if(isSequence(next) || isFlow(next)){
        findReplaceAssign(next);
      }else if(isAssign(next)){
        GpelAssign assign = (GpelAssign)next;
        Iterator<GpelAssignCopy> itr = assign.copyOperations().iterator();
View Full Code Here

      formatXpathFromValueCopy(iterator);
    }
  }

  private void formatXpathFromValueCopy(Iterator<GpelActivity> iterator){
    GpelActivity last = null;
    while(iterator.hasNext()){
      GpelActivity next = iterator.next();
      if(isSequence(next) || isFlow(next)){
        formatXpathFromValueCopy(next);
      }else if(isAssign(next)){
        GpelAssign assign = (GpelAssign)next;
        Iterator<GpelAssignCopy> itr = assign.copyOperations().iterator();
View Full Code Here

      evaluateFlowAndSequenceForAddingInits(wsdls, workflowWSDL, iterator, list);
    }
  }

  private void evaluateFlowAndSequenceForAddingInits(Map<String, WsdlDefinitions> wsdls, WsdlDefinitions workflowWSDL, Iterator<GpelActivity> iterator, LinkedList<GpelAssign> list){
    GpelActivity last = null;
    while(iterator.hasNext()){
      GpelActivity next = iterator.next();
      if(isSequence(next) || isFlow(next)){
        evaluateFlowAndSequenceForAddingInits(wsdls, workflowWSDL, next, list);
      }else if(isInvoke(next|| isReply(next)){
        if(last == null || !isAssign(last)){
          throw new XBayaRuntimeException("Assign activity not found for the Invoke "+next.xmlStringPretty());
        }
       
        GpelAssign assign = (GpelAssign)last;
        XmlNamespace ns = assign.xml().getNamespace();
       
        XmlElement container = XmlConstants.BUILDER.parseFragmentFromString("<dummyelement></dummyelement>");
       
       
        String portTypeattr = next.xml().attributeValue(PORT_TYPE_STR);
        String operation = next.xml().attributeValue(OPERATION_STR);
        if(null == portTypeattr || "".equals(portTypeattr)){
          throw new XBayaRuntimeException("No Porttype found for Invoke:"+next);
        }
        String portTypeName = portTypeattr.substring(portTypeattr.indexOf(':')+1);
        String messagePartName = null;
        if(isInvoke(next)){
          Iterator<String> keys = wsdls.keySet().iterator();
         
          while(keys.hasNext()){
            String key = keys.next();
            WsdlDefinitions wsdl = wsdls.get(key);
            WsdlPortType portType = wsdl.getPortType(portTypeName);
            if( null != portType){
              WsdlPortTypeOperation wsdlOperation = portType.getOperation(operation);
              WsdlMessagePart part  = wsdl.getMessage(wsdlOperation.getInput().getMessage().getLocalPart()).parts().iterator().next();
              XmlElement childElement = container.addElement(part.getElement().getLocalPart());
              Iterator<GpelAssignCopy> copyItr = assign.copyOperations().iterator();
              while(copyItr.hasNext()){
                GpelAssignCopy copyItm = copyItr.next();
                childElement.addElement(getElementName(copyItm.getTo().getQuery()));
                if(messagePartName == null){
                  messagePartName = copyItm.getTo().xml().attributeValue(PART_STR);
                }
              }
              break;
            }
          }
        }else {
          //reply
         
         
            WsdlPortType portType = workflowWSDL.getPortType(portTypeName);
            if( null != portType){
              WsdlPortTypeOperation wsdlOperation = portType.getOperation(operation);
              WsdlMessagePart part  = workflowWSDL.getMessage(wsdlOperation.getOutput().getMessage().getLocalPart()).parts().iterator().next();
              XmlElement childElement = container.addElement(part.getElement().getLocalPart());
              Iterator<GpelAssignCopy> copyItr = assign.copyOperations().iterator();
              while(copyItr.hasNext()){
                GpelAssignCopy copyItm = copyItr.next();
                childElement.addElement(getElementName(copyItm.getTo().getQuery()));
                if(messagePartName == null){
                  messagePartName = copyItm.getTo().xml().attributeValue(PART_STR);
                }
              }
          }
        }
       

        GpelAssignCopyFrom from = new GpelAssignCopyFrom(ns);
        from.setLiteral(container);
       
        GpelAssignCopyTo to = new GpelAssignCopyTo(ns);
        to.xml().setAttributeValue(PART_STR, messagePartName);
        if(isInvoke(next)){
          to.xml().setAttributeValue(VARIABLE_STR, next.xml().attributeValue(INPUT_VARIABLE_STR));
        }else{
          to.xml().setAttributeValue(VARIABLE_STR, next.xml().attributeValue(VARIABLE_STR));
        }
        GpelAssignCopy newAssign = new GpelAssignCopy(ns, from, to);
        newAssign.xml().setAttributeValue(VALIDATE_STR, NO_STR);
        GpelAssign gpelAssign = new GpelAssign(ns, newAssign);
        list.add(gpelAssign);
View Full Code Here

  }

  private void addVariableManipulationBeforeInvoke(
      Iterator<GpelActivity> iterator) {
    GpelActivity last = null;
    while (iterator.hasNext()) {
      GpelActivity next = iterator.next();
      if (isSequence(next) || isFlow(next)) {
        addVariableManipulationBeforeInvoke(next);
      } else if (isInvoke(next)) {
        if (last == null || !isAssign(last)) {
          throw new XBayaRuntimeException(
              "Assign activity not found for the Invoke"
                  + next.xmlStringPretty());
        }

        // we are good and should add the header copy.
        XmlNamespace ns = last.xml().getNamespace();
        GpelAssignCopyFrom headerFrom = new GpelAssignCopyFrom(ns);
        headerFrom.xml().setAttributeValue(PART_STR, LEAD_HEADER_STR);
        headerFrom.xml().setAttributeValue(VARIABLE_STR, WORKFLOW_INPUT_STR);

        GpelAssignCopyTo headerTo = new GpelAssignCopyTo(ns);
        headerTo.xml().setAttributeValue(PART_STR, LEAD_HEADER_STR);
        headerTo.xml().setAttributeValue(VARIABLE_STR,
            next.xml().attributeValue(INPUT_VARIABLE_STR));
        GpelAssignCopy headerCopy = new GpelAssignCopy(ns, headerFrom,
            headerTo);
        GpelAssign assign = (GpelAssign) last;
        assign.addCopy(headerCopy);

        GpelAssignCopyFrom nodeIDFrom = new GpelAssignCopyFrom(ns);
        nodeIDFrom.setLiteral(XmlConstants.BUILDER
            .parseFragmentFromString("<dummyelement>"
                + next.xml().attributeValue(NAME)
                + "</dummyelement>"));
        GpelAssignCopyTo nodeIDTo = new GpelAssignCopyTo(ns);

        nodeIDTo.xml().setAttributeValue(PART_STR, LEAD_HEADER_STR);
        nodeIDTo.xml().setAttributeValue(VARIABLE_STR,
            next.xml().attributeValue(INPUT_VARIABLE_STR));
        // TODO is this ok?? what of the query language
        nodeIDTo.setQuery("/leadcntx:workflow-node-id");

        GpelAssignCopy nodeIDCopy = new GpelAssignCopy(ns, nodeIDFrom,
            nodeIDTo);
        nodeIDCopy.xml().setAttributeValue(KEEP_SRC_ELEMENT_NAME_STR, NO_STR);
        assign.addCopy(nodeIDCopy);

        GpelAssignCopyFrom timeStepFrom = new GpelAssignCopyFrom(ns);
        timeStepFrom.setLiteral(XmlConstants.BUILDER
            .parseFragmentFromString("<dummyelement>"
                + "5"
                + "</dummyelement>"));
        GpelAssignCopyTo timeStepTo = new GpelAssignCopyTo(ns);
        timeStepTo.xml().setAttributeValue(PART_STR, LEAD_HEADER_STR);
        timeStepTo.xml().setAttributeValue(VARIABLE_STR,
            next.xml().attributeValue(INPUT_VARIABLE_STR));
        // TODO is this ok?? what of the query language
        timeStepTo.setQuery("/leadcntx:workflow-time-step");

        GpelAssignCopy timeStepCopy = new GpelAssignCopy(ns,
            timeStepFrom, timeStepTo);
View Full Code Here

            // already done
            return;
        }

        gpelProcess.xml().setAttributeValue(NAME, StringUtil.convertToJavaIdentifier(workflowName));
        GpelActivity activity = gpelProcess.getActivity();

        addImports(gpelProcess, workflowWSDL, wsdls);

        if (activity instanceof GpelSequence) {

            LinkedList<GpelAssign> result = new LinkedList<GpelAssign>();

            formatXpathFromValueCopy(((GpelSequence) activity).activities().iterator());
            evaluateFlowAndSequenceForAddingInits(wsdls, workflowWSDL, ((GpelSequence) activity).activities()
                    .iterator(), result);
            addVariableManipulationBeforeInvoke(((GpelSequence) activity).activities().iterator());
            findReplaceAssign(((GpelSequence) activity).activities().iterator());
            Iterator<GpelActivity> iterator = ((GpelSequence) activity).activities().iterator();
            while (iterator.hasNext()) {
                GpelActivity next = iterator.next();
                if (next instanceof GpelReceive) {
                    ((GpelReceive) next).xml().setAttributeValue(CREATE_INSTANCE_STR, YES_STR);
                    break;
                }
            }
View Full Code Here

    /**
     * @param invokeList
     */
    private void findInvokes(Iterator<GpelActivity> iterator, LinkedList<GpelInvoke> invokeList) {
        while (iterator.hasNext()) {
            GpelActivity next = iterator.next();
            if (isSequence(next) || isFlow(next) || isIf(next)) {
                findInvokes(next, invokeList);
            } else if (isInvoke(next)) {
                invokeList.add((GpelInvoke) next);
            }
View Full Code Here

        }
    }

    private void findReplaceAssign(Iterator<GpelActivity> iterator) {
        while (iterator.hasNext()) {
            GpelActivity next = iterator.next();
            if (isSequence(next) || isFlow(next)) {
                findReplaceAssign(next);
            } else if (isAssign(next)) {
                GpelAssign assign = (GpelAssign) next;
                Iterator<GpelAssignCopy> itr = assign.copyOperations().iterator();
View Full Code Here

        }
    }

    private void formatXpathFromValueCopy(Iterator<GpelActivity> iterator) {
        while (iterator.hasNext()) {
            GpelActivity next = iterator.next();
            if (isSequence(next) || isFlow(next)) {
                formatXpathFromValueCopy(next);
            } else if (isAssign(next)) {
                GpelAssign assign = (GpelAssign) next;
                Iterator<GpelAssignCopy> itr = assign.copyOperations().iterator();
View Full Code Here

TOP

Related Classes of org.gpel.model.GpelActivity

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.