Skip to content

Commit

Permalink
ResourceAttributes checks for schema application
Browse files Browse the repository at this point in the history
  • Loading branch information
tonydamage committed May 27, 2021
1 parent 5423dbd commit f7d435d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Expand Up @@ -17,6 +17,7 @@
import com.evolveum.midpoint.prism.*;
import com.evolveum.midpoint.prism.impl.PrismContainerImpl;
import com.evolveum.midpoint.prism.path.ItemName;
import com.evolveum.midpoint.util.Checks;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowAttributesType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType;
Expand Down Expand Up @@ -415,9 +416,20 @@ public void checkConsistenceInternal(Itemable rootItem, boolean requireDefinitio
}
}

@Override
public void applyDefinition(PrismContainerDefinition<ShadowAttributesType> definition, boolean force)
throws SchemaException {
if (definition != null) {
Checks.checkSchema(definition instanceof ResourceAttributeContainerDefinition, "Definition should be %s not %s" ,
ResourceAttributeContainerDefinition.class.getSimpleName(), definition.getClass().getName());
}
super.applyDefinition(definition, force);
}

/**
* Return a human readable name of this class suitable for logs.
*/
@Override
protected String getDebugDumpClassName() {
return "RAC";
}
Expand Down
Expand Up @@ -11,7 +11,10 @@

import com.evolveum.midpoint.prism.CloneStrategy;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.PrismPropertyDefinition;
import com.evolveum.midpoint.prism.impl.PrismPropertyImpl;
import com.evolveum.midpoint.util.Checks;
import com.evolveum.midpoint.util.exception.SchemaException;

/**
* Resource Object Attribute is a Property of Resource Object. All that applies
Expand Down Expand Up @@ -95,8 +98,17 @@ protected void copyValues(CloneStrategy strategy, ResourceAttributeImpl<T> clone
/**
* Return a human readable name of this class suitable for logs.
*/
@Override
protected String getDebugDumpClassName() {
return "RA";
}

@Override
public void applyDefinition(PrismPropertyDefinition<T> definition, boolean force) throws SchemaException {
if (definition != null) {
Checks.checkSchema(definition instanceof ResourceAttributeDefinition, "Definition should be %s not %s" ,
ResourceAttributeDefinition.class.getSimpleName(), definition.getClass().getName());
}
super.applyDefinition(definition, force);
}
}
Expand Up @@ -9,7 +9,10 @@

/**
* @author mederly
*
* @deprecated Unused
*/
@Deprecated
public interface SpecificAttributesDefinition<RAD extends ResourceAttributeDefinition<?>> {


Expand Down

0 comments on commit f7d435d

Please sign in to comment.