Skip to content

Commit

Permalink
Tolerant auxiliary object classes
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Aug 24, 2017
1 parent 9f6cc8c commit b3a1a6a
Show file tree
Hide file tree
Showing 11 changed files with 883 additions and 86 deletions.
Expand Up @@ -461,6 +461,11 @@ public Collection<? extends QName> getNamesOfAssociationsWithOutboundExpressions
.map(a -> a.getName())
.collect(Collectors.toCollection(HashSet::new));
}

@Override
public boolean isTolerantAuxiliaryObjectClasses() {
return structuralObjectClassDefinition.isTolerantAuxiliaryObjectClasses();
}

@Override
public boolean hasAuxiliaryObjectClass(QName expectedObjectClassName) {
Expand Down
Expand Up @@ -591,6 +591,11 @@ public boolean hasAuxiliaryObjectClass(QName expectedObjectClassName) {
return refinedObjectClassDefinition.hasAuxiliaryObjectClass(expectedObjectClassName);
}

@Override
public boolean isTolerantAuxiliaryObjectClasses() {
return refinedObjectClassDefinition.isTolerantAuxiliaryObjectClasses();
}

@Override
public ObjectQuery createShadowSearchQuery(String resourceOid) throws SchemaException {
return refinedObjectClassDefinition.createShadowSearchQuery(resourceOid);
Expand Down
Expand Up @@ -147,6 +147,8 @@ default PrismObject<ShadowType> createBlankShadow() {
Collection<RefinedObjectClassDefinition> getAuxiliaryObjectClassDefinitions();

boolean hasAuxiliaryObjectClass(QName expectedObjectClassName);

boolean isTolerantAuxiliaryObjectClasses();

Collection<ResourceObjectPattern> getProtectedObjectPatterns();

Expand Down
Expand Up @@ -409,6 +409,19 @@ public boolean hasAuxiliaryObjectClass(QName expectedObjectClassName) {
return auxiliaryObjectClassDefinitions.stream()
.anyMatch(def -> QNameUtil.match(def.getTypeName(), expectedObjectClassName));
}

@Override
public boolean isTolerantAuxiliaryObjectClasses() {
if (schemaHandlingObjectTypeDefinitionType == null) {
return false;
}
Boolean tolerantAuxiliaryObjectClasses = schemaHandlingObjectTypeDefinitionType.isTolerantAuxiliaryObjectClasses();
if (tolerantAuxiliaryObjectClasses == null) {
return false;
} else {
return tolerantAuxiliaryObjectClasses;
}
}

@Override
public Collection<ResourceObjectPattern> getProtectedObjectPatterns() {
Expand Down
Expand Up @@ -4360,6 +4360,17 @@
point to object class definition (complex type definition in resource schema) and
this definition should be marked as auxiliary.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="tolerantAuxiliaryObjectClasses" type="xsd:boolean" minOccurs="0" maxOccurs="1" default="false">
<xsd:annotation>
<xsd:documentation>
If set to true then midPoitn will tolerate existing auxiliary object classes on resource
objects. MidPoitn will add/remove auxiliary object classes only if there is an explicit
operation for that (e.g. assign/unassign of role with auxiliary object class definition).
If set to false then midPoint will strictly synchronize auxiliary object classes of resource
objects with the definition given in midPoint configuration.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="baseContext" type="tns:ResourceObjectReferenceType" minOccurs="0">
Expand Down
Expand Up @@ -238,12 +238,14 @@ private void reconcileAuxiliaryObjectClasses(LensProjectionContext projCtx) thro
shouldBePvwo.getSource(), "it is given");
}
}

for (PrismPropertyValue<QName> isPValue : arePValues) {
if (!isInPvwoValues(valueMatcher, isPValue.getValue(), shouldBePValues)) {
auxObjectClassChanged = true;
recordDelta(valueMatcher, projCtx, ItemPath.EMPTY_PATH, propDef, ModificationType.DELETE,
isPValue.getValue(), null, "it is not given");

if (!projCtx.getStructuralObjectClassDefinition().isTolerantAuxiliaryObjectClasses()) {
for (PrismPropertyValue<QName> isPValue : arePValues) {
if (!isInPvwoValues(valueMatcher, isPValue.getValue(), shouldBePValues)) {
auxObjectClassChanged = true;
recordDelta(valueMatcher, projCtx, ItemPath.EMPTY_PATH, propDef, ModificationType.DELETE,
isPValue.getValue(), null, "it is not given");
}
}
}

Expand Down

0 comments on commit b3a1a6a

Please sign in to comment.