clustering/common/src/main/java/org/jboss/as/clustering/controller/transform/ChainedOperationTransformer.java
@Override
    public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode originalOperation) throws OperationFailedException {
        String originalName = Operations.getName(originalOperation);
        PathAddress originalAddress = Operations.getPathAddress(originalOperation);
        Deque<ModelNode> preSteps = new LinkedList<>();
        Deque<ModelNode> postSteps = new LinkedList<>();
        ModelNode operation = originalOperation;
        for (OperationTransformer transformer: this.transformers) {
            operation = transformer.transformOperation(context, address, operation).getTransformedOperation();
            // If the transformed operation is a composite operation, locate the modified operation and record any pre/post operations
            if (this.collate && operation.get(ModelDescriptionConstants.OP).asString().equals(ModelDescriptionConstants.COMPOSITE)) {
                List<ModelNode> stepList = operation.get(ModelDescriptionConstants.STEPS).asList();
                ListIterator<ModelNode> steps = stepList.listIterator();
                while (steps.hasNext()) {
                    ModelNode step = steps.next();
                    String operationName = Operations.getName(step);
                    PathAddress operationAddress = Operations.getPathAddress(step);
                    if (operationName.equals(originalName) && operationAddress.equals(originalAddress)) {
                        operation = step;
                        break;
                    }
                    preSteps.addLast(step);
                }
                steps = stepList.listIterator(stepList.size());
                while (steps.hasPrevious()) {
                    ModelNode step = steps.previous();
                    String operationName = Operations.getName(step);
                    PathAddress operationAddress = Operations.getPathAddress(step);
                    if (operationName.equals(originalName) && operationAddress.equals(originalAddress)) {
                        break;
                    }
                    postSteps.addFirst(step);
                }
            }
        }
        if (this.collate) {
            int count = preSteps.size() + postSteps.size() + 1;
            // If there are any pre or post steps, we need a composite operation
            if (count > 1) {
                List<ModelNode> steps = new ArrayList<>(count);
                steps.addAll(preSteps);
                steps.add(operation);
                steps.addAll(postSteps);
                operation = Operations.createCompositeOperation(steps);
            }
        }
        return new TransformedOperation(operation, OperationResultTransformer.ORIGINAL_RESULT);
    }
@Override
    public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode originalOperation) throws OperationFailedException {
        String originalName = Operations.getName(originalOperation);
        PathAddress originalAddress = Operations.getPathAddress(originalOperation);
        Deque<ModelNode> preSteps = new LinkedList<>();
        Deque<ModelNode> postSteps = new LinkedList<>();
        ModelNode operation = originalOperation;
        for (OperationTransformer transformer: this.transformers) {
            operation = transformer.transformOperation(context, address, operation).getTransformedOperation();
            // If the transformed operation is a composite operation, locate the modified operation and record any pre/post operations
            if (this.collate && operation.get(ModelDescriptionConstants.OP).asString().equals(ModelDescriptionConstants.COMPOSITE)) {
                List<ModelNode> stepList = operation.get(ModelDescriptionConstants.STEPS).asList();
                ListIterator<ModelNode> steps = stepList.listIterator();
                while (steps.hasNext()) {
                    ModelNode step = steps.next();
                    String operationName = Operations.getName(step);
                    PathAddress operationAddress = Operations.getPathAddress(step);
                    if (operationName.equals(originalName) && operationAddress.equals(originalAddress)) {
                        operation = step;
                        break;
                    }
                    preSteps.addLast(step);
                }
                steps = stepList.listIterator(stepList.size());
                while (steps.hasPrevious()) {
                    ModelNode step = steps.previous();
                    String operationName = Operations.getName(step);
                    PathAddress operationAddress = Operations.getPathAddress(step);
                    if (operationName.equals(originalName) && operationAddress.equals(originalAddress)) {
                        break;
                    }
                    postSteps.addFirst(step);
                }
            }
        }
        if (this.collate) {
            int count = preSteps.size() + postSteps.size() + 1;
            // If there are any pre or post steps, we need a composite operation
            if (count > 1) {
                List<ModelNode> steps = new ArrayList<>(count);
                steps.addAll(preSteps);
                steps.add(operation);
                steps.addAll(postSteps);
                operation = Operations.createCompositeOperation(steps);
            }
        }
        return new TransformedOperation(operation, OperationResultTransformer.ORIGINAL_RESULT);
    }
@ Override public TransformedOperation transformOperation ( TransformationContext context , PathAddress address , ModelNode originalOperation ) throws OperationFailedException { String originalName = Operations . getName ( originalOperation ) ; PathAddress originalAddress = Operations . getPathAddress ( originalOperation ) ; Deque < ModelNode > preSteps = new LinkedList <> ( ) ; Deque < ModelNode > postSteps = new LinkedList <> ( ) ; ModelNode operation = originalOperation ; for ( OperationTransformer transformer : this . transformers ) { operation = transformer . transformOperation ( context , address , operation ) . getTransformedOperation ( ) ; // If the transformed operation is a composite operation, locate the modified operation and record any pre/post operations if ( this . collate && operation . get ( ModelDescriptionConstants . OP ) . asString ( ) . equals ( ModelDescriptionConstants . COMPOSITE ) ) { List < ModelNode > stepList = operation . get ( ModelDescriptionConstants . STEPS ) . asList ( ) ; ListIterator < ModelNode > steps = stepList . listIterator ( ) ; while ( steps . hasNext ( ) ) { ModelNode step = steps . next ( ) ; String operationName = Operations . getName ( step ) ; PathAddress operationAddress = Operations . getPathAddress ( step ) ; if ( operationName . equals ( originalName ) && operationAddress . equals ( originalAddress ) ) { operation = step ; break ; } preSteps . addLast ( step ) ; } steps = stepList . listIterator ( stepList . size ( ) ) ; while ( steps . hasPrevious ( ) ) { ModelNode step = steps . previous ( ) ; String operationName = Operations . getName ( step ) ; PathAddress operationAddress = Operations . getPathAddress ( step ) ; if ( operationName . equals ( originalName ) && operationAddress . equals ( originalAddress ) ) { break ; } postSteps . addFirst ( step ) ; } } } if ( this . collate ) { int count = preSteps . size ( ) + postSteps . size ( ) + 1 ; // If there are any pre or post steps, we need a composite operation if ( count > 1 ) { List < ModelNode > steps = new ArrayList <> ( count ) ; steps . addAll ( preSteps ) ; steps . add ( operation ) ; steps . addAll ( postSteps ) ; operation = Operations . createCompositeOperation ( steps ) ; } } return new TransformedOperation ( operation , OperationResultTransformer . ORIGINAL_RESULT ) ; }
{@inheritDoc}
{