Package org.jboss.bpm.console.client.model

Examples of org.jboss.bpm.console.client.model.ProcessInstanceRef


    for(TInstanceInfo i0 : instanceListDocument.getInstanceInfoList().getInstanceInfoList())
    {
      if(i0.getPid().equals(procesQName.toString()))
      {
        ProcessInstanceRef ref = new ProcessInstanceRef(
            i0.getIid(),
            encodeId(i0.getPid()),
            i0.getDtStarted().getTime(),
            null,
            false // see filter criteria when selecting instances
View Full Code Here


  @Test @Ignore
  public void testNewProcessInstanceWithVariables() {
    HashMap<String, Object> variables = new HashMap<String, Object>();
    variables.put("key2", "variable2");
    ProcessInstanceRef instanceRef = processManager.newInstance("UserTask",  variables);
    assertEquals("UserTask", instanceRef.getDefinitionId());
    assertEquals(3, processManager.getProcessInstances("UserTask").size());
    assertEquals("variable2", processManager.getInstanceData(instanceRef.getId()).get("key2"));
  }
View Full Code Here

 
  @Test
  public void testProcessInstance(){
    String instanceID = Long.toString(delegate.startProcess("UserTask", null).getId());
    ProcessInstanceLog instanceLog =delegate.getProcessInstanceLog(instanceID);
    ProcessInstanceRef processInstanceRef = Transform.processInstance(instanceLog);
   
    assertEquals(instanceLog.getProcessInstanceId(),Long.parseLong(processInstanceRef.getId()));
    assertEquals(instanceLog.getProcessId(),processInstanceRef.getDefinitionId());
   
  }
View Full Code Here

    result.setDeploymentId("N/A");
    return result;
  }
 
  public static ProcessInstanceRef processInstance(ProcessInstanceLog processInstance) {
    ProcessInstanceRef result = new ProcessInstanceRef(
      processInstance.getProcessInstanceId() + "",
      processInstance.getProcessId(),
      processInstance.getStart(),
      processInstance.getEnd(),
      false);
    TokenReference token = new TokenReference(
      processInstance.getProcessInstanceId() + "", null, "");
    result.setRootToken(token);
    return result;
  }
View Full Code Here

    return ID;
  }

  public String getUrl(Object event)
  {
    ProcessInstanceRef inst = (ProcessInstanceRef)event;
    return URLBuilder.getInstance().getActiveNodeInfoURL(inst.getId());
  }
View Full Code Here

  }

  public void handleSuccessfulResponse(
      final Controller controller, final Object event, Response response)
  {
    ProcessInstanceRef inst = (ProcessInstanceRef)event;
    if (inst.getState().equals(ProcessInstanceRef.STATE.ENDED) || response.getText().length() == 0) {
      MessageBox.alert("Info", "Process is already completed");
    } else {
      List<ActiveNodeInfo> activeNodeInfos = DTOParser.parseActiveNodeInfo(response.getText());
      // update view
      ActivityDiagramView view = (ActivityDiagramView) controller.getView(ActivityDiagramView.ID);
      view.update(new ActivityDiagramResultEvent(URLBuilder.getInstance().getProcessImageURL(inst.getDefinitionId()), activeNodeInfos));
    }
    }
View Full Code Here

    return ID;
  }

  public String getUrl(Object event)
  {
    final ProcessInstanceRef inst = (ProcessInstanceRef)event;
    if(ProcessInstanceRef.STATE.ENDED == inst.getState())
      return URLBuilder.getInstance().getInstanceEndURL(inst.getId(), inst.getEndResult());
    else
      return URLBuilder.getInstance().getStateChangeURL(inst.getId(), inst.getState());
  }
View Full Code Here

    return ID;
  }

  public String getUrl(Object event)
  {
    ProcessInstanceRef instance = (ProcessInstanceRef)event;
    return URLBuilder.getInstance().getInstanceDeleteURL(instance.getId());
  }
View Full Code Here

                        public void onRowSelection(RowSelectionEvent rowSelectionEvent)
                        {
                            int index = listBox.getSelectedIndex();
                            if(index!=-1)
                            {
                                ProcessInstanceRef item = listBox.getItem(index);

                                // enable or disable signal button depending on current activity
                                if (isSignalable(item)) {
                                    signalBtn.setEnabled(true);
                                } else {
                                    signalBtn.setEnabled(false);
                                }

                                terminateBtn.setEnabled(true);

                                // update details
                                controller.handleEvent(
                                        new Event(UpdateInstanceDetailAction.ID,
                                                new InstanceEvent(currentDefinition, item)
                                        )
                                );
                            }
                        }
                    }
            );

            // toolbar
            final MosaicPanel toolBox = new MosaicPanel();

            toolBox.setPadding(0);
            toolBox.setWidgetSpacing(5);

            final ToolBar toolBar = new ToolBar();
            refreshBtn = new Button("Refresh", new ClickHandler() {

                public void onClick(ClickEvent clickEvent) {
                    controller.handleEvent(
                            new Event(
                                    UpdateInstancesAction.ID,
                                    getCurrentDefinition()
                            )
                    );
                }
            }
            );
            toolBar.add(refreshBtn);
            refreshBtn.setEnabled(false);
            toolBar.addSeparator();

            startBtn = new Button("Start", new ClickHandler()
            {
                public void onClick(ClickEvent clickEvent)
                {
                    MessageBox.confirm("Start new execution",
                            "Do you want to start a new execution of this process?",
                            new MessageBox.ConfirmationCallback()
                            {
                                public void onResult(boolean doIt)
                                {
                                    if (doIt)
                                    {
                                        String url = getCurrentDefinition().getFormUrl();
                                        boolean hasForm = (url != null && !url.equals(""));
                                        if (hasForm)
                                        {
                                            ProcessDefinitionRef definition = getCurrentDefinition();
                                            iframeWindow = new IFrameWindowPanel(
                                                    definition.getFormUrl(), "New Process Instance: " + definition.getId()
                                            );

                                            iframeWindow.setCallback(
                                                    new IFrameWindowCallback()
                                                    {
                                                        public void onWindowClosed()
                                                        {
                                                            controller.handleEvent(
                                                                    new Event(UpdateInstancesAction.ID, getCurrentDefinition())
                                                            );
                                                        }
                                                    }
                                            );

                                            iframeWindow.show();
                                        }
                                        else
                                        {
                                            controller.handleEvent(
                                                    new Event(
                                                            StartNewInstanceAction.ID,
                                                            getCurrentDefinition()
                                                    )
                                            );
                                        }
                                    }

                                }
                            });

                }
            }
            );


            terminateBtn = new Button("Terminate", new ClickHandler()
            {
                public void onClick(ClickEvent clickEvent)
                {
                    if (getSelection() != null)
                    {

                        MessageBox.confirm("Terminate instance",
                                "Terminating this instance will stop further execution.",
                                new MessageBox.ConfirmationCallback()
                                {
                                    public void onResult(boolean doIt)
                                    {
                                        if (doIt)
                                        {
                                          ProcessInstanceRef selection = getSelection();
                                          if (selection.getState().equals(ProcessInstanceRef.STATE.ENDED)) {
                                              MessageBox.alert("Info", "Process is already completed");
                                            } else {
                                             
                                              selection.setState(ProcessInstanceRef.STATE.ENDED);
                                              selection.setEndResult(ProcessInstanceRef.RESULT.OBSOLETE);
                                              controller.handleEvent(
                                                      new Event(
                                                              StateChangeAction.ID,
                                                              selection
                                                      )
                                              );
                                            }
                                        }
                                    }
                                });
                    }
                    else
                    {
                        MessageBox.alert("Missing selection", "Please select an instance");
                    }
                }
            }
            );           


            deleteBtn = new Button("Delete", new ClickHandler()
            {
                public void onClick(ClickEvent clickEvent)
                {
                    if (getSelection() != null)
                    {
                        MessageBox.confirm("Delete instance",
                                "Deleting this instance will remove any history information and associated tasks as well.",
                                new MessageBox.ConfirmationCallback()
                                {
                                    public void onResult(boolean doIt)
                                    {

                                        if (doIt)
                                        {
                                          try {
                                              ProcessInstanceRef selection = getSelection();
                                              if (selection.getState().equals(ProcessInstanceRef.STATE.ENDED)) {
                                                MessageBox.alert("Info", "Process is already completed");
                                              } else {
                                                selection.setState(ProcessInstanceRef.STATE.ENDED);
   
                                                controller.handleEvent(
                                                        new Event(
                                                                DeleteInstanceAction.ID,
                                                                selection
View Full Code Here

        }
    }

    public ProcessInstanceRef getSelection()
    {
        ProcessInstanceRef selection = null;
        if(listBox.getSelectedIndex()!=-1)
            selection = listBox.getItem( listBox.getSelectedIndex());
        return selection;
    }
View Full Code Here

TOP

Related Classes of org.jboss.bpm.console.client.model.ProcessInstanceRef

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.