org.camunda.bpm.model.bpmn.GatewayDirection Java Examples

The following examples show how to use org.camunda.bpm.model.bpmn.GatewayDirection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GatewayImpl.java    From camunda-bpmn-model with Apache License 2.0 5 votes vote down vote up
public static void registerType(ModelBuilder modelBuilder) {
  ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Gateway.class, BPMN_ELEMENT_GATEWAY)
    .namespaceUri(BPMN20_NS)
    .extendsType(FlowNode.class)
    .abstractType();

  gatewayDirectionAttribute = typeBuilder.enumAttribute(BPMN_ATTRIBUTE_GATEWAY_DIRECTION, GatewayDirection.class)
    .defaultValue(GatewayDirection.Unspecified)
    .build();

  typeBuilder.build();
}
 
Example #2
Source File: AbstractGatewayTest.java    From camunda-bpmn-model with Apache License 2.0 5 votes vote down vote up
@Before
@SuppressWarnings("unchecked")
public void getGateway() {
  InputStream inputStream = ReflectUtil.getResourceAsStream("org/camunda/bpm/model/bpmn/GatewaysTest.xml");
  Collection<ModelElementInstance> elementInstances = Bpmn.readModelFromStream(inputStream).getModelElementsByType(modelElementType);
  assertThat(elementInstances).hasSize(1);
  gateway = (G) elementInstances.iterator().next();
  assertThat(gateway.getGatewayDirection()).isEqualTo(GatewayDirection.Mixed);
}
 
Example #3
Source File: GatewayImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public static void registerType(ModelBuilder modelBuilder) {
  ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Gateway.class, BPMN_ELEMENT_GATEWAY)
    .namespaceUri(BPMN20_NS)
    .extendsType(FlowNode.class)
    .abstractType();

  gatewayDirectionAttribute = typeBuilder.enumAttribute(BPMN_ATTRIBUTE_GATEWAY_DIRECTION, GatewayDirection.class)
    .defaultValue(GatewayDirection.Unspecified)
    .build();

  typeBuilder.build();
}
 
Example #4
Source File: AbstractGatewayTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Before
@SuppressWarnings("unchecked")
public void getGateway() {
  InputStream inputStream = ReflectUtil.getResourceAsStream("org/camunda/bpm/model/bpmn/GatewaysTest.xml");
  Collection<ModelElementInstance> elementInstances = Bpmn.readModelFromStream(inputStream).getModelElementsByType(modelElementType);
  assertThat(elementInstances).hasSize(1);
  gateway = (G) elementInstances.iterator().next();
  assertThat(gateway.getGatewayDirection()).isEqualTo(GatewayDirection.Mixed);
}
 
Example #5
Source File: BpmnProcessModelCustomizer.java    From wecube-platform with Apache License 2.0 4 votes vote down vote up
protected void supplementSubProcess(SubProcess subProc) {
    String subProcId = subProc.getId();

    String userTaskId = "exceptSubUT-" + subProcId;
    String srvBeanServiceTaskId = String.format("srvBeanST-%s", subProcId);
    String actRetryExpr = String.format("${ act_%s == 'retry' }", subProcId);
    String actSkipExpr = String.format("${ act_%s == 'skip' }", subProcId);
    String catchEventId = subProcId + "_ice1";
    String signalId = subProcId + "_sig1";
    String retCodeOkExpr = String.format("${retCode_%s != '1'}", catchEventId);
    String retCodeNotOkExpr = String.format("${retCode_%s == '1'}", catchEventId);

    StartEventBuilder b = subProc.builder().embeddedSubProcess().startEvent(subProcId + "_startEvent1")
            .name("St1_" + subProcId);
    EndEventBuilder eb = b.serviceTask(srvBeanServiceTaskId).name("T1_" + subProcId) //
            .eventBasedGateway().name("EGW1_" + subProcId) //
            .intermediateCatchEvent(catchEventId).name("ICE1_" + subProcId) //
            .signal(signalId) //
            .exclusiveGateway().gatewayDirection(GatewayDirection.Diverging) //
            .condition("con1", retCodeOkExpr) //
            .endEvent(subProcId + "_endEvent1").name("End1_" + subProcId) //
            .moveToLastGateway() //
            .condition("con2", retCodeNotOkExpr) //
            .serviceTask("srvFailBeanST-" + subProcId) //
            .name("SRV-FAIL-HANDLER_" + subProcId).camundaDelegateExpression("${srvFailBean}") //
            .userTask(userTaskId).name("EXCEPTION-HANDLER_" + subProcId) //
            .condition("con4", actRetryExpr) //
            .connectTo(srvBeanServiceTaskId) //
            .moveToActivity(userTaskId) //
            .condition("con3", actSkipExpr) //
            .endEvent().name("End2_" + subProcId);

    String subProcessTimeoutExpr = getSubProcessTimeoutExpression(subProc);
    if (StringUtils.isNotBlank(subProcessTimeoutExpr)) {
        AbstractFlowNodeBuilder<?, ?> ab = eb.moveToLastGateway().moveToLastGateway()
                .intermediateCatchEvent(subProcId + "_time1").timerWithDuration(subProcessTimeoutExpr)
                .serviceTask("srvTimeOutBeanST-" + subProcId).name("SRV-TIMEOUT-HANDLER_" + subProcId)
                .camundaDelegateExpression("${srvTimeoutBean}").connectTo(userTaskId);
        ab.done();
    } else {
        eb.done();
    }

}
 
Example #6
Source File: GatewayImpl.java    From camunda-bpmn-model with Apache License 2.0 4 votes vote down vote up
public GatewayDirection getGatewayDirection() {
  return gatewayDirectionAttribute.getValue(this);
}
 
Example #7
Source File: GatewayImpl.java    From camunda-bpmn-model with Apache License 2.0 4 votes vote down vote up
public void setGatewayDirection(GatewayDirection gatewayDirection) {
  gatewayDirectionAttribute.setValue(this, gatewayDirection);
}
 
Example #8
Source File: GatewayTest.java    From camunda-bpmn-model with Apache License 2.0 4 votes vote down vote up
public Collection<AttributeAssumption> getAttributesAssumptions() {
  return Arrays.asList(
    new AttributeAssumption("gatewayDirection", false, false, GatewayDirection.Unspecified)
  );
}
 
Example #9
Source File: GatewayImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public GatewayDirection getGatewayDirection() {
  return gatewayDirectionAttribute.getValue(this);
}
 
Example #10
Source File: GatewayImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void setGatewayDirection(GatewayDirection gatewayDirection) {
  gatewayDirectionAttribute.setValue(this, gatewayDirection);
}
 
Example #11
Source File: GatewayTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public Collection<AttributeAssumption> getAttributesAssumptions() {
  return Arrays.asList(
    new AttributeAssumption("gatewayDirection", false, false, GatewayDirection.Unspecified)
  );
}
 
Example #12
Source File: Gateway.java    From camunda-bpmn-model with Apache License 2.0 votes vote down vote up
GatewayDirection getGatewayDirection(); 
Example #13
Source File: Gateway.java    From camunda-bpmn-model with Apache License 2.0 votes vote down vote up
void setGatewayDirection(GatewayDirection gatewayDirection); 
Example #14
Source File: Gateway.java    From camunda-bpm-platform with Apache License 2.0 votes vote down vote up
GatewayDirection getGatewayDirection(); 
Example #15
Source File: Gateway.java    From camunda-bpm-platform with Apache License 2.0 votes vote down vote up
void setGatewayDirection(GatewayDirection gatewayDirection);