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

The following examples show how to use org.camunda.bpm.model.bpmn.instance.FlowElement. 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: AbstractServiceTaskHandleDelegate.java    From wecube-platform with Apache License 2.0 6 votes vote down vote up
protected List<String> tryCalAllowedOptions(DelegateExecution execution) {
    List<String> allowedOptions = new ArrayList<>();
    FlowElement flowElement = execution.getBpmnModelElementInstance();
    ModelElementInstance parentEi = flowElement.getParentElement();
    if (parentEi != null) {
        SubProcess subProcess = execution.getBpmnModelInstance()
                .getModelElementById(parentEi.getAttributeValue("id"));

        List<ExclusiveGateway> exGws = subProcess.getSucceedingNodes().filterByType(ExclusiveGateway.class).list();
        if (exGws.size() == 1) {
            Collection<SequenceFlow> sfs = exGws.get(0).getOutgoing();
            if (!sfs.isEmpty()) {
                for (SequenceFlow sf : sfs) {
                    getLogger().debug("add sequence name: {}", sf.getName());
                    allowedOptions.add(sf.getName());
                }
            }
        }
    }

    return allowedOptions;
}
 
Example #2
Source File: ExecutionEntity.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public FlowElement getBpmnModelElementInstance() {
  BpmnModelInstance bpmnModelInstance = getBpmnModelInstance();
  if (bpmnModelInstance != null) {

    ModelElementInstance modelElementInstance = null;
    if (ExecutionListener.EVENTNAME_TAKE.equals(eventName)) {
      modelElementInstance = bpmnModelInstance.getModelElementById(transition.getId());
    } else {
      modelElementInstance = bpmnModelInstance.getModelElementById(activityId);
    }

    try {
      return (FlowElement) modelElementInstance;

    } catch (ClassCastException e) {
      ModelElementType elementType = modelElementInstance.getElementType();
      throw LOG.castModelInstanceException(modelElementInstance, "FlowElement", elementType.getTypeName(),
        elementType.getTypeNamespace(), e);
    }

  } else {
    return null;
  }
}
 
Example #3
Source File: DataObjectImpl.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(DataObject.class, BPMN_ELEMENT_DATA_OBJECT)
    .namespaceUri(BPMN20_NS)
    .extendsType(FlowElement.class)
    .instanceProvider(new ModelTypeInstanceProvider<DataObject>() {
      public DataObject newInstance(ModelTypeInstanceContext instanceContext) {
        return new DataObjectImpl(instanceContext);
      }
    });

  itemSubjectRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_ITEM_SUBJECT_REF)
    .qNameAttributeReference(ItemDefinition.class)
    .build();

  isCollectionAttribute = typeBuilder.booleanAttribute(BPMN_ATTRIBUTE_IS_COLLECTION)
    .defaultValue(false)
    .build();

  SequenceBuilder sequenceBuilder = typeBuilder.sequence();

  dataStateChild = sequenceBuilder.element(DataState.class)
    .build();

  typeBuilder.build();
}
 
Example #4
Source File: DataObjectReferenceImpl.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(DataObjectReference.class, BPMN_ELEMENT_DATA_OBJECT_REFERENCE)
    .namespaceUri(BPMN20_NS)
    .extendsType(FlowElement.class)
    .instanceProvider(new ModelElementTypeBuilder.ModelTypeInstanceProvider<DataObjectReference>() {
      public DataObjectReference newInstance(ModelTypeInstanceContext instanceContext) {
        return new DataObjectReferenceImpl(instanceContext);
      }
    });

  itemSubjectRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_ITEM_SUBJECT_REF)
    .qNameAttributeReference(ItemDefinition.class)
    .build();

  dataObjectRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_DATA_OBJECT_REF)
    .idAttributeReference(DataObject.class)
    .build();

  SequenceBuilder sequenceBuilder = typeBuilder.sequence();

  dataStateChild = sequenceBuilder.element(DataState.class)
    .build();

  typeBuilder.build();
}
 
Example #5
Source File: DataObjectImpl.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(DataObject.class, BPMN_ELEMENT_DATA_OBJECT)
    .namespaceUri(BPMN20_NS)
    .extendsType(FlowElement.class)
    .instanceProvider(new ModelTypeInstanceProvider<DataObject>() {
      public DataObject newInstance(ModelTypeInstanceContext instanceContext) {
        return new DataObjectImpl(instanceContext);
      }
    });

  itemSubjectRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_ITEM_SUBJECT_REF)
    .qNameAttributeReference(ItemDefinition.class)
    .build();

  isCollectionAttribute = typeBuilder.booleanAttribute(BPMN_ATTRIBUTE_IS_COLLECTION)
    .defaultValue(false)
    .build();

  SequenceBuilder sequenceBuilder = typeBuilder.sequence();

  dataStateChild = sequenceBuilder.element(DataState.class)
    .build();

  typeBuilder.build();
}
 
Example #6
Source File: DataObjectReferenceImpl.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(DataObjectReference.class, BPMN_ELEMENT_DATA_OBJECT_REFERENCE)
    .namespaceUri(BPMN20_NS)
    .extendsType(FlowElement.class)
    .instanceProvider(new ModelElementTypeBuilder.ModelTypeInstanceProvider<DataObjectReference>() {
      public DataObjectReference newInstance(ModelTypeInstanceContext instanceContext) {
        return new DataObjectReferenceImpl(instanceContext);
      }
    });

  itemSubjectRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_ITEM_SUBJECT_REF)
    .qNameAttributeReference(ItemDefinition.class)
    .build();

  dataObjectRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_DATA_OBJECT_REF)
    .idAttributeReference(DataObject.class)
    .build();

  SequenceBuilder sequenceBuilder = typeBuilder.sequence();

  dataStateChild = sequenceBuilder.element(DataState.class)
    .build();

  typeBuilder.build();
}
 
Example #7
Source File: SequenceFlowImpl.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(SequenceFlow.class, BPMN_ELEMENT_SEQUENCE_FLOW)
    .namespaceUri(BPMN20_NS)
    .extendsType(FlowElement.class)
    .instanceProvider(new ModelTypeInstanceProvider<SequenceFlow>() {
      public SequenceFlow newInstance(ModelTypeInstanceContext instanceContext) {
        return new SequenceFlowImpl(instanceContext);
      }
    });

  sourceRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_SOURCE_REF)
    .required()
    .idAttributeReference(FlowNode.class)
    .build();

  targetRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_TARGET_REF)
    .required()
    .idAttributeReference(FlowNode.class)
    .build();

  isImmediateAttribute = typeBuilder.booleanAttribute(BPMN_ATTRIBUTE_IS_IMMEDIATE)
    .build();

  SequenceBuilder sequenceBuilder = typeBuilder.sequence();

  conditionExpressionCollection = sequenceBuilder.element(ConditionExpression.class)
    .build();

  typeBuilder.build();
}
 
Example #8
Source File: FlowNodeImpl.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(FlowNode.class, BPMN_ELEMENT_FLOW_NODE)
    .namespaceUri(BPMN20_NS)
    .extendsType(FlowElement.class)
    .abstractType();

  SequenceBuilder sequenceBuilder = typeBuilder.sequence();

  incomingCollection = sequenceBuilder.elementCollection(Incoming.class)
    .qNameElementReferenceCollection(SequenceFlow.class)
    .build();

  outgoingCollection = sequenceBuilder.elementCollection(Outgoing.class)
    .qNameElementReferenceCollection(SequenceFlow.class)
    .build();

  /** Camunda Attributes */

  camundaAsyncAfter = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_ASYNC_AFTER)
    .namespace(CAMUNDA_NS)
    .defaultValue(false)
    .build();

  camundaAsyncBefore = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_ASYNC_BEFORE)
    .namespace(CAMUNDA_NS)
    .defaultValue(false)
    .build();

  camundaExclusive = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_EXCLUSIVE)
    .namespace(CAMUNDA_NS)
    .defaultValue(true)
    .build();

  camundaJobPriority = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_JOB_PRIORITY)
     .namespace(CAMUNDA_NS)
     .build();

  typeBuilder.build();
}
 
Example #9
Source File: SequenceFlowImpl.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(SequenceFlow.class, BPMN_ELEMENT_SEQUENCE_FLOW)
    .namespaceUri(BPMN20_NS)
    .extendsType(FlowElement.class)
    .instanceProvider(new ModelTypeInstanceProvider<SequenceFlow>() {
      public SequenceFlow newInstance(ModelTypeInstanceContext instanceContext) {
        return new SequenceFlowImpl(instanceContext);
      }
    });

  sourceRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_SOURCE_REF)
    .required()
    .idAttributeReference(FlowNode.class)
    .build();

  targetRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_TARGET_REF)
    .required()
    .idAttributeReference(FlowNode.class)
    .build();

  isImmediateAttribute = typeBuilder.booleanAttribute(BPMN_ATTRIBUTE_IS_IMMEDIATE)
    .build();

  SequenceBuilder sequenceBuilder = typeBuilder.sequence();

  conditionExpressionCollection = sequenceBuilder.element(ConditionExpression.class)
    .build();

  typeBuilder.build();
}
 
Example #10
Source File: FlowNodeImpl.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(FlowNode.class, BPMN_ELEMENT_FLOW_NODE)
    .namespaceUri(BPMN20_NS)
    .extendsType(FlowElement.class)
    .abstractType();

  SequenceBuilder sequenceBuilder = typeBuilder.sequence();

  incomingCollection = sequenceBuilder.elementCollection(Incoming.class)
    .qNameElementReferenceCollection(SequenceFlow.class)
    .build();

  outgoingCollection = sequenceBuilder.elementCollection(Outgoing.class)
    .qNameElementReferenceCollection(SequenceFlow.class)
    .build();

  /** Camunda Attributes */

  camundaAsyncAfter = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_ASYNC_AFTER)
    .namespace(CAMUNDA_NS)
    .defaultValue(false)
    .build();

  camundaAsyncBefore = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_ASYNC_BEFORE)
    .namespace(CAMUNDA_NS)
    .defaultValue(false)
    .build();

  camundaExclusive = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_EXCLUSIVE)
    .namespace(CAMUNDA_NS)
    .defaultValue(true)
    .build();

  camundaJobPriority = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_JOB_PRIORITY)
     .namespace(CAMUNDA_NS)
     .build();

  typeBuilder.build();
}
 
Example #11
Source File: BpmnElementRetrievalDelegate.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public FlowElement getBpmnModelElementInstance() {
  return bpmnModelElementInstance;
}
 
Example #12
Source File: DelegateEvent.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public FlowElement getBpmnModelElementInstance() {
  throw notYetImplemented();
}
 
Example #13
Source File: ExecutionImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public FlowElement getBpmnModelElementInstance() {
  throw new UnsupportedOperationException(BpmnModelExecutionContext.class.getName() +" is unsupported in transient ExecutionImpl");
}
 
Example #14
Source File: DelegateExecutionFake.java    From camunda-bpm-mockito with Apache License 2.0 4 votes vote down vote up
@Override
public FlowElement getBpmnModelElementInstance() {
  return flowElement;
}
 
Example #15
Source File: SuspendedExecutionImpl.java    From camunda-bpm-workbench with GNU Affero General Public License v3.0 4 votes vote down vote up
public FlowElement getBpmnModelElementInstance() {
  return executionEntity.getBpmnModelElementInstance();
}
 
Example #16
Source File: SelectorBuilder.java    From camunda-bpm-reactor with Apache License 2.0 4 votes vote down vote up
static String extractTypeName(BpmnModelExecutionContext bpmnModelExecutionContext) {
  FlowElement bpmnModelElementInstance = bpmnModelExecutionContext.getBpmnModelElementInstance();
  return bpmnModelElementInstance.getElementType().getTypeName();
}
 
Example #17
Source File: BpmnModelExecutionContext.java    From camunda-bpm-platform with Apache License 2.0 2 votes vote down vote up
/**
 * <p>Returns the currently executed Element in the BPMN Model. This method returns a {@link FlowElement} which may be casted
 * to the concrete type of the Bpmn Model Element currently executed.</p>
 *
 * <p>If called from a Service {@link ExecutionListener}, the method will return the corresponding {@link FlowNode}
 * for {@link ExecutionListener#EVENTNAME_START} and {@link ExecutionListener#EVENTNAME_END} and the corresponding
 * {@link SequenceFlow} for {@link ExecutionListener#EVENTNAME_TAKE}.</p>
 *
 * @return the {@link FlowElement} corresponding to the current Bpmn Model Element
 */
FlowElement getBpmnModelElementInstance();