2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.access.commands;
10 import akka.actor.ActorRef;
11 import com.google.common.annotations.Beta;
12 import com.google.common.base.MoreObjects.ToStringHelper;
13 import com.google.common.collect.ImmutableList;
14 import java.util.List;
15 import java.util.Optional;
16 import org.opendaylight.controller.cluster.access.ABIVersion;
17 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
20 * A transaction request to apply a particular set of operations on top of the current transaction. This message is
21 * used to also finish a transaction by specifying a {@link PersistenceProtocol}.
23 * @author Robert Varga
26 public final class ModifyTransactionRequest extends TransactionRequest<ModifyTransactionRequest> {
27 private static final long serialVersionUID = 1L;
28 private final List<TransactionModification> modifications;
29 private final PersistenceProtocol protocol;
31 ModifyTransactionRequest(final TransactionIdentifier target, final long sequence, final ActorRef replyTo,
32 final List<TransactionModification> modifications, final PersistenceProtocol protocol) {
33 super(target, sequence, replyTo);
34 this.modifications = ImmutableList.copyOf(modifications);
35 this.protocol = protocol;
38 public Optional<PersistenceProtocol> getPersistenceProtocol() {
39 return Optional.ofNullable(protocol);
42 public List<TransactionModification> getModifications() {
47 protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
48 return super.addToStringAttributes(toStringHelper).add("operations", modifications).add("protocol", protocol);
52 protected ModifyTransactionRequestProxyV1 externalizableProxy(final ABIVersion version) {
53 return new ModifyTransactionRequestProxyV1(this);
57 protected ModifyTransactionRequest cloneAsVersion(final ABIVersion version) {