org.camunda.bpm.model.bpmn.instance.ErrorEventDefinition Java Examples

The following examples show how to use org.camunda.bpm.model.bpmn.instance.ErrorEventDefinition. 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: ErrorEventDefinitionImpl.java    From camunda-bpmn-model with Apache License 2.0 6 votes vote down vote up
public static void registerType(ModelBuilder modelBuilder) {
  ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ErrorEventDefinition.class, BPMN_ELEMENT_ERROR_EVENT_DEFINITION)
    .namespaceUri(BPMN20_NS)
    .extendsType(EventDefinition.class)
    .instanceProvider(new ModelTypeInstanceProvider<ErrorEventDefinition>() {
      public ErrorEventDefinition newInstance(ModelTypeInstanceContext instanceContext) {
        return new ErrorEventDefinitionImpl(instanceContext);
      }
    });

  errorRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_ERROR_REF)
    .qNameAttributeReference(Error.class)
    .build();
  
  camundaErrorCodeVariableAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_ERROR_CODE_VARIABLE)
      .namespace(CAMUNDA_NS)
      .build();

  camundaErrorMessageVariableAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_ERROR_MESSAGE_VARIABLE)
    .namespace(CAMUNDA_NS)
    .build();
  
  typeBuilder.build();
}
 
Example #2
Source File: ErrorEventDefinitionImpl.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public static void registerType(ModelBuilder modelBuilder) {
  ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(ErrorEventDefinition.class, BPMN_ELEMENT_ERROR_EVENT_DEFINITION)
    .namespaceUri(BPMN20_NS)
    .extendsType(EventDefinition.class)
    .instanceProvider(new ModelTypeInstanceProvider<ErrorEventDefinition>() {
      public ErrorEventDefinition newInstance(ModelTypeInstanceContext instanceContext) {
        return new ErrorEventDefinitionImpl(instanceContext);
      }
    });

  errorRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_ERROR_REF)
    .qNameAttributeReference(Error.class)
    .build();
  
  camundaErrorCodeVariableAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_ERROR_CODE_VARIABLE)
      .namespace(CAMUNDA_NS)
      .build();

  camundaErrorMessageVariableAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_ERROR_MESSAGE_VARIABLE)
    .namespace(CAMUNDA_NS)
    .build();
  
  typeBuilder.build();
}
 
Example #3
Source File: ExternalTaskHandlerIT.java    From camunda-external-task-client-java with Apache License 2.0 5 votes vote down vote up
private void adjustProcessToAddErrorMessageVariable() {
  BoundaryEvent boundaryError = BPMN_ERROR_EXTERNAL_TASK_PROCESS.getModelElementById("catchBPMNError");

  Collection<ErrorEventDefinition> errorDefinitions = boundaryError.getChildElementsByType(ErrorEventDefinition.class);

  ErrorEventDefinition errorDefinition = errorDefinitions.iterator().next();
  errorDefinition.setCamundaErrorMessageVariable("errorMessage");
}
 
Example #4
Source File: AbstractStartEventBuilder.java    From camunda-bpmn-model with Apache License 2.0 5 votes vote down vote up
/**
 * Sets a catch all error definition.
 *
 * @return the builder object
 */
public B error() {
  ErrorEventDefinition errorEventDefinition = createInstance(ErrorEventDefinition.class);
  element.getEventDefinitions().add(errorEventDefinition);

  return myself;
}
 
Example #5
Source File: AbstractStartEventBuilder.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
/**
 * Sets a catch all error definition.
 *
 * @return the builder object
 */
public B error() {
  ErrorEventDefinition errorEventDefinition = createInstance(ErrorEventDefinition.class);
  element.getEventDefinitions().add(errorEventDefinition);

  return myself;
}
 
Example #6
Source File: CamundaExtensionsTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Test
public void testErrorMessageVariable(){
  ErrorEventDefinition errorEventDefinition = startEvent.getChildElementsByType(ErrorEventDefinition.class).iterator().next();
  assertThat(errorEventDefinition.getAttributeValueNs(namespace, CAMUNDA_ATTRIBUTE_ERROR_MESSAGE_VARIABLE)).isEqualTo("errorMessageVariable");
}
 
Example #7
Source File: CamundaExtensionsTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Test
public void testErrorCodeVariable(){
  ErrorEventDefinition errorEventDefinition = startEvent.getChildElementsByType(ErrorEventDefinition.class).iterator().next();
  assertThat(errorEventDefinition.getAttributeValueNs(namespace, CAMUNDA_ATTRIBUTE_ERROR_CODE_VARIABLE)).isEqualTo("errorVariable");
}
 
Example #8
Source File: AbstractErrorEventDefinitionBuilder.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public AbstractErrorEventDefinitionBuilder(BpmnModelInstance modelInstance, ErrorEventDefinition element, Class<?> selfType) {
  super(modelInstance, element, selfType);
}
 
Example #9
Source File: ErrorEventDefinitionBuilder.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public ErrorEventDefinitionBuilder(BpmnModelInstance modelInstance, ErrorEventDefinition element) {
  super(modelInstance, element, ErrorEventDefinitionBuilder.class);
}
 
Example #10
Source File: CamundaExtensionsTest.java    From camunda-bpmn-model with Apache License 2.0 4 votes vote down vote up
@Test
public void testErrorMessageVariable(){
  ErrorEventDefinition errorEventDefinition = startEvent.getChildElementsByType(ErrorEventDefinition.class).iterator().next();
  assertThat(errorEventDefinition.getAttributeValueNs(namespace, CAMUNDA_ATTRIBUTE_ERROR_MESSAGE_VARIABLE)).isEqualTo("errorMessageVariable");
}
 
Example #11
Source File: CamundaExtensionsTest.java    From camunda-bpmn-model with Apache License 2.0 4 votes vote down vote up
@Test
public void testErrorCodeVariable(){
  ErrorEventDefinition errorEventDefinition = startEvent.getChildElementsByType(ErrorEventDefinition.class).iterator().next();
  assertThat(errorEventDefinition.getAttributeValueNs(namespace, CAMUNDA_ATTRIBUTE_ERROR_CODE_VARIABLE)).isEqualTo("errorVariable");
}
 
Example #12
Source File: AbstractErrorEventDefinitionBuilder.java    From camunda-bpmn-model with Apache License 2.0 4 votes vote down vote up
public AbstractErrorEventDefinitionBuilder(BpmnModelInstance modelInstance, ErrorEventDefinition element, Class<?> selfType) {
  super(modelInstance, element, selfType);
}
 
Example #13
Source File: ErrorEventDefinitionBuilder.java    From camunda-bpmn-model with Apache License 2.0 4 votes vote down vote up
public ErrorEventDefinitionBuilder(BpmnModelInstance modelInstance, ErrorEventDefinition element) {
  super(modelInstance, element, ErrorEventDefinitionBuilder.class);
}
 
Example #14
Source File: AbstractEndEventBuilder.java    From camunda-bpm-platform with Apache License 2.0 3 votes vote down vote up
/**
 * Sets an error definition for the given error code. If already an error
 * with this code exists it will be used, otherwise a new error is created
 * with the given errorMessage.
 *
 * @param errorCode the code of the error
 * @param errorMessage the error message that is used when a new error needs
 *        to be created
 * @return the builder object
 */
public B error(String errorCode, String errorMessage) {
  ErrorEventDefinition errorEventDefinition = createErrorEventDefinition(errorCode, errorMessage);
  element.getEventDefinitions().add(errorEventDefinition);
  
  return myself;
}
 
Example #15
Source File: AbstractStartEventBuilder.java    From camunda-bpm-platform with Apache License 2.0 3 votes vote down vote up
/**
 * Sets an error definition for the given error code. If already an error
 * with this code exists it will be used, otherwise a new error is created
 * with the given errorMessage.
 *
 * @param errorCode the code of the error
 * @param errorMessage the error message that is used when a new error needs
 *        to be created
 * @return the builder object
 */
public B error(String errorCode, String errorMessage) {
  ErrorEventDefinition errorEventDefinition = createErrorEventDefinition(errorCode, errorMessage);
  element.getEventDefinitions().add(errorEventDefinition);
  
  return myself;
}
 
Example #16
Source File: AbstractStartEventBuilder.java    From camunda-bpmn-model with Apache License 2.0 3 votes vote down vote up
/**
 * Sets an error definition for the given error code. If already an error
 * with this code exists it will be used, otherwise a new error is created
 * with the given errorMessage.
 *
 * @param errorCode the code of the error
 * @param errorMessage the error message that is used when a new error needs
 *        to be created
 * @return the builder object
 */
public B error(String errorCode, String errorMessage) {
  ErrorEventDefinition errorEventDefinition = createErrorEventDefinition(errorCode, errorMessage);
  element.getEventDefinitions().add(errorEventDefinition);
  
  return myself;
}
 
Example #17
Source File: AbstractEndEventBuilder.java    From camunda-bpmn-model with Apache License 2.0 3 votes vote down vote up
/**
 * Sets an error definition for the given error code. If already an error
 * with this code exists it will be used, otherwise a new error is created
 * with the given errorMessage.
 *
 * @param errorCode the code of the error
 * @param errorMessage the error message that is used when a new error needs
 *        to be created
 * @return the builder object
 */
public B error(String errorCode, String errorMessage) {
  ErrorEventDefinition errorEventDefinition = createErrorEventDefinition(errorCode, errorMessage);
  element.getEventDefinitions().add(errorEventDefinition);
  
  return myself;
}