mirror of
https://github.com/sartography/bpmn-js-spiffworkflow.git
synced 2025-02-23 13:08:11 +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;
|
||||
}
|
||||
|
||||
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) {
|
||||
const expressions = [];
|
||||
for (const retrievalExpression of correlationProperty.correlationPropertyRetrievalExpression) {
|
||||
|
@ -16,7 +16,6 @@ export function MessageSelect(props) {
|
||||
|
||||
const getValue = () => {
|
||||
const messageRefElement = getMessageRefElement(shapeElement);
|
||||
console.log('messageRefElement', messageRefElement);
|
||||
if (messageRefElement) {
|
||||
return messageRefElement.id;
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
import { useService } from 'bpmn-js-properties-panel';
|
||||
import { TextFieldEntry } from '@bpmn-io/properties-panel';
|
||||
import {
|
||||
findMessageModdleElements,
|
||||
getMessageRefElement,
|
||||
} from '../MessageHelpers';
|
||||
import { getMessageElementForShapeElement } from '../MessageHelpers';
|
||||
|
||||
/**
|
||||
* Allows the creation, or editing of messageVariable at the bpmn:sendTask level of a BPMN document.
|
||||
@ -13,21 +10,15 @@ export function MessageVariable(props) {
|
||||
const debounce = useService('debounceInput');
|
||||
|
||||
const getMessageVariableObject = () => {
|
||||
const { businessObject } = shapeElement;
|
||||
const taskMessage = getMessageRefElement(shapeElement);
|
||||
const messages = findMessageModdleElements(businessObject);
|
||||
if (taskMessage) {
|
||||
for (const message of messages) {
|
||||
if (message.id === taskMessage.id) {
|
||||
const { extensionElements } = message;
|
||||
if (extensionElements) {
|
||||
return message.extensionElements
|
||||
.get('values')
|
||||
.filter(function getInstanceOfType(e) {
|
||||
return e.$instanceOf('spiffworkflow:messageVariable');
|
||||
})[0];
|
||||
}
|
||||
}
|
||||
const messageElement = getMessageElementForShapeElement(shapeElement);
|
||||
if (messageElement) {
|
||||
const { extensionElements } = messageElement;
|
||||
if (extensionElements) {
|
||||
return messageElement.extensionElements
|
||||
.get('values')
|
||||
.filter(function getInstanceOfType(e) {
|
||||
return e.$instanceOf('spiffworkflow:messageVariable');
|
||||
})[0];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -35,7 +26,6 @@ export function MessageVariable(props) {
|
||||
|
||||
const getValue = () => {
|
||||
const messageVariableObject = getMessageVariableObject();
|
||||
// console.log('messageVariableObject', messageVariableObject);
|
||||
if (messageVariableObject) {
|
||||
return messageVariableObject.messageVariable;
|
||||
}
|
||||
@ -43,19 +33,18 @@ export function MessageVariable(props) {
|
||||
};
|
||||
|
||||
const setValue = (value) => {
|
||||
const { businessObject } = shapeElement;
|
||||
let messageVariableObject = getMessageVariableObject();
|
||||
// console.log('messageVariableObject', messageVariableObject);
|
||||
if (!messageVariableObject) {
|
||||
messageVariableObject = businessObject.$model.create(
|
||||
const messageElement = getMessageElementForShapeElement(shapeElement);
|
||||
messageVariableObject = messageElement.$model.create(
|
||||
'spiffworkflow:messageVariable'
|
||||
);
|
||||
if (!businessObject.extensionElements) {
|
||||
businessObject.extensionElements = businessObject.$model.create(
|
||||
if (!messageElement.extensionElements) {
|
||||
messageElement.extensionElements = messageElement.$model.create(
|
||||
'bpmn:ExtensionElements'
|
||||
);
|
||||
}
|
||||
businessObject.extensionElements
|
||||
messageElement.extensionElements
|
||||
.get('values')
|
||||
.push(messageVariableObject);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user