mirror of
https://github.com/sartography/bpmn-js-spiffworkflow.git
synced 2025-02-23 04:58:08 +00:00
display message correlations for throw events w/ burnettk cullerton
This commit is contained in:
parent
cac15d7b5f
commit
123e4301c7
@ -28,22 +28,24 @@ export function getMessageRefElement(businessObject) {
|
||||
return '';
|
||||
}
|
||||
|
||||
export function findFormalExpressions(element) {
|
||||
export function findFormalExpressions(businessObject) {
|
||||
const formalExpressions = [];
|
||||
if (element.messageRef) {
|
||||
const root = getRoot(element);
|
||||
const messageRef = getMessageRefElement(businessObject);
|
||||
if (messageRef) {
|
||||
const root = getRoot(businessObject);
|
||||
if (root.$type === 'bpmn:Definitions') {
|
||||
for (const child_element of root.rootElements) {
|
||||
if (child_element.$type === 'bpmn:CorrelationProperty') {
|
||||
const retrieval_expression = processCorrelationProperty(
|
||||
child_element,
|
||||
element.messageRef
|
||||
for (const childElement of root.rootElements) {
|
||||
if (childElement.$type === 'bpmn:CorrelationProperty') {
|
||||
const retrievalExpression = processCorrelationProperty(
|
||||
childElement,
|
||||
messageRef
|
||||
);
|
||||
// todo: is there a better test for this than length === 1?
|
||||
if (retrieval_expression.length === 1) {
|
||||
const formalExpression = {};
|
||||
formalExpression.correlationId = child_element.id;
|
||||
formalExpression.expression = retrieval_expression[0];
|
||||
if (retrievalExpression.length === 1) {
|
||||
const formalExpression = {
|
||||
correlationId: childElement.id,
|
||||
expression: retrievalExpression[0],
|
||||
};
|
||||
formalExpressions.push(formalExpression);
|
||||
}
|
||||
}
|
||||
@ -55,15 +57,15 @@ export function findFormalExpressions(element) {
|
||||
|
||||
function processCorrelationProperty(correlationProperty, message) {
|
||||
const expressions = [];
|
||||
for (const retrieval_expression of correlationProperty.correlationPropertyRetrievalExpression) {
|
||||
for (const retrievalExpression of correlationProperty.correlationPropertyRetrievalExpression) {
|
||||
if (
|
||||
retrieval_expression.$type ===
|
||||
retrievalExpression.$type ===
|
||||
'bpmn:CorrelationPropertyRetrievalExpression' &&
|
||||
retrieval_expression.messageRef &&
|
||||
retrieval_expression.messageRef.id === message.id &&
|
||||
retrieval_expression.messagePath.body
|
||||
retrievalExpression.messageRef &&
|
||||
retrievalExpression.messageRef.id === message.id &&
|
||||
retrievalExpression.messagePath.body
|
||||
) {
|
||||
expressions.push(retrieval_expression.messagePath.body);
|
||||
expressions.push(retrievalExpression.messagePath.body);
|
||||
}
|
||||
}
|
||||
return expressions;
|
||||
|
@ -5,14 +5,7 @@ import {
|
||||
TextAreaEntry,
|
||||
TextFieldEntry,
|
||||
} from '@bpmn-io/properties-panel';
|
||||
import translate from 'diagram-js/lib/i18n/translate';
|
||||
import {
|
||||
findFormalExpressions,
|
||||
getRoot,
|
||||
findCorrelationKeys,
|
||||
} from '../MessageHelpers';
|
||||
import { CorrelationKeysArray } from './CorrelationKeysArray';
|
||||
import dataObject from '../../DataObject';
|
||||
import { findFormalExpressions } from '../MessageHelpers';
|
||||
|
||||
/**
|
||||
* Allows the creation, or editing of messageCorrelations at the bpmn:sendTask level of a BPMN document.
|
||||
@ -21,10 +14,10 @@ export function MessageCorrelationsArray(props) {
|
||||
const { moddle } = props;
|
||||
const { element } = props;
|
||||
const { commandStack } = props;
|
||||
const { elementRegistry } = props;
|
||||
// const { elementRegistry } = props;
|
||||
|
||||
const formalExpressions = findFormalExpressions(element.businessObject);
|
||||
const items = formalExpressions.map((formalExpression, index) => {
|
||||
const items = formalExpressions.map((formalExpression) => {
|
||||
const id = `correlation-${formalExpression.correlationId}`;
|
||||
const entries = MessageCorrelationGroup({
|
||||
idPrefix: id,
|
||||
@ -47,7 +40,6 @@ export function MessageCorrelationsArray(props) {
|
||||
const newElements = formalExpressions;
|
||||
newRetrievalExpression.messageRef = element.businessObject.messageRef;
|
||||
newElements.push(newRetrievalExpression);
|
||||
console.log('element', element);
|
||||
commandStack.execute('element.updateModdleProperties', {
|
||||
element,
|
||||
moddleElement: element.businessObject,
|
||||
@ -101,7 +93,7 @@ function MessageCorrelationTextField(props) {
|
||||
}
|
||||
};
|
||||
|
||||
const getValue = (parameter) => {
|
||||
const getValue = (_parameter) => {
|
||||
return formalExpression.expression;
|
||||
};
|
||||
|
||||
@ -114,33 +106,3 @@ function MessageCorrelationTextField(props) {
|
||||
debounce,
|
||||
});
|
||||
}
|
||||
|
||||
// export function MessageCorrelations(props) {
|
||||
// const shapeElement = props.element;
|
||||
// const { commandStack } = props;
|
||||
// const debounce = useService('debounceInput');
|
||||
// const translate = useService('translate');
|
||||
//
|
||||
// const getValue = () => {
|
||||
// const formalExpressions = findFormalExpressions(shapeElement.businessObject)
|
||||
// return formalExpressions
|
||||
// };
|
||||
//
|
||||
// const setValue = (value) => {
|
||||
// return;
|
||||
// };
|
||||
//
|
||||
//
|
||||
// return (
|
||||
// <TextAreaEntry
|
||||
// id="messageCorrelations"
|
||||
// element={shapeElement}
|
||||
// description="The message correlations"
|
||||
// label="Correlations"
|
||||
// getValue={getValue}
|
||||
// setValue={setValue}
|
||||
// debounce={debounce}
|
||||
// />
|
||||
// );
|
||||
//
|
||||
// }
|
||||
|
Loading…
x
Reference in New Issue
Block a user