Package org.uengine.kernel

Examples of org.uengine.kernel.ProcessDefinition


public class ProcessDefinitionAdapter implements org.uengine.processpublisher.Adapter{

  static Hashtable adapters = new Hashtable();
 
  public Object convert(Object src, java.util.Hashtable keyedContext) throws Exception{
    ProcessDefinition srcProcDef = (ProcessDefinition)src;
   
    tProcess proc = new tProcess();
    String srcProcName = BPELSerializer.toSafeName(srcProcDef.getName().getText(), "Process");
    proc.setname_Attribute(new XNCName(srcProcName));
    proc.settargetNamespace_Attribute(new XAnyURI("urn:" + srcProcName));
   
    Hashtable context = new Hashtable();
    context.put("addVariables", new Vector());

    activity actGrp = new activity();
      tSequence seq = new tSequence();
      seq.setname_Attribute(new XNCName("_main_sequence"));
     
      Vector childActivities = srcProcDef.getChildActivities();
      for(Enumeration enumeration = childActivities.elements(); enumeration.hasMoreElements();){
        Object item = (Object)enumeration.nextElement();
        Adapter adpt = getAdapter(item.getClass());
        if(adpt==null){
          continue;
        }
               
        activity actGrp_ = (activity)adpt.convert(item, context);
        seq.addactivity_Group(actGrp_);
      }   
     
      actGrp.setsequenceAsChoice(seq);
    proc.setactivity_Group(actGrp)
   
    //setting variables
    tVariables variables = new tVariables();
   
    ProcessVariable pvds[] = srcProcDef.getProcessVariables();
    for(int i=0; i<pvds.length; i++){
      ProcessVariable pvd = pvds[i];
      tVariable variable = new tVariable();
      variable.setname_Attribute(new XNCName(BPELSerializer.toSafeName(pvd.getName(), "variable"+i)));
     
      //review: should be xsi type
      variable.settype_Attribute(getXSDTypeName(pvd));   
      variables.addvariable(variable);
    }
   
    Vector addVariables = (Vector)context.get("addVariables");
    for(Enumeration enumeration = addVariables.elements(); enumeration.hasMoreElements(); ){
      Object [] varCtx = (Object[])enumeration.nextElement();
     
      String variableName = (String)varCtx[0];
      XQName variableType = (XQName)varCtx[1];
      
      tVariable variable = new tVariable();
      variable.setname_Attribute(new XNCName(variableName) );
     
      //review: should be xsi type
      variable.setmessageType_Attribute(variableType);   
      variables.addvariable(variable);
    }
   
    proc.setvariables(variables);     
    //
   
    //setting partners
    tPartnerLinks partnerLinks = new tPartnerLinks();
   
    Role roles[] = srcProcDef.getRoles();
    for(int i=0; i<roles.length; i++){
      Role role = roles[i];
      tPartnerLink partnerLink = new tPartnerLink();
      String roleName = BPELSerializer.toSafeName(role.getName(), "role"+i);     
      partnerLink.setname_Attribute(new XNCName(roleName));
      partnerLink.setpartnerLinkType_Attribute(new XQName("sdns", "", roleName + "PartnerLinkType"));
      partnerLink.setpartnerRole_Attribute(new XNCName("partnerRole"));
      partnerLinks.addpartnerLink(partnerLink);
    }
    //add my role
    tPartnerLink partnerLink = new tPartnerLink();
    partnerLink.setname_Attribute(new XNCName("myRole") );
    partnerLink.setpartnerLinkType_Attribute(new XQName("sdns", "", srcProcName + "PartnerLinkType"));
    partnerLink.setpartnerRole_Attribute(new XNCName("myRole"));
    partnerLinks.addpartnerLink(partnerLink);
    //
   
    proc.setpartnerLinks(partnerLinks);   
    //
   
    //setting correlations   
    tCorrelationSets correlationSets = new tCorrelationSets();
    for(int i=0; i<roles.length; i++){
      Role role = roles[i];
      ProcessVariable identifier = role.getIdentifier();
      if(identifier==null) identifier = srcProcDef.getProcessVariables()[0];//continue;
     
      tCorrelationSet correlationSet = new tCorrelationSet();
      correlationSet.setname_Attribute(new XNCName(BPELSerializer.toSafeName(role.getName(), "role"+i)+"Identification"));
      //review:
      correlationSet.setproperties_Attribute(new XQName("sdns","","property_" + identifier.getName()));
View Full Code Here


 
  public Object convert(Object src, java.util.Hashtable keyedContext) throws Exception{
    process srcProcDef = (process)src;       
    tProcess srcProc = srcProcDef.gettProcessComplexType();
   
    ProcessDefinition proc = new ProcessDefinition();
   
    proc.setName(srcProc.getname_Attribute().get());
   
    //proc.settargetNamespace_Attribute(new XAnyURI("urn:" + srcProcDef.getName().replace(' ', '_')));

    Vector childActivities = new Vector();
    activity srcChildActivity = srcProc.getactivity_Group();
   
    //getting variables
    {
      Vector pvdVector = new Vector();
   
      tVariables variables = srcProc.getvariables();
      for(Enumeration enumeration = variables.enumeratevariable(); enumeration.hasMoreElements();){
        ProcessVariable pvd = new ProcessVariable();
        tVariable var = (tVariable)enumeration.nextElement();
        pvd.setName(var.getname_Attribute().get());
        //pvd.setQName(var.gettype_Attribute().get());
        pvdVector.add(pvd);
      }
   
      ProcessVariable[] pvds = new ProcessVariable[pvdVector.size()];
      pvdVector.toArray(pvds);
      proc.setProcessVariables(pvds);     
    }
    //
   
    //setting roles
    {
      Vector roleVector = new Vector();

      tPartnerLinks partnerLinks = srcProc.getpartnerLinks();

      for(Enumeration enumeration = partnerLinks.enumeratepartnerLink(); enumeration.hasMoreElements();){
        Role role = new Role();
        tPartnerLink partnerLink = (tPartnerLink)enumeration.nextElement();
        role.setName(partnerLink.getname_Attribute().get());
        //pvd.setQName(var.gettype_Attribute().get());
        roleVector.add(role);
      }
   
      Role[] roles = new Role[roleVector.size()];
      roleVector.toArray(roles);
      proc.setRoles(roles);     
    }
    //
       
    return proc;
  }
View Full Code Here

   *
   */
  private static final long serialVersionUID = GlobalContext.SERIALIZATION_UID;

  private void addReservedWorklist(Activity activity, ProcessInstance instance) throws Exception {
    ProcessDefinition  pd = instance.getProcessDefinition();
    Vector        activities = pd.getChildActivities();
   
    for (int i = 0; i < activities.size(); i++) {
      Activity  a = (Activity)activities.get(i);
     
      if (a.getTracingTag().equals(activity.getTracingTag()))    continue;    // 자기 자신은 등록하지 않는다.
View Full Code Here

  public void onPropertyChange(Activity activity, ProcessInstance instance,
      String propertyName, Object changedValue) throws Exception {
   
    if (propertyName.equals("roleMapping") && !instance.isNew()) {
      RoleMapping  rm = (RoleMapping)changedValue;
      ProcessDefinition  pd = (ProcessDefinition)activity;
      String      roleName = rm.getName();
     
      // 같은 roleName을 갖는 Activity를 찾는다.
      Vector  activities = pd.getChildActivities();
      for (int i = 0; i < activities.size(); i++) {
        Activity  a = (Activity)activities.get(i);
        if (a instanceof HumanActivity) {
          HumanActivity  ha = (HumanActivity)a;
          if (ha.getRole().getName().equals(roleName)) {
View Full Code Here

  static Hashtable adapters = new Hashtable();

 
  public Object convert(Object src, Hashtable keyedContext) throws Exception {
    GraphActivity graph = (GraphActivity) super.convert(src, keyedContext);
    ProcessDefinition processDefinition = (ProcessDefinition) src;
   
    GraphActivity start = new GraphActivity(processDefinition);
    start.setStartGraphActivity();
    start.addNext(graph);
   
View Full Code Here

   
    Role role1 = new Role("Role1");
    Role role2 = new Role("Role2");
    Role role3 = new Role("Role3");
   
    ProcessDefinition def = new ProcessDefinition();{
      act = new HumanActivity();
      act.setName("report trouble");
      ((HumanActivity) act).setRole(role1);
      def.addChildActivity(act);

      act = new HumanActivity();
      act.setName("set the right person");
      ((HumanActivity) act).setRole(role2);     
      def.addChildActivity(act);
     
      cAct1 = new SwitchActivity();
      cAct1.setName("switch1");
      def.addChildActivity(cAct1);{
        cAct2 = new SequenceActivity();
        cAct1.addChildActivity(cAct2);{
          act = new HumanActivity();
          act.setName("Draft with resolution");
          ((HumanActivity) act).setRole(role3);
View Full Code Here

    simulator_CardLayout.show(simulator_TabPanel, "tab2");
    modelingTabBtn.setEnabled(true);
    //simulateTabBtn2.setEnabled(true);
    simulateTabBtn.setEnabled(false);
   
    ProcessDefinition processDefinition = (ProcessDefinition)getProcessDefinitionDesigner().getActivity();
    processDefinition.beforeSerialization();
    simulator.setProcessDefinition(processDefinition);
  }
View Full Code Here

    JPanel pan = new JPanel(new BorderLayout());
    //pan.setBackground(Color.WHITE);
   
    setDesignerPanel(pan);
   
    ProcessDefinition processDefinition = ProcessDefinition.create();
   
    ProcessDefinitionDesigner cac =
       (ProcessDefinitionDesigner)UEngineUtil.getComponentByEscalation(processDefinition.getClass(), "designer");
   
    setProcessDefinitionDesigner(cac);
    addUndoListener(processDefinition);
    cac.setActivity(processDefinition);
   
View Full Code Here

    }

    fileName = currentWorkingFileObj.getName();
    filePath = currentWorkingFileObj.getParent();

    ProcessDefinition def = (ProcessDefinition)getProcessDefinitionDesigner().getActivity();   

    // serialize
    try{
      String fileType = "XPD";
           
      if(fileName.lastIndexOf('.') < 0)
        fileName = fileName + "." + fileType;
       
     
/*      String fileType = fileName.substring( fileName.lastIndexOf(".")+1);
     
      if( fileName.lastIndexOf(".") < 0){
        fileType = ((ExampleFileFilter)chooser.getFileFilter()).getDescription();
        fileType = fileType.substring( 0, fileType.indexOf(" "));
        //somthing looks wrong --> filePath = filePath + "." + fileType;
      }
           
      if(fileType.toUpperCase().equals("BEAN"))
        fileType = "Bean";*/
       
System.out.println( "\nSelected FileType : "+fileType);
      FileOutputStream fo = new FileOutputStream( filePath + System.getProperty("file.separator") + fileName);
       
      Class cls = Class.forName( "org.uengine.components.serializers." + fileType + "Serializer");
      Serializer se = (Serializer)cls.newInstance();
System.out.println( "Use this serializer : " + se);

      //ignore the belonging definition if write to a file
      String temp = def.getBelongingDefinitionId();
      def.setBelongingDefinitionId(null);
     
      se.serialize( def, fo, null);
     
      //TestSVGGen.export2SVG(getProcessDefinitionDesigner(), new FileOutputStream(filePath + System.getProperty("file.separator") + fileName+".svg"));

      //restore the belonging def
      def.setBelongingDefinitionId(temp);
      setCurrentWorkingPath(filePath);
      setCurrentWorkingFile(currentWorkingFileObj.getPath());
      setDocumentChanged(false);
     
    }catch( Exception ex){
View Full Code Here

      ex.printStackTrace();
    }
  }
 
  protected void generateServiceClass(){
    final ProcessDefinition definition = (ProcessDefinition)getProcessDefinitionDesigner().getActivity();
   
/*    JFileChooser chooser = new JFileChooser();
    chooser.setDialogType(JFileChooser.SAVE_DIALOG);
    chooser.setDialogTitle("Generate and deploy Web Service");

    String axisDirectory = System.getProperty(GlobalContext.PROPERTY_AXIS_WEBAPP_DIR, ".");
*/   

/*    String defaultFileName = axisDirectory + System.getProperty("file.separator") + procName + ".jws";
    File savingFile = new File(defaultFileName);
//System.out.println("service class path = " + savingFile.getAbsolutePath());
    chooser.setCurrentDirectory(new File(axisDirectory));
    chooser.setSelectedFile(savingFile);
    int returnVal = chooser.showSaveDialog(this);
    if(returnVal != JFileChooser.APPROVE_OPTION) return;

    try{
      String fileName = chooser.getSelectedFile().getName();
      String fileType = fileName.substring( fileName.lastIndexOf(".")+1);
     
      String filePath = chooser.getSelectedFile().getPath();     
      PrintStream fo = new PrintStream(new FileOutputStream(filePath));
       
      org.uengine.webservice.ServiceClassGenerator.generateSource(definition, new Properties(), fo);
     
    }catch( Exception ex){
      ex.printStackTrace();
    }*/
   
    final ProgressDialog progDlg = new ProgressDialog("deploy..."){
      public void run() throws Exception{

        String procName;{
          procName = definition.getName().getText();
          procName = procName.replace(' ', '_');
          String firstChar = procName.substring(0, 1);
          procName = firstChar.toUpperCase() + procName.substring(1, procName.length());
       

View Full Code Here

TOP

Related Classes of org.uengine.kernel.ProcessDefinition

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.