@Override public Collection<? extends QName> getNamesOfAssociationsWithInboundExpressions() { return getAssociationDefinitions().stream() .filter(assocDef -> CollectionUtils.isNotEmpty(assocDef.getInboundMappingTypes())) .map(a -> a.getName()) .collect(Collectors.toCollection(HashSet::new)); }
void parseAssociations(RefinedResourceSchema rSchema) throws SchemaException { if (schemaHandlingObjectTypeDefinitionType == null) { return; } for (ResourceObjectAssociationType resourceObjectAssociationType: schemaHandlingObjectTypeDefinitionType.getAssociation()) { RefinedAssociationDefinition rAssocDef = new RefinedAssociationDefinition(resourceObjectAssociationType); ShadowKindType assocKind = rAssocDef.getKind(); RefinedObjectClassDefinition assocTarget = rSchema.getRefinedDefinition(assocKind, rAssocDef.getIntents()); rAssocDef.setAssociationTarget(assocTarget); associationDefinitions.add(rAssocDef); } }
@Override public Collection<? extends QName> getNamesOfAssociationsWithOutboundExpressions() { return getAssociationDefinitions().stream() .filter(assocDef -> assocDef.getOutboundMappingType() != null) .map(a -> a.getName()) .collect(Collectors.toCollection(HashSet::new)); }
public RefinedAssociationDefinition clone() { RefinedAssociationDefinition clone = new RefinedAssociationDefinition(resourceObjectAssociationType); copyValues(clone); return clone; }
if (assocDefType.getResourceObjectAssociationType().getDirection() != ResourceObjectAssociationDirectionType.OBJECT_TO_SUBJECT) { if (!assocDefType.requiresExplicitReferentialIntegrity()) { if (assocDefType.getAuxiliaryObjectClass() != null && !subjectCtx.getObjectClassDefinition().hasAuxiliaryObjectClass(assocDefType.getAuxiliaryObjectClass())) { LOGGER.trace("Ignoring association in deleted shadow because subject does not have {} auxiliary object class", assocDefType.getAuxiliaryObjectClass()); continue; QName associationName = assocDefType.getName(); if (associationName == null) { throw new SchemaException("No name in entitlement association "+assocDefType+" in "+subjectCtx.getResource()); ShadowKindType entitlementKind = assocDefType.getKind(); if (entitlementKind == null) { entitlementKind = ShadowKindType.ENTITLEMENT; for (String entitlementIntent: assocDefType.getIntents()) { final ProvisioningContext entitlementCtx = subjectCtx.spawn(entitlementKind, entitlementIntent); final RefinedObjectClassDefinition entitlementOcDef = entitlementCtx.getObjectClassDefinition(); if (entitlementOcDef == null) { throw new SchemaException("No definition for entitlement intent(s) '"+assocDefType.getIntents()+"' defined in entitlement association "+associationName+" in "+subjectCtx.getResource()); final QName assocAttrName = assocDefType.getResourceObjectAssociationType().getAssociationAttribute(); if (assocAttrName == null) { throw new SchemaException("No association attribute defined in entitlement association '"+associationName+"' in "+subjectCtx.getResource()); QName valueAttrName = assocDefType.getResourceObjectAssociationType().getValueAttribute(); if (valueAttrName == null) {
ShadowKindType entitlementKind = assocDefType.getKind(); if (entitlementKind == null) { entitlementKind = ShadowKindType.ENTITLEMENT; for (String entitlementIntent: assocDefType.getIntents()) { LOGGER.trace("Resolving association {} for kind {} and intent {}", assocDefType.getName(), entitlementKind, entitlementIntent); ProvisioningContext entitlementCtx = subjectCtx.spawn(entitlementKind, entitlementIntent); RefinedObjectClassDefinition entitlementDef = entitlementCtx.getObjectClassDefinition(); if (entitlementDef == null) { throw new SchemaException("No definition for entitlement intent(s) '"+assocDefType.getIntents()+"' in "+resourceType); ResourceObjectAssociationDirectionType direction = assocDefType.getResourceObjectAssociationType().getDirection(); if (direction == ResourceObjectAssociationDirectionType.SUBJECT_TO_OBJECT) { postProcessEntitlementSubjectToEntitlement(resourceType, resourceObject, objectClassDefinition, assocDefType, entitlementDef, attributesContainer, associationContainer, parentResult); } else if (direction == ResourceObjectAssociationDirectionType.OBJECT_TO_SUBJECT) { if (assocDefType.getResourceObjectAssociationType().getShortcutAssociationAttribute() != null) { postProcessEntitlementSubjectToEntitlement(resourceType, resourceObject, objectClassDefinition, assocDefType, entitlementDef, attributesContainer, associationContainer, assocDefType.getResourceObjectAssociationType().getShortcutAssociationAttribute(), assocDefType.getResourceObjectAssociationType().getShortcutValueAttribute(), parentResult); } else { postProcessEntitlementEntitlementToSubject(subjectCtx, resourceObject, assocDefType, entitlementCtx, attributesContainer, associationContainer, parentResult);
ResourceObjectAssociationDirectionType direction = assocDefType.getResourceObjectAssociationType().getDirection(); if (direction != ResourceObjectAssociationDirectionType.OBJECT_TO_SUBJECT) { Collection<String> entitlementIntents = assocDefType.getIntents(); if (entitlementIntents == null || entitlementIntents.isEmpty()) { throw new SchemaException("No entitlement intent specified in association "+associationCVal+" in "+resource); ShadowKindType entitlementKind = assocDefType.getKind(); if (entitlementKind == null) { entitlementKind = ShadowKindType.ENTITLEMENT; QName assocAttrName = assocDefType.getResourceObjectAssociationType().getAssociationAttribute(); if (assocAttrName == null) { throw new SchemaException("No association attribute defined in entitlement association in "+resource); QName valueAttrName = assocDefType.getResourceObjectAssociationType().getValueAttribute(); if (valueAttrName == null) { throw new SchemaException("No value attribute defined in entitlement association in "+resource); subjectShadow = subjectShadowAfter; } else { if (assocDefType.requiresExplicitReferentialIntegrity()) { PropertyDelta<TA> attributeDeltaAfterNarrow = ProvisioningUtil.narrowPropertyDelta(attributeDelta, currentObjectShadow, assocDefType.getMatchingRule(), matchingRuleRegistry); if (LOGGER.isTraceEnabled() && (attributeDeltaAfterNarrow == null || attributeDeltaAfterNarrow.isEmpty())) { LOGGER.trace("Not collecting entitlement object operations ({}) association {}: attribute delta is empty after narrow, orig delta: {}", attributeModification.setMatchingRuleQName(assocDefType.getMatchingRule()); LOGGER.trace("Collecting entitlement object operations ({}) association {}: {}", modificationType, associationName.getLocalPart(), attributeModification);
@Override public Collection<QName> getNamesOfAssociations() { return getAssociationDefinitions().stream() .map(a -> a.getName()) .collect(Collectors.toCollection(HashSet::new)); }
ObjectNotFoundException, ExpressionEvaluationException { boolean evaluatePatterns = !assocDef.getTolerantValuePattern().isEmpty() || !assocDef.getIntolerantValuePattern().isEmpty(); MatchingRule<Object> matchingRule = evaluatePatterns ? getMatchingRuleForTargetNamingIdentifier(assocDef) : null; String assocNameLocal = assocDef.getName().getLocalPart(); if (evaluatePatterns && matchesAssociationPattern(assocDef.getTolerantValuePattern(), targetNamingIdentifier, matchingRule)) { LOGGER.trace("Reconciliation: KEEPING value {} of association {}: identifier {} matches with tolerant value pattern.", isCValue, assocNameLocal, targetNamingIdentifier); if (evaluatePatterns && matchesAssociationPattern(assocDef.getIntolerantValuePattern(), targetNamingIdentifier, matchingRule)) { recordAssociationDelta(valueMatcher, accCtx, assocDef, ModificationType.DELETE, isCValue.getValue(), null, "identifier " + targetNamingIdentifier + " matches with intolerant pattern"); if (!assocDef.isTolerant()) { recordAssociationDelta(valueMatcher, accCtx, assocDef, ModificationType.DELETE, isCValue.getValue(), null, "it is not given by any mapping and the association is not tolerant");
OperationResult parentResult) throws SchemaException, CommunicationException, ObjectNotFoundException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException { ResourceType resourceType = subjectCtx.getResource(); final QName associationName = assocDefType.getName(); final RefinedObjectClassDefinition entitlementDef = entitlementCtx.getObjectClassDefinition(); if (associationName == null) { QName associationAuxiliaryObjectClass = assocDefType.getAuxiliaryObjectClass(); if (associationAuxiliaryObjectClass != null && associationAuxiliaryObjectClass.getNamespaceURI() != null && !associationAuxiliaryObjectClass.getNamespaceURI().equals(ResourceTypeUtil.getResourceNamespace(resourceType))) { LOGGER.warn("Auxiliary object class {} in association {} does not have namespace that matches {}", associationAuxiliaryObjectClass, assocDefType.getName(), resourceType); QName assocAttrName = assocDefType.getResourceObjectAssociationType().getAssociationAttribute(); if (assocAttrName == null) { throw new SchemaException("No association attribute defined in entitlement association '"+associationName+"' in "+resourceType); QName valueAttrName = assocDefType.getResourceObjectAssociationType().getValueAttribute(); if (valueAttrName == null) { throw new SchemaException("No value attribute defined in entitlement association '"+associationName+"' in "+resourceType);
if (associationDefinition.isIgnored()) { continue; LOGGER.debug("Processing refined association definition for {}", associationDefinition.getName()); ResourceDataItem assocItem = model.findResourceItem(resource.getOid(), kind, intent, getObjectClassName(refinedDefinition), ItemPath.create(associationDefinition.getName())); if (associationDefinition.getOutboundMappingType() != null) { processOutboundMapping(model, assocItem, associationDefinition.getOutboundMappingType(), null);
RefinedAssociationDefinition associationDefinition = rOcDef.findAssociationDefinition(assocName); final MappingType outboundMappingType = associationDefinition.getOutboundMappingType(); if (outboundMappingType == null) { continue; "outbound mapping for " + PrettyPrinter.prettyPrint(associationDefinition.getName()) + " in " + projCtx.getResource()); MappingImpl<PrismContainerValue<ShadowAssociationType>,PrismContainerDefinition<ShadowAssociationType>> evaluatedMapping = (MappingImpl) evaluateMapping(mappingBuilder, assocName, outputDefinition, focusOdo, projectionOdo, operation, rOcDef, associationDefinition.getAssociationTarget(), context, projCtx, task, result);
public QName getMatchingRule() { return getResourceObjectAssociationType().getMatchingRule(); }
assocName = rAssocDef.getName(); mappingBuilder, assocName, outputDefinition, rAssocDef.getAssociationTarget(), task, result);
if (associationDef.isIgnored(LayerType.MODEL)) { LOGGER.trace("Skipping inbound for association {} in {} because the association is ignored", PrettyPrinter.prettyPrint(accountAttributeName), projContext.getResourceShadowDiscriminator()); List<MappingType> inboundMappingTypes = associationDef.getInboundMappingTypes(); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Processing inbound for {} in {}; ({} mappings)", PrettyPrinter.prettyPrint(accountAttributeName), PropertyLimitations limitations = associationDef.getLimitations(LayerType.MODEL); if (limitations != null) { PropertyAccessType access = limitations.getAccess();
+ " couldn't be found in " + ctx.getObjectClassDefinition() + " " + ctx.getDesc() + ", with using shadow coordinates " + ctx.isUseRefinedDefinition()); ShadowKindType entitlementKind = rEntitlementAssociation.getKind(); if (entitlementKind == null) { entitlementKind = ShadowKindType.ENTITLEMENT; for (String entitlementIntent : rEntitlementAssociation.getIntents()) { ProvisioningContext ctxEntitlement = ctx.spawn(entitlementKind, entitlementIntent);
ResourceObjectAssociationDirectionType direction = assocDefType.getResourceObjectAssociationType().getDirection(); if (direction != ResourceObjectAssociationDirectionType.SUBJECT_TO_OBJECT) { QName assocAttrName = assocDefType.getResourceObjectAssociationType().getAssociationAttribute(); if (assocAttrName == null) { throw new SchemaException("No association attribute definied in entitlement association '"+associationName+"' in "+ctx.getResource()); if (attributeOperation == null) { attributeOperation = new PropertyModificationOperation(assocAttrDef.createEmptyDelta(ItemPath.create(ShadowType.F_ATTRIBUTES, assocAttrName))); attributeOperation.setMatchingRuleQName(assocDefType.getMatchingRule()); operationMap.put(assocAttrName, attributeOperation); QName valueAttrName = assocDefType.getResourceObjectAssociationType().getValueAttribute(); if (valueAttrName == null) { throw new SchemaException("No value attribute defined in entitlement association '"+associationName+"' in "+ctx.getResource());
throw new IllegalStateException("No association definition for " + associationValue); if (!associationDefinition.requiresExplicitReferentialIntegrity()) { continue; QName valueAttributeName = associationDefinition.getResourceObjectAssociationType().getValueAttribute(); if (!ShadowUtil.matchesAttribute(subjectItemPath, valueAttributeName)) { continue;
@Override public Collection<RefinedAssociationDefinition> getAssociationDefinitions(ShadowKindType kind) { return Collections.unmodifiableList( associationDefinitions.stream() .filter(association -> kind == association.getKind()) .collect(Collectors.toList())); }