2 * Copyright (c) 2014 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
9 package org.opendaylight.controller.cluster.datastore.messages;
12 import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
15 public class CreateTransaction implements SerializableMessage {
16 public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.CreateTransaction.class;
17 private final String transactionId;
18 private final int transactionType;
20 public CreateTransaction(String transactionId, int transactionType){
22 this.transactionId = transactionId;
23 this.transactionType = transactionType;
26 public String getTransactionId() {
30 public int getTransactionType() { return transactionType;}
33 public Object toSerializable() {
34 return ShardTransactionMessages.CreateTransaction.newBuilder().setTransactionId(transactionId).setTransactionType(transactionType).build();
37 public static CreateTransaction fromSerializable(Object message){
38 ShardTransactionMessages.CreateTransaction createTransaction = (ShardTransactionMessages.CreateTransaction)message;
39 return new CreateTransaction(createTransaction.getTransactionId(),createTransaction.getTransactionType() );