An instance of the InstanceFilter component defines a set of conditions to search for process instances.
To create an instance of InstanceFilter, you need to pass an instance of ProcessService (or ClientProcessService) to the InstanceFilter.create() method.
To search for process instances matching the criteria defined by an InstanceFilter object, use method getInstancesByFilter() of ProcessService (and ClientProcessService).
You can also obtain instances of InstanceFilter using ProcessService's getFilterFor(viewId) method, which returns an InstanceFilter object representing the conditions defined by a particular View.
The following example uses InstanceFilter to retrieve those process instances that are in-process (that is, not aborted nor completed) and are assigned to a participant "test":
do
connectTo ProcessService
using url = Fuego.Server.directoryURL,
user = "test", password = "password"
create InstanceFilter
using processService = ProcessService
InstanceFilter.searchScope = SearchScope(
participantScope : ParticipantScope.PARTICIPANT ,
statusScope : StatusScope.ONLY_INPROCESS)
instances = getInstancesByFilter(ProcessService,
filter : InstanceFilter)
return instances
on exit
disconnectFrom ProcessService
end
The following example uses InstanceFilter to retrieve those process instances that are in-process (that is, not aborted nor completed) and have a deadline time greater than now:
do
connectTo ClientProcessService
create InstanceFilter
using processService = ClientProcessService
InstanceFilter.searchScope = SearchScope(
participantScope : ParticipantScope.ALL ,
statusScope : StatusScope.ONLY_INPROCESS)
addAttributeTo InstanceFilter
using variable = VarDefinition.DEADLINE_ID,
comparator = Comparison.GREATER_THAN,
value = 'now' // shorthand for "Time.now()"
instances = getInstancesByFilter(ClientProcessService,
filter : InstanceFilter)
return instances
on exit
disconnectFrom ClientProcessService
end