Determine whether the microflow was called as an Entity event or by other means

I’m developing the custom java action called “Commit without SOME events”. It commits the passed object and suppresses certain event handler microflows by calling ListenersRegistry#addListener()) and analyzing the action stack.   The requirement is to suppress event microflows fired directly by Core#commit())  from my custom java action or SUB-microflows called by those event handlers. However, if an event microflow commits another object itself the event handlers must not be suppressed.   I thought that the action stack would contain something like “Commit Action” so I could check if the Commit action is called by my custom java action and make the decision. Apparently, there’s no such action in the stack. Instead, there’s one or two com.mendix.basis.actionmanagement.SyncEventExtendedAction in between and the same SyncEventExtendedAction is pushed to stack between  caller microflows and SUB-microflows.   It’s quite inconvenient. I think I’ll have to resort to analyzing java stack trace instead of Action Stack. I’m going to look for the nearest InternalCore.commit. If it's called like this: at com.mendix.basis.component.InternalCore.commit(InternalCore.scala:21) at com.mendix.core.Core.commit( at sncommitwithoutsomeevents.actions.CommitWithoutSomeEvents.executeAction( Then it’s called by my custom java action. Otherwise, for instance: at com.mendix.basis.component.InternalCore.commit(InternalCore.scala:21) at com.mendix.modules.microflowengine.actions.mxobject.ChangeItemsExecutor.executeChanges(ChangeItemsExecutor.scala:34) means that it’s not my java action
0 answers