package com.elab.mq.api.transaction;


import com.aliyun.openservices.ons.api.transaction.TransactionStatus;

/**
 * 事务状态定义枚举
 *
 * @author Liukx
 * @create 2018-04-09 18:57
 * @email liukx@elab-plus.com
 **/
public enum TransactionStatusEnum {
    CommitTransaction,
    RollbackTransaction,
    Unknow;


    public static TransactionStatus getTransactionStatus(TransactionStatusEnum transactionStatusEnum) {
        if (TransactionStatus.CommitTransaction.name().equals(transactionStatusEnum.toString())) {
            return TransactionStatus.CommitTransaction;
        } else if (TransactionStatus.RollbackTransaction.name().equals(transactionStatusEnum.toString())) {
            return TransactionStatus.RollbackTransaction;
        } else {
            return TransactionStatus.Unknow;
        }
    }
}
