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
A DiscardApprover that 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-attribute and undefine-attribute operation transformation as well as resource transformation.

  • Constructor Details

    • AttributeValueDiscardApprover

      public AttributeValueDiscardApprover(String attributeName, org.jboss.dmr.ModelNode approvedValue, boolean allowUndefined)
      Creates a new transformer.
      Parameters:
      attributeName - the name of the attribute to check
      approvedValue - the value the attribute must have in order to allow transformation
      allowUndefined - true if the attribute can also be undefined
  • Method Details

    • isResourceDiscardAllowed

      public boolean isResourceDiscardAllowed(TransformationContext context, PathAddress address, Resource resource)
      Description copied from interface: DiscardAttributesTransformer.DiscardApprover
      Replies with whether resource transformation should be done.
      Specified by:
      isResourceDiscardAllowed in interface DiscardAttributesTransformer.DiscardApprover
      Parameters:
      context - the context
      address - the address of the resource to transform
      resource - the resource
      Returns:
      true if transformation should be done; false if 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 for add, write-attribute and undefine-attribute operation transformation. Replies with whether operation transformation should be done.
      Specified by:
      isOperationDiscardAllowed in interface DiscardAttributesTransformer.DiscardApprover
      Parameters:
      context - the context
      address - the address of the resource to transform
      operation - the operation
      Returns:
      true if transformation should be done; false if the operation should be left as is
      Throws:
      IllegalStateException - if the operation name isn't add, write-attribute or undefine-attribute