mirror of
https://github.com/sartography/bpmn-js-spiffworkflow.git
synced 2025-02-23 21:18:12 +00:00
we can set message variable w/ burnettk cullerton
This commit is contained in:
parent
395004c696
commit
1c5e0630ee
@ -86,6 +86,20 @@ export function findFormalExpressions(shapeElement) {
|
|||||||
return formalExpressions;
|
return formalExpressions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getMessageElementForShapeElement(shapeElement) {
|
||||||
|
const { businessObject } = shapeElement;
|
||||||
|
const taskMessage = getMessageRefElement(shapeElement);
|
||||||
|
const messages = findMessageModdleElements(businessObject);
|
||||||
|
if (taskMessage) {
|
||||||
|
for (const message of messages) {
|
||||||
|
if (message.id === taskMessage.id) {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
function processCorrelationProperty(correlationProperty, message) {
|
function processCorrelationProperty(correlationProperty, message) {
|
||||||
const expressions = [];
|
const expressions = [];
|
||||||
for (const retrievalExpression of correlationProperty.correlationPropertyRetrievalExpression) {
|
for (const retrievalExpression of correlationProperty.correlationPropertyRetrievalExpression) {
|
||||||
|
@ -16,7 +16,6 @@ export function MessageSelect(props) {
|
|||||||
|
|
||||||
const getValue = () => {
|
const getValue = () => {
|
||||||
const messageRefElement = getMessageRefElement(shapeElement);
|
const messageRefElement = getMessageRefElement(shapeElement);
|
||||||
console.log('messageRefElement', messageRefElement);
|
|
||||||
if (messageRefElement) {
|
if (messageRefElement) {
|
||||||
return messageRefElement.id;
|
return messageRefElement.id;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
import { useService } from 'bpmn-js-properties-panel';
|
import { useService } from 'bpmn-js-properties-panel';
|
||||||
import { TextFieldEntry } from '@bpmn-io/properties-panel';
|
import { TextFieldEntry } from '@bpmn-io/properties-panel';
|
||||||
import {
|
import { getMessageElementForShapeElement } from '../MessageHelpers';
|
||||||
findMessageModdleElements,
|
|
||||||
getMessageRefElement,
|
|
||||||
} from '../MessageHelpers';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows the creation, or editing of messageVariable at the bpmn:sendTask level of a BPMN document.
|
* Allows the creation, or editing of messageVariable at the bpmn:sendTask level of a BPMN document.
|
||||||
@ -13,29 +10,22 @@ export function MessageVariable(props) {
|
|||||||
const debounce = useService('debounceInput');
|
const debounce = useService('debounceInput');
|
||||||
|
|
||||||
const getMessageVariableObject = () => {
|
const getMessageVariableObject = () => {
|
||||||
const { businessObject } = shapeElement;
|
const messageElement = getMessageElementForShapeElement(shapeElement);
|
||||||
const taskMessage = getMessageRefElement(shapeElement);
|
if (messageElement) {
|
||||||
const messages = findMessageModdleElements(businessObject);
|
const { extensionElements } = messageElement;
|
||||||
if (taskMessage) {
|
|
||||||
for (const message of messages) {
|
|
||||||
if (message.id === taskMessage.id) {
|
|
||||||
const { extensionElements } = message;
|
|
||||||
if (extensionElements) {
|
if (extensionElements) {
|
||||||
return message.extensionElements
|
return messageElement.extensionElements
|
||||||
.get('values')
|
.get('values')
|
||||||
.filter(function getInstanceOfType(e) {
|
.filter(function getInstanceOfType(e) {
|
||||||
return e.$instanceOf('spiffworkflow:messageVariable');
|
return e.$instanceOf('spiffworkflow:messageVariable');
|
||||||
})[0];
|
})[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getValue = () => {
|
const getValue = () => {
|
||||||
const messageVariableObject = getMessageVariableObject();
|
const messageVariableObject = getMessageVariableObject();
|
||||||
// console.log('messageVariableObject', messageVariableObject);
|
|
||||||
if (messageVariableObject) {
|
if (messageVariableObject) {
|
||||||
return messageVariableObject.messageVariable;
|
return messageVariableObject.messageVariable;
|
||||||
}
|
}
|
||||||
@ -43,19 +33,18 @@ export function MessageVariable(props) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const setValue = (value) => {
|
const setValue = (value) => {
|
||||||
const { businessObject } = shapeElement;
|
|
||||||
let messageVariableObject = getMessageVariableObject();
|
let messageVariableObject = getMessageVariableObject();
|
||||||
// console.log('messageVariableObject', messageVariableObject);
|
|
||||||
if (!messageVariableObject) {
|
if (!messageVariableObject) {
|
||||||
messageVariableObject = businessObject.$model.create(
|
const messageElement = getMessageElementForShapeElement(shapeElement);
|
||||||
|
messageVariableObject = messageElement.$model.create(
|
||||||
'spiffworkflow:messageVariable'
|
'spiffworkflow:messageVariable'
|
||||||
);
|
);
|
||||||
if (!businessObject.extensionElements) {
|
if (!messageElement.extensionElements) {
|
||||||
businessObject.extensionElements = businessObject.$model.create(
|
messageElement.extensionElements = messageElement.$model.create(
|
||||||
'bpmn:ExtensionElements'
|
'bpmn:ExtensionElements'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
businessObject.extensionElements
|
messageElement.extensionElements
|
||||||
.get('values')
|
.get('values')
|
||||||
.push(messageVariableObject);
|
.push(messageVariableObject);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user