Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.Signal


    return sequenceFlow;
  }

  public static Signal createSignal(WorkflowDefinitionConversion conversion, String signalName, boolean processInstanceScope) {
    Signal approvalFinishedSignal = new Signal();
    approvalFinishedSignal.setId(conversion.getUniqueNumberedId(SIGNAL_PREFIX));
    approvalFinishedSignal.setName(signalName);

    if (processInstanceScope) {
      approvalFinishedSignal.setScope("processInstance");
    }

    return approvalFinishedSignal;
  }
View Full Code Here


    // Gather feedback user task for the initiator of the feedback step
    UserTask gatherFeedbackUserTask = createGatherFeedbackUserTask(feedbackStepDefinition, conversion, processElements);
    addSequenceFlow(conversion, fork, gatherFeedbackUserTask);
   
    // Global signal event
    Signal signal = createSignalDeclaration(conversion);
   
    // Signal throw event after the gather feedback task
    ThrowEvent signalThrowEvent = createSignalThrow(conversion, signal);
    addSequenceFlow(conversion, gatherFeedbackUserTask, signalThrowEvent);
   
View Full Code Here

    processElements.put(SELECT_PEOPLE_USER_TASK, gatherFeedbackUserTask);
    return gatherFeedbackUserTask;
  }

  protected Signal createSignalDeclaration(WorkflowDefinitionConversion conversion) {
    Signal signal = new Signal();
    String uniqueSignalId = "signal-" + UUID.randomUUID().toString();
    signal.setId(uniqueSignalId);
    signal.setName(uniqueSignalId);
    signal.setScope(Signal.SCOPE_PROCESS_INSTANCE);
   
    conversion.getBpmnModel().addSignal(signal);
   
    return signal;
  }
View Full Code Here

 
  public void parse(XMLStreamReader xtr, BpmnModel model) throws Exception {
    String signalId = xtr.getAttributeValue(null, ATTRIBUTE_ID);
    String signalName = xtr.getAttributeValue(null, ATTRIBUTE_NAME);
   
    Signal signal = new Signal(signalId, signalName);
   
    String scope = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_SCOPE);
    if (scope != null) {
      signal.setScope(scope);
    }
   
    BpmnXMLUtil.addXMLLocation(signal, xtr);
    BpmnXMLUtil.parseChildElements(ELEMENT_SIGNAL, signal, xtr, model);
    model.addSignal(signal);
View Full Code Here

        if (!event.getEventDefinitions().isEmpty()) {
          EventDefinition eventDefinition = event.getEventDefinitions().get(0);
          if (eventDefinition instanceof SignalEventDefinition) {
            SignalEventDefinition signalEvent = (SignalEventDefinition) eventDefinition;
            if (model.containsSignalId(signalEvent.getSignalRef()) == false) {
              Signal signal = new Signal(signalEvent.getSignalRef(), signalEvent.getSignalRef());
              model.addSignal(signal);
            }

          } else if (eventDefinition instanceof MessageEventDefinition) {
            MessageEventDefinition messageEvent = (MessageEventDefinition) eventDefinition;
            if (model.containsMessageId(messageEvent.getMessageRef()) == false) {
              Message message = new Message(messageEvent.getMessageRef(), messageEvent.getMessageRef(), null);
              model.addMessage(message);
            }
          }
        }
      }
    }
   
    for (Signal signal : model.getSignals()) {
      xtw.writeStartElement(ELEMENT_SIGNAL);
      xtw.writeAttribute(ATTRIBUTE_ID, signal.getId());
      xtw.writeAttribute(ATTRIBUTE_NAME, signal.getName());
      if (signal.getScope() != null) {
        xtw.writeAttribute(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_SCOPE, signal.getScope());
      }
      xtw.writeEndElement();
    }
   
    for (Message message : model.getMessages()) {
View Full Code Here

    return SignalEventDefinition.class;
  }
 
  protected void executeParse(BpmnParse bpmnParse, SignalEventDefinition signalDefinition) {
   
    Signal signal = null;
    if (bpmnParse.getBpmnModel().containsSignalId(signalDefinition.getSignalRef())) {
      signal = bpmnParse.getBpmnModel().getSignal(signalDefinition.getSignalRef());
      String signalName = signal.getName();
      signalDefinition.setSignalRef(signalName);
    }
   
    if (signal == null) {
      return;
    }
   
    ActivityImpl activity = bpmnParse.getCurrentActivity();
    if (bpmnParse.getCurrentFlowElement() instanceof StartEvent) {
   
      EventSubscriptionDeclaration eventSubscriptionDeclaration = new EventSubscriptionDeclaration(signalDefinition.getSignalRef(), "signal");
      eventSubscriptionDeclaration.setActivityId(activity.getId());
      eventSubscriptionDeclaration.setStartEvent(true);
      addEventSubscriptionDeclaration(bpmnParse, eventSubscriptionDeclaration, signalDefinition, bpmnParse.getCurrentScope());
     
    } else if (bpmnParse.getCurrentFlowElement() instanceof IntermediateCatchEvent){
     
      activity.setProperty("type", "intermediateSignalCatch");  
     
      EventSubscriptionDeclaration eventSubscriptionDeclaration = new EventSubscriptionDeclaration(signalDefinition.getSignalRef(), "signal");
     
      if (signal.getScope() != null) {
        eventSubscriptionDeclaration.setConfiguration(signal.getScope());
      }
     
      if (getPrecedingEventBasedGateway(bpmnParse, (IntermediateCatchEvent) bpmnParse.getCurrentFlowElement()) != null) {
        eventSubscriptionDeclaration.setActivityId(activity.getId());
        addEventSubscriptionDeclaration(bpmnParse, eventSubscriptionDeclaration, signalDefinition, activity.getParent());     
      } else {
        activity.setScope(true);
        addEventSubscriptionDeclaration(bpmnParse, eventSubscriptionDeclaration, signalDefinition, activity);  
      }
     
    } else if (bpmnParse.getCurrentFlowElement() instanceof ThrowEvent) {
     
      ThrowEvent throwEvent = (ThrowEvent) bpmnParse.getCurrentFlowElement();
     
      activity.setProperty("type", "intermediateSignalThrow")
      EventSubscriptionDeclaration eventSubscriptionDeclaration = new EventSubscriptionDeclaration(signalDefinition.getSignalRef(), "signal");
      eventSubscriptionDeclaration.setAsync(signalDefinition.isAsync());
     
      activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createIntermediateThrowSignalEventActivityBehavior(throwEvent, signal, eventSubscriptionDeclaration));
     
    } else if (bpmnParse.getCurrentFlowElement() instanceof BoundaryEvent) {
     
      BoundaryEvent boundaryEvent = (BoundaryEvent) bpmnParse.getCurrentFlowElement();
      boolean interrupting = boundaryEvent.isCancelActivity();
      activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createBoundaryEventActivityBehavior(boundaryEvent, interrupting, activity));
     
      activity.setProperty("type", "boundarySignal");
       
      EventSubscriptionDeclaration eventSubscriptionDeclaration = new EventSubscriptionDeclaration(signalDefinition.getSignalRef(), "signal");
      eventSubscriptionDeclaration.setActivityId(activity.getId());
     
      if (signal.getScope() != null) {
        eventSubscriptionDeclaration.setConfiguration(signal.getScope());
      }
     
      addEventSubscriptionDeclaration(bpmnParse, eventSubscriptionDeclaration, signalDefinition, activity.getParent());
       
      if (activity.getParent() instanceof ActivityImpl) {    
View Full Code Here

        for (TableItem item : getItems()) {
          String id = item.getText(0);
          String name = item.getText(1);
          if(StringUtils.isNotEmpty(id) && StringUtils.isNotEmpty(name)) {
           
            Signal newSignal = new Signal();
            newSignal.setId(id);
            newSignal.setName(name);
            newSignalList.add(newSignal);
          }
        }
        model.getBpmnModel().setSignals(newSignalList);
      }
View Full Code Here

TOP

Related Classes of org.activiti.bpmn.model.Signal

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.