Class DiscardAttributesTransformer.AttributeValueDiscardApprover
- java.lang.Object
-
- org.jboss.as.controller.transform.DiscardAttributesTransformer.AttributeValueDiscardApprover
-
- All Implemented Interfaces:
DiscardAttributesTransformer.DiscardApprover
- Enclosing class:
- DiscardAttributesTransformer
public static class DiscardAttributesTransformer.AttributeValueDiscardApprover extends Object implements DiscardAttributesTransformer.DiscardApprover
ADiscardApproverthat checks the value of a provided attribute in order to decide whether transformation is allowed. If the attribute has the desired value (or is undefined if allowing that is configured) then the transformation is allowed.This approver can only be used for
add,write-attributeandundefine-attributeoperation transformation as well as resource transformation.
-
-
Constructor Summary
Constructors Constructor Description AttributeValueDiscardApprover(String attributeName, org.jboss.dmr.ModelNode approvedValue, boolean allowUndefined)Creates a new transformer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisOperationDiscardAllowed(TransformationContext context, PathAddress address, org.jboss.dmr.ModelNode operation)Checks if the value of the resource after the operation is applied would meet the criteria.booleanisResourceDiscardAllowed(TransformationContext context, PathAddress address, Resource resource)Replies with whether resource transformation should be done.
-
-
-
Constructor Detail
-
AttributeValueDiscardApprover
public AttributeValueDiscardApprover(String attributeName, org.jboss.dmr.ModelNode approvedValue, boolean allowUndefined)
Creates a new transformer.- Parameters:
attributeName- the name of the attribute to checkapprovedValue- the value the attribute must have in order to allow transformationallowUndefined-trueif the attribute can also be undefined
-
-
Method Detail
-
isResourceDiscardAllowed
public boolean isResourceDiscardAllowed(TransformationContext context, PathAddress address, Resource resource)
Description copied from interface:DiscardAttributesTransformer.DiscardApproverReplies with whether resource transformation should be done.- Specified by:
isResourceDiscardAllowedin interfaceDiscardAttributesTransformer.DiscardApprover- Parameters:
context- the contextaddress- the address of the resource to transformresource- the resource- Returns:
trueif transformation should be done;falseif the resource should be left as is
-
isOperationDiscardAllowed
public boolean isOperationDiscardAllowed(TransformationContext context, PathAddress address, org.jboss.dmr.ModelNode operation)
Checks if the value of the resource after the operation is applied would meet the criteria. Can only be used foradd,write-attributeandundefine-attributeoperation transformation. Replies with whether operation transformation should be done.- Specified by:
isOperationDiscardAllowedin interfaceDiscardAttributesTransformer.DiscardApprover- Parameters:
context- the contextaddress- the address of the resource to transformoperation- the operation- Returns:
trueif transformation should be done;falseif the operation should be left as is- Throws:
IllegalStateException- if the operation name isn'tadd,write-attributeorundefine-attribute
-
-