use of com.evolveum.midpoint.schema.VirtualAssignmenetSpecification in project midpoint by Evolveum.
the class LifecycleUtil method getForcedAssignmentSpecification.
public static <R extends AbstractRoleType> VirtualAssignmenetSpecification<R> getForcedAssignmentSpecification(LifecycleStateModelType lifecycleStateModel, String targetLifecycleState, PrismContext prismContext) throws SchemaException {
LifecycleStateType stateDefinition = findStateDefinition(lifecycleStateModel, targetLifecycleState);
if (stateDefinition == null) {
return null;
}
VirtualAssignmentSpecificationType virtualAssignmentSpecificationType = stateDefinition.getForcedAssignment();
if (virtualAssignmentSpecificationType == null) {
return null;
}
SearchFilterType filter = virtualAssignmentSpecificationType.getFilter();
if (filter == null) {
return null;
}
QName targetType = virtualAssignmentSpecificationType.getTargetType();
Class<R> targetClass = (Class<R>) AbstractRoleType.class;
if (targetType != null) {
targetClass = (Class<R>) prismContext.getSchemaRegistry().getCompileTimeClassForObjectType(targetType);
}
VirtualAssignmenetSpecification<R> virtualAssignmenetSpecification = new VirtualAssignmenetSpecification();
virtualAssignmenetSpecification.setType(targetClass);
ObjectFilter objectFilter = prismContext.getQueryConverter().parseFilter(filter, targetClass);
virtualAssignmenetSpecification.setFilter(objectFilter);
return virtualAssignmenetSpecification;
}
Aggregations