public static class DiscardAttributesTransformer.AttributeValueDiscardApprover extends Object implements DiscardAttributesTransformer.DiscardApprover
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 and Description |
---|
AttributeValueDiscardApprover(String attributeName,
org.jboss.dmr.ModelNode approvedValue,
boolean allowUndefined)
Creates a new transformer.
|
Modifier and Type | Method and Description |
---|---|
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.
|
boolean |
isResourceDiscardAllowed(TransformationContext context,
PathAddress address,
Resource resource)
Replies with whether resource transformation should be done.
|
public AttributeValueDiscardApprover(String attributeName, org.jboss.dmr.ModelNode approvedValue, boolean allowUndefined)
attributeName
- the name of the attribute to checkapprovedValue
- the value the attribute must have in order to allow transformationallowUndefined
- true
if the attribute can also be undefinedpublic boolean isResourceDiscardAllowed(TransformationContext context, PathAddress address, Resource resource)
DiscardAttributesTransformer.DiscardApprover
isResourceDiscardAllowed
in interface DiscardAttributesTransformer.DiscardApprover
context
- the contextaddress
- the address of the resource to transformresource
- the resourcetrue
if transformation should be done; false
if the resource should be left as ispublic boolean isOperationDiscardAllowed(TransformationContext context, PathAddress address, org.jboss.dmr.ModelNode operation)
add
, write-attribute
and undefine-attribute
operation transformation.
Replies with whether operation transformation should be done.isOperationDiscardAllowed
in interface DiscardAttributesTransformer.DiscardApprover
context
- the contextaddress
- the address of the resource to transformoperation
- the operationtrue
if transformation should be done; false
if the operation should be left as isIllegalStateException
- if the operation name isn't add
, write-attribute
or undefine-attribute
Copyright © 2023 JBoss by Red Hat. All rights reserved.