Search in sources :

Example 1 with VirtualAssignmentSpecificationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.VirtualAssignmentSpecificationType 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;
}
Also used : LifecycleStateType(com.evolveum.midpoint.xml.ns._public.common.common_3.LifecycleStateType) VirtualAssignmentSpecificationType(com.evolveum.midpoint.xml.ns._public.common.common_3.VirtualAssignmentSpecificationType) SearchFilterType(com.evolveum.prism.xml.ns._public.query_3.SearchFilterType) QName(javax.xml.namespace.QName) VirtualAssignmenetSpecification(com.evolveum.midpoint.schema.VirtualAssignmenetSpecification) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter)

Aggregations

ObjectFilter (com.evolveum.midpoint.prism.query.ObjectFilter)1 VirtualAssignmenetSpecification (com.evolveum.midpoint.schema.VirtualAssignmenetSpecification)1 LifecycleStateType (com.evolveum.midpoint.xml.ns._public.common.common_3.LifecycleStateType)1 VirtualAssignmentSpecificationType (com.evolveum.midpoint.xml.ns._public.common.common_3.VirtualAssignmentSpecificationType)1 SearchFilterType (com.evolveum.prism.xml.ns._public.query_3.SearchFilterType)1 QName (javax.xml.namespace.QName)1