public Collection<ResourceType> getResources(Task task, OperationResult result) throws ObjectNotFoundException, SchemaException { Collection<ResourceType> resources = new ArrayList<>(); for (Construction<AH> acctConstr: constructionTriple.getAllValues()) { resources.add(acctConstr.getResource(task, result)); } return resources; }
private <V extends PrismValue,D extends ItemDefinition> boolean hasActiveStrongMapping( Map<QName, DeltaSetTriple<ItemValueWithOrigin<V,D>>> squeezedAttributes, LensProjectionContext accCtx) throws SchemaException { for (Map.Entry<QName, DeltaSetTriple<ItemValueWithOrigin<V,D>>> entry : squeezedAttributes.entrySet()) { DeltaSetTriple<ItemValueWithOrigin<V,D>> ivwoTriple = entry.getValue(); for (ItemValueWithOrigin<V,D> ivwo: ivwoTriple.getAllValues()) { PrismValueDeltaSetTripleProducer<V,D> mapping = ivwo.getMapping(); if (mapping.getStrength() == MappingStrengthType.STRONG) { // Do not optimize for "nothing changed" case here. We want to make // sure that the values of strong mappings are applied even if nothing // has changed. return true; } } } return false; }
public <F extends AssignmentHolderType> void checkExclusionsLegacy(LensContext<F> context, Collection<EvaluatedAssignmentImpl<F>> assignmentsA, Collection<EvaluatedAssignmentImpl<F>> assignmentsB) throws PolicyViolationException { for (EvaluatedAssignmentImpl<F> assignmentA: assignmentsA) { for (EvaluatedAssignmentImpl<F> assignmentB: assignmentsB) { if (assignmentA == assignmentB) { continue; // Same thing, this cannot exclude itself } for (EvaluatedAssignmentTargetImpl eRoleA : assignmentA.getRoles().getAllValues()) { if (eRoleA.appliesToFocus()) { for (EvaluatedAssignmentTargetImpl eRoleB : assignmentB.getRoles().getAllValues()) { if (eRoleB.appliesToFocus()) { checkExclusionLegacy(assignmentA, assignmentB, eRoleA, eRoleB); } } } } } } }
private <F extends FocusType> List<Construction<F>> getConstructions(EvaluatedAssignmentImpl<F> evaluatedAssignment, String name) { return evaluatedAssignment.getConstructionTriple().getAllValues().stream() .filter(c -> name.equals(c.getDescription())) .collect(Collectors.toList()); }
private void fillInAssociationNames(Map<QName, DeltaSetTriple<ItemValueWithOrigin<PrismContainerValue<ShadowAssociationType>,PrismContainerDefinition<ShadowAssociationType>>>> squeezedAssociations) throws SchemaException { PrismPropertyDefinition<QName> nameDefinition = prismContext.getSchemaRegistry() .findContainerDefinitionByCompileTimeClass(ShadowAssociationType.class) .findPropertyDefinition(ShadowAssociationType.F_NAME); for (Entry<QName, DeltaSetTriple<ItemValueWithOrigin<PrismContainerValue<ShadowAssociationType>,PrismContainerDefinition<ShadowAssociationType>>>> entry : squeezedAssociations.entrySet()) { DeltaSetTriple<ItemValueWithOrigin<PrismContainerValue<ShadowAssociationType>,PrismContainerDefinition<ShadowAssociationType>>> deltaSetTriple = entry.getValue(); for (ItemValueWithOrigin<PrismContainerValue<ShadowAssociationType>,PrismContainerDefinition<ShadowAssociationType>> ivwo : deltaSetTriple.getAllValues()) { PrismContainerValue<ShadowAssociationType> value = ivwo.getItemValue(); if (value != null && value.findProperty(ShadowAssociationType.F_NAME) == null) { // just for safety PrismProperty<QName> nameProperty = value.createProperty(nameDefinition); nameProperty.setRealValue(entry.getKey()); } } } LOGGER.trace("Names for squeezed associations filled-in."); }
private void assertTargetPath(EvaluatedAssignmentImpl<UserType> evaluatedAssignment, String targetName, String expectedPath) { EvaluatedAssignmentTargetImpl target = evaluatedAssignment.getRoles().getAllValues().stream() .filter(tgt -> targetName.equals(tgt.getTarget().getName().getOrig())) .findFirst().orElseThrow(() -> new AssertionError("Target " + targetName + " is not present")); String realPath = getStringRepresentation(target.getAssignmentPath()); System.out.println("Path for " + targetName + " is: " + realPath); assertEquals("Wrong evaluation order for " + targetName, expectedPath, realPath); }
public void evaluateConstructions(ObjectDeltaObject<AH> focusOdo, PrismObject<SystemConfigurationType> systemConfiguration, Task task, OperationResult result) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException, SecurityViolationException, ConfigurationException, CommunicationException { for (Construction<AH> construction :constructionTriple.getAllValues()) { construction.setFocusOdo(focusOdo); construction.setSystemConfiguration(systemConfiguration); construction.setWasValid(wasValid); LOGGER.trace("Evaluating construction '{}' in {}", construction, construction.getSource()); construction.evaluate(task, result); } }
DeltaSetTriple<ItemValueWithOrigin<V,D>> ivwoTriple = entry.getValue(); boolean hasWeak = false; for (ItemValueWithOrigin<V,D> ivwo: ivwoTriple.getAllValues()) { PrismValueDeltaSetTripleProducer<V,D> mapping = ivwo.getMapping(); if (mapping.getStrength() == MappingStrengthType.WEAK) {
for (ItemValueWithOrigin<PrismPropertyValue<QName>,PrismPropertyDefinition<QName>> ivwo: ivwoTriple.getAllValues()) { QName auxObjectClassName = ivwo.getItemValue().getValue(); if (auxOcNames.contains(auxObjectClassName)) {
@SuppressWarnings("unchecked") private <F extends FocusType> Collection<EvaluatedAssignmentImpl<F>> assertAssignmentTripleSetSize(LensContext<F> context, int zero, int plus, int minus) { assertEquals("Wrong size of assignment triple zero set", zero, CollectionUtils.size(context.getEvaluatedAssignmentTriple().getZeroSet())); assertEquals("Wrong size of assignment triple plus set", plus, CollectionUtils.size(context.getEvaluatedAssignmentTriple().getPlusSet())); assertEquals("Wrong size of assignment triple minus set", minus, CollectionUtils.size(context.getEvaluatedAssignmentTriple().getMinusSet())); return (Collection) context.getEvaluatedAssignmentTriple().getAllValues(); }
continue; for (EvaluatedAssignmentImpl<F> evaluatedAssignment : evaluatedAssignmentTriple.getAllValues()) { for (EvaluatedAssignmentTargetImpl target : evaluatedAssignment.getRoles().getNonNegativeValues()) { if (!target.getAssignmentPath().last().isMatchingOrder() && !target.isDirectlyAssigned()) {