use of eu.bcvsolutions.idm.core.api.event.AsyncEntityEventProcessor in project CzechIdMng by bcvsolutions.
the class DefaultEntityEventManager method evaluatePriority.
/**
* Evaluate event priority by registered processors
*
* @param event
* @param registeredProcessors
* @return
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected PriorityType evaluatePriority(EntityEvent<Identifiable> event, List<EntityEventProcessor> registeredProcessors) {
PriorityType priority = null;
for (EntityEventProcessor processor : registeredProcessors) {
if (!(processor instanceof AsyncEntityEventProcessor)) {
continue;
}
AsyncEntityEventProcessor asyncProcessor = (AsyncEntityEventProcessor) processor;
PriorityType processorPriority = asyncProcessor.getPriority(event);
if (processorPriority == null) {
// processor doesn't vote about priority - preserve original event priority.
continue;
}
if (priority == null || processorPriority.getPriority() < priority.getPriority()) {
priority = processorPriority;
}
if (priority == PriorityType.IMMEDIATE) {
// nothing is higher
break;
}
}
//
return priority;
}
use of eu.bcvsolutions.idm.core.api.event.AsyncEntityEventProcessor in project CzechIdMng by bcvsolutions.
the class DefaultEntityEventManager method evaluatePriority.
/**
* Evaluate event priority by registered processors
*
* @param event
* @param registeredProcessors
* @return
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected PriorityType evaluatePriority(EntityEvent<?> event, List<EntityEventProcessor> registeredProcessors) {
PriorityType priority = null;
for (EntityEventProcessor processor : registeredProcessors) {
if (!(processor instanceof AsyncEntityEventProcessor)) {
continue;
}
AsyncEntityEventProcessor asyncProcessor = (AsyncEntityEventProcessor) processor;
PriorityType processorPriority = asyncProcessor.getPriority(event);
if (processorPriority == null) {
// processor doesn't vote about priority - preserve original event priority.
continue;
}
if (priority == null || processorPriority.getPriority() < priority.getPriority()) {
priority = processorPriority;
}
if (priority == PriorityType.IMMEDIATE) {
// nothing is higher
break;
}
}
//
return priority;
}
Aggregations