Package org.uengine.kernel

Examples of org.uengine.kernel.ReceiveActivity


public class ReceiveImplAdapter implements Adapter{

  public Object convert(Object src, java.util.Hashtable keyedContext) throws Exception{
    ReceiveImpl srcAct = (ReceiveImpl)src;
   
    ReceiveActivity destAct = new ReceiveActivity();
    destAct.setName(srcAct.getName());
   
    return destAct;
 
View Full Code Here


  }
 
  private static MessageDefinition getStarterMessage(ProcessDefinition proc){
    Activity act = (Activity)proc.getChildActivities().elementAt(0);
    if(act instanceof ReceiveActivity){
      ReceiveActivity rcvAct = (ReceiveActivity)act;
      return rcvAct.getMessageDefinition();
    }   
    return null;
  }
View Full Code Here

  public ReceiveAndReplyActivity(){
    super();
    setName("receive~reply");
    setChildActivities(new Activity[]{
      new ReceiveActivity(),
      new WebServiceActivity()
    });
  }
View Full Code Here

   
public class WebServiceActivityAdapter implements Adapter{

  public Object convert(Object src, java.util.Hashtable keyedContext) throws Exception{
    WebServiceActivity srcAct = (WebServiceActivity)src;
    ReceiveActivity destAct = new ReceiveActivity();
    Role role = (Role)keyedContext.get("role");   
    Role myRole = (Role)keyedContext.get(ProcessDefinitionAdapter.MY_ROLE);   
    if(!srcAct.getRole().equals(role)) return null;

    Vector messageDefinitions = (Vector)keyedContext.get(ProcessDefinitionAdapter.MSG_DEFS);
    MessageDefinition md = null;   
    try{     
      Object[] parameters = srcAct.getParameters();
      ParameterContext[] paramCtxs = new ParameterContext[parameters.length];
      System.arraycopy(parameters, 0, paramCtxs, 0, parameters.length);
      md = new MessageDefinition();
      String opName = srcAct.getOperationName();
      if(opName.startsWith("on")){
        opName = opName.substring(2);
      }
      md.setName(opName);
      md.setParameters(paramCtxs);
      messageDefinitions.add(md);

      Vector variableDefinitions = (Vector)keyedContext.get(ProcessDefinitionAdapter.VAR_DEFS);
      for(int i=0; i<paramCtxs.length; i++){
        variableDefinitions.add(paramCtxs[i].getVariable());
      }     
    }catch(Exception e){
    }

    destAct.setName("Rcv. from " + srcAct.getName());
    destAct.setFromRole(myRole);
    destAct.setMessageDefinition(md);
   
    return destAct;
  }
View Full Code Here

*/
   
public class ReceiveActivityAdapter implements Adapter{

  public Object convert(Object src, java.util.Hashtable keyedContext) throws Exception{
    ReceiveActivity srcAct = (ReceiveActivity)src;
    WebServiceActivity destAct = new WebServiceActivity();
    Role role = (Role)keyedContext.get("role");   
    Role myRole = (Role)keyedContext.get(ProcessDefinitionAdapter.MY_ROLE);   
    ServiceDefinition serviceDefinition = (ServiceDefinition)keyedContext.get(ProcessDefinitionAdapter.MY_SVC_DEF);   
    if(srcAct.getFromRole()==null || !srcAct.getFromRole().equals(role)) return null;

    try{
      String msgName = srcAct.getMessageDefinition().getName();
      destAct.setPortType(myRole.getName());
      destAct.setService(serviceDefinition);
      destAct.setOperationName(msgName);
      ParameterContext[] paramCtxs = srcAct.getParameters();     
      destAct.setParameters(paramCtxs);
     
      Vector variableDefinitions = (Vector)keyedContext.get(ProcessDefinitionAdapter.VAR_DEFS);
      for(int i=0; i<paramCtxs.length; i++){
        variableDefinitions.add(paramCtxs[i].getVariable());
      }
    }catch(Exception e){
    }   

    destAct.setName("invoke for " + srcAct.getName());
    destAct.setRole(myRole);
   
    return destAct;
  }
View Full Code Here

*/
            
public class ReceiveActivityAdapter implements Adapter{

  public Object convert(Object src, java.util.Hashtable keyedContext) throws Exception{
    ReceiveActivity srcAct = (ReceiveActivity)src;
   
    tSequence destSeqAct = new tSequence();
    destSeqAct.setname_Attribute(new XNCName(srcAct.getName().getText().replace(' ', '_').replace('?', '_') + "Sequence"));
   
    //---- build receive activity ----
    String message = "on"+srcAct.getMessage().replace(' ', '_');
    String variableName = message + "Request";{
      Vector addVariables = (Vector)keyedContext.get("addVariables");
      XQName xqName = new XQName("sdns", "", variableName);
      variableName = "var_" + variableName;
      addVariables.add(new Object[]{variableName, xqName});     
    }
   
    MessageDefinition md = srcAct.getMessageDefinition();
    tReceive destAct = new tReceive();{
      destAct.setname_Attribute(new XNCName(srcAct.getName().getText().replace(' ', '_').replace('?', '_')));
     
      String procName = srcAct.getProcessDefinition().getName().getText().replace(' ','_').replace('?', '_');
      destAct.setportType_Attribute(new XQName("sdns", "", procName));
      try{
        //destAct.setvariable_Attribute(new XNCName(srcAct.getOutput().getName()));
      }catch(Exception e){
        //invocation with null parameter
      }
     
      //review:
      destAct.setoperation_Attribute(new XNCName(message));
     
      String fromRole;
      if(srcAct.getFromRole()!=null){
        fromRole = srcAct.getFromRole().getName().replace(' ', '_');
       
        //correlation setting
        boolean initiateCorrelation = false;
        ProcessVariable identifier = srcAct.getFromRole().getIdentifier();
        if(identifier!=null){
          ParameterContext params[] = srcAct.getParameters();
   
          if(params!=null && params.length>0)
          for(int i=0; i<params.length; i++){
            if(params[i].equals(identifier)){
              initiateCorrelation = true;
              break;
            }
          }
        }
       
        if(initiateCorrelation){
          tCorrelations correlations = new tCorrelations();
          tCorrelation correlation = new tCorrelation();
          correlation.setinitiate_Attribute(tBoolean.YES);
          correlation.setset_Attribute(new XNCName(fromRole + "Identification"));
          correlations.addcorrelation(correlation);
          destAct.setcorrelations(correlations);   
        }
        //
       
      }else{
        fromRole = "myRole";
      }
           
      destAct.setpartnerLink_Attribute(new XNCName(fromRole));
     
      destAct.setvariable_Attribute(new XNCName(variableName));
    }
    //---- end of receive activity ----

    activity actGrp = new activity();
    actGrp.setreceiveAsChoice(destAct);
    destSeqAct.addactivity_Group(actGrp);

   
    //---- build copy activity ----
    boolean assignUsed = true;
    tAssign assign = new tAssign();{
      ParameterContext params[] = srcAct.getParameters();
     
      if(params==null || params.length==0)
        assignUsed = false;
      else
      for(int i=0; i<params.length; i++){
View Full Code Here

TOP

Related Classes of org.uengine.kernel.ReceiveActivity

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.