BDM Unique Constraint for Active Processes only



I have a process in which each process instance has a BDM object associated with it. If a process has started with a BDM object, I want to prevent users from being able to start another process using the same object as the existing process. If I use a unique constraint on the ID field of my BDM object, users are prevented from ever being able to start a process using an object that was used in the past, which is not what I want. I only want to ensure that a process cannot be started using an object that is being used in an active process.

I know I can accomplish this by getting all active process instances, then looping through each instance, get the execution context for each instance, then get the BDM data reference object, call the object dao to get the object, and finally check if the current process a user is attempting to start requires the same object, but this seems very indirect and inefficient.

Perhaps there is a way to easily associate an ID with a process instance?

I like the concept of "Process Variables" or "Search Keys" but see no way of exposing these through the Java API.

I'd greatly appreciate any ideas.


No answers yet.