Package org.activiti.workflow.simple.definition

Examples of org.activiti.workflow.simple.definition.WorkflowDefinition


    imagePanel.setContent(panelLayout);
    imagePanel.addComponent(diagram);
  }
 
  protected void save() {
    WorkflowDefinition workflowDefinition = createWorkflow();

    final ProcessEngineImpl defaultProcessEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine();
    RepositoryService repositoryService = defaultProcessEngine.getRepositoryService();
    ProcessEngineConfiguration processEngineConfiguration = defaultProcessEngine.getProcessEngineConfiguration();
    ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
   
    Model model = null;
    if (modelId == null) { // new process
      model = repositoryService.newModel();
    } else { // update existing process
      model = repositoryService.getModel(modelId);
    }

    model.setName(workflowDefinition.getName());
    model.setCategory(SimpleTableEditorConstants.TABLE_EDITOR_CATEGORY);
    repositoryService.saveModel(model);

    // Store model entity
    WorkflowDefinitionConversion conversion =
View Full Code Here


   
    ExplorerApp.get().getViewManager().showEditorProcessDefinitionPage(model.getId());
  }
 
   protected WorkflowDefinition createWorkflow() {
      WorkflowDefinition workflow = new WorkflowDefinition();
      workflow.setName((String) nameField.getValue());
     
      String description = (String) descriptionField.getValue();
      if (description != null && description.length() > 0) {
        workflow.setDescription(description);
      }
     
      List<HumanStepDefinition> steps = taskTable.getSteps();
      for (int i=0; i<steps.size(); i++) {
        HumanStepDefinition currentStep = steps.get(i);
       
        // Check if we have a parallel block
        int nextIndex = i+1;
        ParallelStepsDefinition parallelStepsDefinition = null;
        while (nextIndex < steps.size() && steps.get(nextIndex).isStartsWithPrevious()) {
          if (parallelStepsDefinition == null) {
            parallelStepsDefinition = new ParallelStepsDefinition();
            ListStepDefinition<ParallelStepsDefinition> listStepDef = new ListStepDefinition<ParallelStepsDefinition>();
            listStepDef.addStep(currentStep);
            parallelStepsDefinition.addStepList(listStepDef);
          }
         
          ListStepDefinition<ParallelStepsDefinition> listStepDef = new ListStepDefinition<ParallelStepsDefinition>();
          listStepDef.addStep(steps.get(nextIndex));
          parallelStepsDefinition.addStepList(listStepDef);
          nextIndex++;
        }
       
        if (parallelStepsDefinition != null) {
          workflow.addStep(parallelStepsDefinition);
          i = nextIndex - 1;
        } else {
          workflow.addStep(currentStep);
        }
      }
     
      return workflow;
    }
View Full Code Here

  /**
   * Check if all required artifacts are created when converting an empty workflow-definition.
   */
  @Test
  public void testEmptyWorkflowDefinitionConversion() {
    WorkflowDefinition definition = new WorkflowDefinition();
    definition.setDescription("This is the description");
    definition.setId("workflowdefinition");
    definition.setName("My workflow definition");
   
    WorkflowDefinitionConversion conversion = conversionFactory.createWorkflowDefinitionConversion(definition);
    conversion.convert();
   
    BpmnModel bpmnModel = conversion.getBpmnModel();
View Full Code Here

  /**
   * Check if all required artifacts are created when converting an empty workflow-definition.
   */
  @Test
  public void testGeneratedWorkflowDefinitionId() {
    WorkflowDefinition definition = new WorkflowDefinition();
   
    WorkflowDefinitionConversion conversion = conversionFactory.createWorkflowDefinitionConversion(definition);
    conversion.convert();
   
    BpmnModel bpmnModel = conversion.getBpmnModel();
View Full Code Here

    assertNotNull(generatedProcessId);
  }
 
  @Test
  public void testTaskListenerForIncomingProperties() throws Exception {
    WorkflowDefinition definition = new WorkflowDefinition();
    definition.setId("process");
   
    HumanStepDefinition humanStep = new HumanStepDefinition();
    humanStep.setId("step1");
    FormDefinition form = new FormDefinition();
    form.setFormKey("myform");
    humanStep.setForm(form);
   
    definition.addStep(humanStep);
   
    WorkflowDefinitionConversion conversion = conversionFactory.createWorkflowDefinitionConversion(definition);
    conversion.convert();
   
    Process process = conversion.getProcess();
View Full Code Here

    assertTrue(listenerFound);
  }
 
  @Test
  public void testTaskListenerForOutgoingProperties() throws Exception {
    WorkflowDefinition definition = new WorkflowDefinition();
    definition.setId("process");
   
    HumanStepDefinition humanStep = new HumanStepDefinition();
    humanStep.setId("step1");
    FormDefinition form = new FormDefinition();
   
    humanStep.setForm(form);
   
    TextPropertyDefinition text = new TextPropertyDefinition();
    text.setName("my text");
   
    text.getParameters().put(AlfrescoConversionConstants.PARAMETER_ADD_PROPERTY_TO_OUTPUT, true);
    FormPropertyGroup group = new FormPropertyGroup();
    group.setId("group");
    form.getFormGroups().add(group);
    group.getFormPropertyDefinitions().add(text);
   
    definition.addStep(humanStep);
   
    WorkflowDefinitionConversion conversion = conversionFactory.createWorkflowDefinitionConversion(definition);
    conversion.convert();
   
    Process process = conversion.getProcess();
View Full Code Here

  /**
   * Check artifact export.
   */
  @Test
  public void testExportArtifacts() throws Exception {
    WorkflowDefinition definition = new WorkflowDefinition();
    HumanStepDefinition humanStep = new HumanStepDefinition();
    humanStep.setAssignee("fred");
    humanStep.setId("step 1");
    FormDefinition form = new FormDefinition();
    form.setFormKey("wf:activitiAdhoc");
    humanStep.setForm(form);
   
    definition.addStep(humanStep);
   
    WorkflowDefinitionConversion conversion = conversionFactory.createWorkflowDefinitionConversion(definition);
    conversion.convert();
   
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
View Full Code Here

   * Test basic form-fields (text, number, date, list, ...)
   */
  @Test
  public void testHumanStepBasicFormField() throws Exception {
    // TODO: finish test once all types are present
    WorkflowDefinition definition = new WorkflowDefinition();
    definition.setId("process");
   
    HumanStepDefinition humanStep = new HumanStepDefinition();
    humanStep.setId("step1");
    FormDefinition form = new FormDefinition();
    humanStep.setForm(form);
   
    FormPropertyGroup group = new FormPropertyGroup();
    group.setId("group");
    group.setTitle("My group");
    humanStep.getForm().addFormPropertyGroup(group);
   
    // Add simple text
    TextPropertyDefinition textProperty = new TextPropertyDefinition();
    textProperty.setName("text");
    textProperty.setMandatory(true);
    group.addFormProperty(textProperty);
   
   
    definition.addStep(humanStep);
   
    WorkflowDefinitionConversion conversion = conversionFactory.createWorkflowDefinitionConversion(definition);
    conversion.convert();
   
    // Check content-model
View Full Code Here

   * model.
   */
  @Test
  public void testCustomReference() throws Exception {
    // TODO: finish test once all types are present
    WorkflowDefinition definition = new WorkflowDefinition();
    definition.setId("process");
   
    HumanStepDefinition humanStep = new HumanStepDefinition();
    humanStep.setId("step1");
    FormDefinition form = new FormDefinition();
    humanStep.setForm(form);
   
    FormPropertyGroup group = new FormPropertyGroup();
    group.setId("group");
    group.setTitle("My group");
    humanStep.getForm().addFormPropertyGroup(group);
   
    // Add simple text
    ReferencePropertyDefinition textProperty = new ReferencePropertyDefinition();
    textProperty.setName("person");
    textProperty.setMandatory(true);
    textProperty.setType("cm:person");
    group.addFormProperty(textProperty);
   
    definition.addStep(humanStep);
   
    WorkflowDefinitionConversion conversion = conversionFactory.createWorkflowDefinitionConversion(definition);
    conversion.convert();
   
    // Check content-model
View Full Code Here

    assertTrue(association.getTarget().isMandatory());
  }
 
  @Test
  public void testConvertEmailStep() throws Exception {
    WorkflowDefinition definition = new WorkflowDefinition();
    AlfrescoEmailStepDefinition emailStep = new AlfrescoEmailStepDefinition();
    emailStep.setTo("fred");
    emailStep.setSubject("jos");
   
    definition.addStep(emailStep);
   
    WorkflowDefinitionConversion conversion = conversionFactory.createWorkflowDefinitionConversion(definition);
    conversion.convert();
   
    // Process should contain a single service-task
View Full Code Here

TOP

Related Classes of org.activiti.workflow.simple.definition.WorkflowDefinition

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.