Search in sources :

Example 11 with IntermediateCatchEvent

use of org.activiti.bpmn.model.IntermediateCatchEvent in project Activiti by Activiti.

the class CompleteConverterTest method validateModel.

private void validateModel(BpmnModel model) {
    FlowElement flowElement = model.getMainProcess().getFlowElement("userTask1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof UserTask);
    assertEquals("userTask1", flowElement.getId());
    flowElement = model.getMainProcess().getFlowElement("catchsignal");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof IntermediateCatchEvent);
    assertEquals("catchsignal", flowElement.getId());
    IntermediateCatchEvent catchEvent = (IntermediateCatchEvent) flowElement;
    assertEquals(1, catchEvent.getEventDefinitions().size());
    assertTrue(catchEvent.getEventDefinitions().get(0) instanceof SignalEventDefinition);
    SignalEventDefinition signalEvent = (SignalEventDefinition) catchEvent.getEventDefinitions().get(0);
    assertEquals("testSignal", signalEvent.getSignalRef());
    flowElement = model.getMainProcess().getFlowElement("subprocess");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof SubProcess);
    assertEquals("subprocess", flowElement.getId());
    SubProcess subProcess = (SubProcess) flowElement;
    flowElement = subProcess.getFlowElement("receiveTask");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof ReceiveTask);
    assertEquals("receiveTask", flowElement.getId());
}
Also used : SubProcess(org.activiti.bpmn.model.SubProcess) ReceiveTask(org.activiti.bpmn.model.ReceiveTask) FlowElement(org.activiti.bpmn.model.FlowElement) IntermediateCatchEvent(org.activiti.bpmn.model.IntermediateCatchEvent) UserTask(org.activiti.bpmn.model.UserTask) SignalEventDefinition(org.activiti.bpmn.model.SignalEventDefinition)

Example 12 with IntermediateCatchEvent

use of org.activiti.bpmn.model.IntermediateCatchEvent in project Activiti by Activiti.

the class CatchEventXMLConverter method convertXMLToElement.

@Override
protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
    IntermediateCatchEvent catchEvent = new IntermediateCatchEvent();
    BpmnXMLUtil.addXMLLocation(catchEvent, xtr);
    parseChildElements(getXMLElementName(), catchEvent, model, xtr);
    return catchEvent;
}
Also used : IntermediateCatchEvent(org.activiti.bpmn.model.IntermediateCatchEvent)

Example 13 with IntermediateCatchEvent

use of org.activiti.bpmn.model.IntermediateCatchEvent in project Activiti by Activiti.

the class InitializeAlfrescoModelsConversionListener method afterStepsConversion.

@Override
public void afterStepsConversion(WorkflowDefinitionConversion conversion) {
    M2Model model = AlfrescoConversionUtil.getContentModel(conversion);
    M2Namespace modelNamespace = model.getNamespaces().get(0);
    for (FlowElement flowElement : conversion.getProcess().getFlowElements()) {
        if (flowElement instanceof StartEvent) {
            StartEvent startEvent = (StartEvent) flowElement;
            if (startEvent.getFormKey() == null) {
                Module module = AlfrescoConversionUtil.getExtension(conversion).getModules().get(0);
                Configuration detailsForm = module.addConfiguration(EVALUATOR_STRING_COMPARE, MessageFormat.format(EVALUATOR_CONDITION_ACTIVITI, conversion.getProcess().getId()));
                // is available
                if (conversion.getWorkflowDefinition().getStartFormDefinition() != null && !conversion.getWorkflowDefinition().getStartFormDefinition().getFormGroups().isEmpty()) {
                    // Create the content model for the start-task
                    M2Type type = new M2Type();
                    model.getTypes().add(type);
                    type.setName(AlfrescoConversionUtil.getQualifiedName(modelNamespace.getPrefix(), AlfrescoConversionConstants.START_TASK_SIMPLE_NAME));
                    type.setParentName(AlfrescoConversionConstants.DEFAULT_START_FORM_TYPE);
                    // Create a form-config for the start-task
                    Module shareModule = AlfrescoConversionUtil.getExtension(conversion).getModules().get(0);
                    Configuration configuration = shareModule.addConfiguration(AlfrescoConversionConstants.EVALUATOR_TASK_TYPE, type.getName());
                    Form formConfig = configuration.createForm();
                    formConfig.setStartForm(true);
                    // Populate model and form based on FormDefinition
                    formCreator.createForm(type, formConfig, conversion.getWorkflowDefinition().getStartFormDefinition(), conversion);
                    // Use the same form-config for the workflow details
                    detailsForm.addForm(formConfig);
                    // Set formKey on start-event, referencing type
                    startEvent.setFormKey(type.getName());
                } else {
                    // Revert to the default start-form
                    startEvent.setFormKey(DEFAULT_START_FORM_TYPE);
                    // Also add form-config to the share-module for workflow detail screen, based on the default form
                    populateDefaultDetailFormConfig(detailsForm);
                }
            }
        }
    }
    // Check all elements that can contain PropertyReferences or need additional builders invoked
    List<PropertyReference> references = AlfrescoConversionUtil.getPropertyReferences(conversion);
    for (FlowElement element : conversion.getProcess().getFlowElements()) {
        if (element instanceof SequenceFlow) {
            resolvePropertyRefrencesInSequenceFlow((SequenceFlow) element, modelNamespace, references);
        } else if (element instanceof IntermediateCatchEvent) {
            resolvePropertyRefrencesInCatchEvent((IntermediateCatchEvent) element, modelNamespace, references);
        } else if (element instanceof ServiceTask) {
            resolvePropertyRefrencesInServiceTask((ServiceTask) element, modelNamespace, references);
        } else if (element instanceof UserTask) {
            addScriptListenersToUserTask((UserTask) element, conversion);
        }
    }
    // Check if all property-references reference a valid property
    if (references != null && !references.isEmpty()) {
        for (PropertyReference reference : references) {
            reference.validate(model);
        }
    }
}
Also used : M2Namespace(org.activiti.workflow.simple.alfresco.model.M2Namespace) ServiceTask(org.activiti.bpmn.model.ServiceTask) Configuration(org.activiti.workflow.simple.alfresco.model.config.Configuration) Form(org.activiti.workflow.simple.alfresco.model.config.Form) SequenceFlow(org.activiti.bpmn.model.SequenceFlow) M2Model(org.activiti.workflow.simple.alfresco.model.M2Model) IntermediateCatchEvent(org.activiti.bpmn.model.IntermediateCatchEvent) UserTask(org.activiti.bpmn.model.UserTask) PropertyReference(org.activiti.workflow.simple.alfresco.conversion.script.PropertyReference) M2Type(org.activiti.workflow.simple.alfresco.model.M2Type) FlowElement(org.activiti.bpmn.model.FlowElement) StartEvent(org.activiti.bpmn.model.StartEvent) Module(org.activiti.workflow.simple.alfresco.model.config.Module)

Example 14 with IntermediateCatchEvent

use of org.activiti.bpmn.model.IntermediateCatchEvent in project Activiti by Activiti.

the class DelayStepDefinitionConverter method createProcessArtifact.

@Override
protected IntermediateCatchEvent createProcessArtifact(DelayStepDefinition stepDefinition, WorkflowDefinitionConversion conversion) {
    IntermediateCatchEvent event = new IntermediateCatchEvent();
    event.setId(conversion.getUniqueNumberedId(ConversionConstants.INTERMEDIATE_EVENT_ID_PREVIX));
    event.setName(stepDefinition.getName());
    event.setDocumentation(stepDefinition.getDescription());
    TimerEventDefinition timer = new TimerEventDefinition();
    event.addEventDefinition(timer);
    if (stepDefinition.getTimeDate() != null) {
        timer.setTimeDate(stepDefinition.getTimeDate());
    } else if (stepDefinition.getTimeDuration() != null) {
        timer.setTimeDuration(stepDefinition.getTimeDuration().toISO8601DurationString());
    }
    addFlowElement(conversion, event, true);
    return event;
}
Also used : IntermediateCatchEvent(org.activiti.bpmn.model.IntermediateCatchEvent) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition)

Example 15 with IntermediateCatchEvent

use of org.activiti.bpmn.model.IntermediateCatchEvent in project Activiti by Activiti.

the class CompleteConverterTest method validateModel.

private void validateModel(BpmnModel model) {
    FlowElement flowElement = model.getMainProcess().getFlowElement("userTask1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof UserTask);
    assertEquals("userTask1", flowElement.getId());
    flowElement = model.getMainProcess().getFlowElement("catchsignal");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof IntermediateCatchEvent);
    assertEquals("catchsignal", flowElement.getId());
    IntermediateCatchEvent catchEvent = (IntermediateCatchEvent) flowElement;
    assertEquals(1, catchEvent.getEventDefinitions().size());
    assertTrue(catchEvent.getEventDefinitions().get(0) instanceof SignalEventDefinition);
    SignalEventDefinition signalEvent = (SignalEventDefinition) catchEvent.getEventDefinitions().get(0);
    assertEquals("testSignal", signalEvent.getSignalRef());
    flowElement = model.getMainProcess().getFlowElement("subprocess");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof SubProcess);
    assertEquals("subprocess", flowElement.getId());
    SubProcess subProcess = (SubProcess) flowElement;
    flowElement = subProcess.getFlowElement("receiveTask");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof ReceiveTask);
    assertEquals("receiveTask", flowElement.getId());
}
Also used : SubProcess(org.activiti.bpmn.model.SubProcess) ReceiveTask(org.activiti.bpmn.model.ReceiveTask) FlowElement(org.activiti.bpmn.model.FlowElement) IntermediateCatchEvent(org.activiti.bpmn.model.IntermediateCatchEvent) UserTask(org.activiti.bpmn.model.UserTask) SignalEventDefinition(org.activiti.bpmn.model.SignalEventDefinition)

Aggregations

IntermediateCatchEvent (org.activiti.bpmn.model.IntermediateCatchEvent)15 FlowElement (org.activiti.bpmn.model.FlowElement)5 StartEvent (org.activiti.bpmn.model.StartEvent)5 BoundaryEvent (org.activiti.bpmn.model.BoundaryEvent)4 TimerEventDefinition (org.activiti.bpmn.model.TimerEventDefinition)4 UserTask (org.activiti.bpmn.model.UserTask)4 EventDefinition (org.activiti.bpmn.model.EventDefinition)3 SequenceFlow (org.activiti.bpmn.model.SequenceFlow)3 SignalEventDefinition (org.activiti.bpmn.model.SignalEventDefinition)3 ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)3 ReceiveTask (org.activiti.bpmn.model.ReceiveTask)2 SubProcess (org.activiti.bpmn.model.SubProcess)2 EventSubscriptionDeclaration (org.activiti.engine.impl.bpmn.parser.EventSubscriptionDeclaration)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 BpmnModel (org.activiti.bpmn.model.BpmnModel)1 ExclusiveGateway (org.activiti.bpmn.model.ExclusiveGateway)1 Message (org.activiti.bpmn.model.Message)1 MessageEventDefinition (org.activiti.bpmn.model.MessageEventDefinition)1 ServiceTask (org.activiti.bpmn.model.ServiceTask)1