Search in sources :

Example 1 with ShadowTagSpecificationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowTagSpecificationType in project midpoint by Evolveum.

the class SynchronizationExpressionsEvaluator method generateTag.

// For now only used in sync service. but later can be used in outbound/assignments
@SuppressWarnings("WeakerAccess")
public String generateTag(ResourceObjectMultiplicityType multiplicity, PrismObject<ShadowType> shadow, PrismObject<ResourceType> resource, PrismObject<SystemConfigurationType> configuration, String shortDesc, Task task, OperationResult parentResult) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException {
    if (multiplicity == null) {
        return null;
    }
    ShadowTagSpecificationType tagSpec = multiplicity.getTag();
    if (tagSpec == null) {
        return shadow.getOid();
    }
    ExpressionType expressionType = tagSpec.getExpression();
    if (expressionType == null) {
        return shadow.getOid();
    }
    VariablesMap variables = ModelImplUtils.getDefaultVariablesMap(null, shadow, null, resource, configuration, null, prismContext);
    ItemDefinition outputDefinition = prismContext.definitionFactory().createPropertyDefinition(ExpressionConstants.OUTPUT_ELEMENT_NAME, PrimitiveType.STRING.getQname());
    PrismPropertyValue<String> tagProp = ExpressionUtil.evaluateExpression(variables, outputDefinition, expressionType, MiscSchemaUtil.getExpressionProfile(), expressionFactory, shortDesc, task, parentResult);
    return getRealValue(tagProp);
}
Also used : ShadowTagSpecificationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowTagSpecificationType) VariablesMap(com.evolveum.midpoint.schema.expression.VariablesMap) ExpressionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ExpressionType)

Aggregations

VariablesMap (com.evolveum.midpoint.schema.expression.VariablesMap)1 ExpressionType (com.evolveum.midpoint.xml.ns._public.common.common_3.ExpressionType)1 ShadowTagSpecificationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowTagSpecificationType)1