use of com.evolveum.midpoint.xml.ns._public.common.common_3.EventStatusType in project midpoint by Evolveum.
the class StatusFilterHelper method processEvent.
@Override
public boolean processEvent(Event event, EventHandlerType eventHandlerType, NotificationManager notificationManager, Task task, OperationResult result) {
if (eventHandlerType.getStatus().isEmpty()) {
return true;
}
logStart(LOGGER, event, eventHandlerType, eventHandlerType.getStatus());
boolean retval = false;
for (EventStatusType eventStatusType : eventHandlerType.getStatus()) {
if (eventStatusType == null) {
LOGGER.warn("Filtering on null eventStatusType; filter = " + eventHandlerType);
} else if (event.isStatusType(eventStatusType)) {
retval = true;
break;
}
}
logEnd(LOGGER, event, eventHandlerType, retval);
return retval;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.EventStatusType in project midpoint by Evolveum.
the class NotifyExecutor method execute.
@Override
public PipelineData execute(ActionExpressionType expression, PipelineData input, ExecutionContext context, OperationResult globalResult) throws ScriptExecutionException {
String subtype = expressionHelper.getArgumentAsString(expression.getParameter(), PARAM_SUBTYPE, input, context, null, PARAM_SUBTYPE, globalResult);
EventHandlerType handler = expressionHelper.getSingleArgumentValue(expression.getParameter(), PARAM_HANDLER, false, false, PARAM_HANDLER, input, context, EventHandlerType.class, globalResult);
EventStatusType status = expressionHelper.getSingleArgumentValue(expression.getParameter(), PARAM_STATUS, false, false, PARAM_STATUS, input, context, EventStatusType.class, globalResult);
EventOperationType operation = expressionHelper.getSingleArgumentValue(expression.getParameter(), PARAM_OPERATION, false, false, PARAM_OPERATION, input, context, EventOperationType.class, globalResult);
boolean forWholeInput = expressionHelper.getArgumentAsBoolean(expression.getParameter(), PARAM_FOR_WHOLE_INPUT, input, context, false, PARAM_SUBTYPE, globalResult);
if (handler != null) {
// TODO explain that the reason is that handler is not null
checkRootAuthorization(globalResult, NAME);
}
if (status == null) {
status = EventStatusType.SUCCESS;
}
if (operation == null) {
operation = EventOperationType.ADD;
}
if (notificationManager == null) {
throw new IllegalStateException("Notification manager is unavailable");
}
int eventCount = 0;
if (forWholeInput) {
Event event = new CustomEvent(lightweightIdentifierGenerator, subtype, handler, input.getData(), operation, status, context.getChannel());
notificationManager.processEvent(event, context.getTask(), globalResult);
eventCount++;
} else {
for (PipelineItem item : input.getData()) {
PrismValue value = item.getValue();
OperationResult result = operationsHelper.createActionResult(item, this, context, globalResult);
context.checkTaskStop();
Event event = new CustomEvent(lightweightIdentifierGenerator, subtype, handler, value, operation, status, context.getChannel());
notificationManager.processEvent(event, context.getTask(), result);
eventCount++;
operationsHelper.trimAndCloneResult(result, globalResult, context);
}
}
context.println("Produced " + eventCount + " event(s)");
return input;
}
Aggregations