use of com.evolveum.midpoint.model.impl.lens.projector.mappings.FocalMappingEvaluationRequest in project midpoint by Evolveum.
the class AutoAssignMappingCollector method collectAutoassignMappings.
<AH extends AssignmentHolderType> void collectAutoassignMappings(LensContext<AH> context, List<FocalMappingEvaluationRequest<?, ?>> mappings, OperationResult result) throws SchemaException {
if (!autoassignEnabled(context.getSystemConfiguration())) {
return;
}
ObjectQuery query = prismContext.queryFor(AbstractRoleType.class).item(SchemaConstants.PATH_AUTOASSIGN_ENABLED).eq(true).build();
ResultHandler<AbstractRoleType> handler = (role, objectResult) -> {
AutoassignSpecificationType autoassign = role.asObjectable().getAutoassign();
if (autoassign == null) {
return true;
}
if (!isTrue(autoassign.isEnabled())) {
return true;
}
FocalAutoassignSpecificationType focalAutoassignSpec = autoassign.getFocus();
if (focalAutoassignSpec == null) {
return true;
}
if (!isApplicableFor(focalAutoassignSpec.getSelector(), context.getFocusContext(), objectResult)) {
return true;
}
for (AutoassignMappingType autoMapping : focalAutoassignSpec.getMapping()) {
AutoassignMappingType mapping = LensUtil.setMappingTarget(autoMapping, new ItemPathType(SchemaConstants.PATH_ASSIGNMENT));
mappings.add(new AutoassignRoleMappingEvaluationRequest(mapping, role.asObjectable()));
LOGGER.trace("Collected autoassign mapping {} from {}", mapping.getName(), role);
}
return true;
};
cacheRepositoryService.searchObjectsIterative(AbstractRoleType.class, query, handler, createReadOnlyCollection(), true, result);
}
Aggregations