public List forOperations()

in curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorMultiTransactionImpl.java [115:152]


    public List<CuratorTransactionResult> forOperations(List<CuratorOp> operations) throws Exception {
        operations = Preconditions.checkNotNull(operations, "operations cannot be null");
        Preconditions.checkArgument(!operations.isEmpty(), "operations list cannot be empty");

        CuratorMultiTransactionRecord record = new CuratorMultiTransactionRecord();
        for (CuratorOp curatorOp : operations) {
            Schema schema =
                    client.getSchemaSet().getSchema(curatorOp.getTypeAndPath().getForPath());
            record.add(
                    curatorOp.get(),
                    curatorOp.getTypeAndPath().getType(),
                    curatorOp.getTypeAndPath().getForPath());
            if ((curatorOp.get().getType() == ZooDefs.OpCode.create)
                    || (curatorOp.get().getType() == ZooDefs.OpCode.createContainer)) {
                CreateRequest createRequest = (CreateRequest) curatorOp.get().toRequestRecord();
                CreateMode createMode = CreateMode.fromFlag(createRequest.getFlags(), CreateMode.PERSISTENT);
                schema.validateCreate(
                        createMode, createRequest.getPath(), createRequest.getData(), createRequest.getAcl());
            } else if ((curatorOp.get().getType() == ZooDefs.OpCode.delete)
                    || (curatorOp.get().getType() == ZooDefs.OpCode.deleteContainer)) {
                DeleteRequest deleteRequest = (DeleteRequest) curatorOp.get().toRequestRecord();
                schema.validateDelete(deleteRequest.getPath());
            } else if (curatorOp.get().getType() == ZooDefs.OpCode.setData) {
                SetDataRequest setDataRequest = (SetDataRequest) curatorOp.get().toRequestRecord();
                schema.validateGeneral(setDataRequest.getPath(), setDataRequest.getData(), null);
            }
        }

        if (backgrounding.inBackground()) {
            client.processBackgroundOperation(
                    new OperationAndData<>(
                            this, record, backgrounding.getCallback(), null, backgrounding.getContext(), null),
                    null);
            return null;
        } else {
            return forOperationsInForeground(record);
        }
    }