private void gatherCandidateShadowsFromAbstractRoleRecurse(OrgType thisOrg, List< String > candidateShadowsOidList, Collection<SelectorOptions<GetOperationOptions>> options, String desc, ExpressionEvaluationContext params) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException { for (ObjectReferenceType parentOrgRef: thisOrg.getParentOrgRef()) { OrgType parent = objectResolver.resolve(parentOrgRef, OrgType.class, options, desc, params.getTask(), params.getResult()); if (matchesForRecursion(parent)) { gatherCandidateShadowsFromAbstractRole(parent, candidateShadowsOidList); gatherCandidateShadowsFromAbstractRoleRecurse(parent, candidateShadowsOidList, options, desc, params); } } }
/** * Executed before mapping expression is executed. It is used to populate the assignment. * We need to do that just before mapping expression is executed, because we want all the sources * and variables set the same way as mapping is set. */ public void mappingPreExpression(ExpressionEvaluationContext context) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, SecurityViolationException { if (autoassignMappingType == null) { return; } PopulateType populate = autoassignMappingType.getPopulate(); if (populate == null) { return; } List<ItemDelta<PrismValue, ItemDefinition>> populateItemDeltas = PopulatorUtil.computePopulateItemDeltas(populate, assignmentDef, context.getVariables(), context, context.getContextDescription(), context.getTask(), context.getResult()); if (populateItemDeltas != null) { ItemDeltaCollectionsUtil.applyTo(populateItemDeltas, assignmentType.asPrismContainerValue()); } }
Task task = context.getTask();
@Override public PrismValueDeltaSetTriple<V> evaluate(ExpressionEvaluationContext context) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException { PrismValueDeltaSetTriple<V> outputTriple; if (expressionEvaluatorType.getRelativityMode() == TransformExpressionRelativityModeType.ABSOLUTE) { outputTriple = evaluateAbsoluteExpression(context.getSources(), context.getVariables(), context, context.getContextDescription(), context.getTask(), context.getResult()); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Evaluated absolute expression {}, output triple:\n{}", context.getContextDescription(), outputTriple==null?null:outputTriple.debugDump(1)); } } else if (expressionEvaluatorType.getRelativityMode() == null || expressionEvaluatorType.getRelativityMode() == TransformExpressionRelativityModeType.RELATIVE) { if (context.getSources() == null || context.getSources().isEmpty()) { // Special case. No sources, so there will be no input variables and no combinations. Everything goes to zero set. outputTriple = evaluateAbsoluteExpression(null, context.getVariables(), context, context.getContextDescription(), context.getTask(), context.getResult()); LOGGER.trace("Evaluated relative sourceless expression {}, output triple:\n{}", context.getContextDescription(), outputTriple==null?null:outputTriple.debugDump(1)); } else { List<SourceTriple<?,?>> sourceTriples = processSources(context.getSources(), context); outputTriple = evaluateRelativeExpression(sourceTriples, context.getVariables(), context.isSkipEvaluationMinus(), context.isSkipEvaluationPlus(), context, context.getContextDescription(), context.getTask(), context.getResult()); LOGGER.trace("Evaluated relative expression {}, output triple:\n{}", context.getContextDescription(), outputTriple==null?null:outputTriple.debugDump(1)); } } else { throw new IllegalArgumentException("Unknown relativity mode "+expressionEvaluatorType.getRelativityMode()); } return outputTriple; }
if (generateEvaluatorType.getValuePolicyRef() != null) { ValuePolicyType resolvedValuePolicyType = objectResolver.resolve(generateEvaluatorValuePolicyRef, ValuePolicyType.class, null, "resolving value policy reference in generateExpressionEvaluator", context.getTask(), context.getResult()); valuePolicyType = resolvedValuePolicyType; if (isNotEmptyMinLength(valuePolicyType)) { stringValue = valuePolicyGenerator.generate(output.getPath(), valuePolicyType, DEFAULT_LENGTH, true, originResolver, context.getContextDescription(), context.getTask(), context.getResult()); } else { stringValue = valuePolicyGenerator.generate(output.getPath(), valuePolicyType, DEFAULT_LENGTH, false, originResolver, context.getContextDescription(), context.getTask(), context.getResult());
private void selectMatchingShadows(List<String> candidateShadowsOidList, PrismContainer<ShadowAssociationType> output, String resourceOid, ShadowKindType kind, String intent, QName assocName, ExpressionEvaluationContext params) throws SchemaException { S_AtomicFilterExit filter = prismContext.queryFor(ShadowType.class) .id(candidateShadowsOidList.toArray(new String[0])) .and().item(ShadowType.F_RESOURCE_REF).ref(resourceOid) .and().item(ShadowType.F_KIND).eq(kind); if (intent != null) { filter = filter.and().item(ShadowType.F_INTENT).eq(intent); } ObjectQuery query = filter.build(); ResultHandler<ShadowType> handler = (object, parentResult) -> { PrismContainerValue<ShadowAssociationType> newValue = output.createNewValue(); ShadowAssociationType shadowAssociationType = newValue.asContainerable(); shadowAssociationType.setName(assocName); toAssociation(object, shadowAssociationType); return true; }; try { objectResolver.searchIterative(ShadowType.class, query, createNoFetchCollection(), handler, params.getTask(), params.getResult()); } catch (CommonException e) { throw new SystemException("Couldn't search for relevant shadows: " + e.getMessage(), e); } }