use of com.evolveum.midpoint.xml.ns._public.common.common_3.CertificationPolicyActionType in project midpoint by Evolveum.
the class CertificationHook method invoke.
@Override
public <O extends ObjectType> HookOperationMode invoke(@NotNull ModelContext<O> context, @NotNull Task task, @NotNull OperationResult result) throws PolicyViolationException {
if (context.getState() != ModelState.FINAL) {
return HookOperationMode.FOREGROUND;
}
LensElementContext<O> focusContext = (LensElementContext<O>) context.getFocusContext();
if (focusContext == null || !FocusType.class.isAssignableFrom(focusContext.getObjectTypeClass())) {
return HookOperationMode.FOREGROUND;
}
List<CertificationPolicyActionType> actions = new ArrayList<>();
actions.addAll(getFocusCertificationActions(context));
actions.addAll(getAssignmentCertificationActions(context));
try {
certificationManager.startAdHocCertifications(focusContext.getObjectAny(), actions, task, result);
} catch (CommonException e) {
throw new SystemException("Couldn't start ad-hoc campaign(s): " + e.getMessage(), e);
}
return HookOperationMode.FOREGROUND;
}
Aggregations