02-22-2020 03:00 AM
I am trying to use intermididate catching event in my process definition, but only want to signal it based on condition. I can see signalExpression is there inside catching event but bpmn modelere is not allowing me to use this.
I posted similar question os stack overflow https://stackoverflow.com/questions/60350138/signalexpression-in-activiti-6-0-intermediate-catching-...
Can someone help.
02-28-2020 10:05 AM
Hi,
Clearly the signal expression is not a standard BPMN and is an extension. To make it work this is what I had to do.
BpmnXMLConverter.addConverter(new CatchEventXMLConverter() { @Override protected void writeSignalDefinition(Event parentEvent, SignalEventDefinition signalDefinition, XMLStreamWriter xtw) throws Exception { xtw.writeStartElement(ELEMENT_EVENT_SIGNALDEFINITION); writeDefaultAttribute("activiti:"+ATTRIBUTE_SIGNAL_EXPRESSION, signalDefinition.getSignalExpression(), xtw); if (parentEvent instanceof ThrowEvent && signalDefinition.isAsync()) { BpmnXMLUtil.writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_ASYNCHRONOUS, "true", xtw); } boolean didWriteExtensionStartElement = BpmnXMLUtil.writeExtensionElements(signalDefinition, false, xtw); if (didWriteExtensionStartElement) { xtw.writeEndElement(); } xtw.writeEndElement(); } });
getProcessEngineConfiguration()) .setActivityBehaviorFactory(new DefaultActivityBehaviorFactory() { @Override public IntermediateCatchSignalEventActivityBehavior createIntermediateCatchSignalEventActivityBehavior( IntermediateCatchEvent intermediateCatchEvent, SignalEventDefinition signalEventDefinition, Signal signal) { return new IntermediateCatchSignalEventActivityBehavior(signalEventDefinition, signal) { private static final long serialVersionUID = 1L; @Override public void execute(DelegateExecution execution) { CommandContext commandContext = Context.getCommandContext(); ExecutionEntity executionEntity = (ExecutionEntity) execution; String signalName = null; Expression signalExpression = commandContext.getProcessEngineConfiguration().getExpressionManager() .createExpression(signalEventDefinition.getSignalExpression()); signalName = signalExpression.getValue(execution).toString(); commandContext.getEventSubscriptionEntityManager().insertSignalEvent(signalName, signal, executionEntity); } }; } })
Thanks
-Vishal
02-24-2020 04:26 AM
Hi @vgaur,
I see on Stack that someone chipped in - looks like you have resolved your issue? If so, it would be great if you could update this post with how you resolved your problem.
Many thanks,
02-28-2020 10:05 AM
Hi,
Clearly the signal expression is not a standard BPMN and is an extension. To make it work this is what I had to do.
BpmnXMLConverter.addConverter(new CatchEventXMLConverter() { @Override protected void writeSignalDefinition(Event parentEvent, SignalEventDefinition signalDefinition, XMLStreamWriter xtw) throws Exception { xtw.writeStartElement(ELEMENT_EVENT_SIGNALDEFINITION); writeDefaultAttribute("activiti:"+ATTRIBUTE_SIGNAL_EXPRESSION, signalDefinition.getSignalExpression(), xtw); if (parentEvent instanceof ThrowEvent && signalDefinition.isAsync()) { BpmnXMLUtil.writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_ASYNCHRONOUS, "true", xtw); } boolean didWriteExtensionStartElement = BpmnXMLUtil.writeExtensionElements(signalDefinition, false, xtw); if (didWriteExtensionStartElement) { xtw.writeEndElement(); } xtw.writeEndElement(); } });
getProcessEngineConfiguration()) .setActivityBehaviorFactory(new DefaultActivityBehaviorFactory() { @Override public IntermediateCatchSignalEventActivityBehavior createIntermediateCatchSignalEventActivityBehavior( IntermediateCatchEvent intermediateCatchEvent, SignalEventDefinition signalEventDefinition, Signal signal) { return new IntermediateCatchSignalEventActivityBehavior(signalEventDefinition, signal) { private static final long serialVersionUID = 1L; @Override public void execute(DelegateExecution execution) { CommandContext commandContext = Context.getCommandContext(); ExecutionEntity executionEntity = (ExecutionEntity) execution; String signalName = null; Expression signalExpression = commandContext.getProcessEngineConfiguration().getExpressionManager() .createExpression(signalEventDefinition.getSignalExpression()); signalName = signalExpression.getValue(execution).toString(); commandContext.getEventSubscriptionEntityManager().insertSignalEvent(signalName, signal, executionEntity); } }; } })
Thanks
-Vishal
03-02-2020 04:39 AM
Hi @vgaur,
Thanks for posting your solution - really helpful to other hub members.
Kind regards,
Explore our Alfresco products with the links below. Use labels to filter content by product module.