Search in sources :

Example 6 with AbstractMessageProto

use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.

the class GlobalReportResponseConvertor method convert2Proto.

@Override
public GlobalReportResponseProto convert2Proto(GlobalReportResponse globalStatusResponse) {
    final short typeCode = globalStatusResponse.getTypeCode();
    final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
    final String msg = globalStatusResponse.getMsg();
    final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(globalStatusResponse.getResultCode().name())).setAbstractMessage(abstractMessage).build();
    AbstractTransactionResponseProto abstractTransactionResponseProto = AbstractTransactionResponseProto.newBuilder().setAbstractResultMessage(abstractResultMessageProto).setTransactionExceptionCode(TransactionExceptionCodeProto.valueOf(globalStatusResponse.getTransactionExceptionCode().name())).build();
    AbstractGlobalEndResponseProto abstractGlobalEndResponseProto = AbstractGlobalEndResponseProto.newBuilder().setAbstractTransactionResponse(abstractTransactionResponseProto).setGlobalStatus(GlobalStatusProto.valueOf(globalStatusResponse.getGlobalStatus().name())).build();
    GlobalReportResponseProto result = GlobalReportResponseProto.newBuilder().setAbstractGlobalEndResponse(abstractGlobalEndResponseProto).build();
    return result;
}
Also used : AbstractResultMessageProto(io.seata.serializer.protobuf.generated.AbstractResultMessageProto) AbstractGlobalEndResponseProto(io.seata.serializer.protobuf.generated.AbstractGlobalEndResponseProto) AbstractTransactionResponseProto(io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto) AbstractMessageProto(io.seata.serializer.protobuf.generated.AbstractMessageProto) GlobalReportResponseProto(io.seata.serializer.protobuf.generated.GlobalReportResponseProto)

Example 7 with AbstractMessageProto

use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.

the class GlobalRollbackResponseConvertor method convert2Proto.

@Override
public GlobalRollbackResponseProto convert2Proto(GlobalRollbackResponse globalRollbackResponse) {
    final short typeCode = globalRollbackResponse.getTypeCode();
    final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
    final String msg = globalRollbackResponse.getMsg();
    final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(globalRollbackResponse.getResultCode().name())).setAbstractMessage(abstractMessage).build();
    AbstractTransactionResponseProto abstractTransactionResponseProto = AbstractTransactionResponseProto.newBuilder().setAbstractResultMessage(abstractResultMessageProto).setTransactionExceptionCode(TransactionExceptionCodeProto.valueOf(globalRollbackResponse.getTransactionExceptionCode().name())).build();
    AbstractGlobalEndResponseProto abstractGlobalEndResponseProto = AbstractGlobalEndResponseProto.newBuilder().setAbstractTransactionResponse(abstractTransactionResponseProto).setGlobalStatus(GlobalStatusProto.valueOf(globalRollbackResponse.getGlobalStatus().name())).build();
    GlobalRollbackResponseProto result = GlobalRollbackResponseProto.newBuilder().setAbstractGlobalEndResponse(abstractGlobalEndResponseProto).build();
    return result;
}
Also used : AbstractResultMessageProto(io.seata.serializer.protobuf.generated.AbstractResultMessageProto) AbstractGlobalEndResponseProto(io.seata.serializer.protobuf.generated.AbstractGlobalEndResponseProto) GlobalRollbackResponseProto(io.seata.serializer.protobuf.generated.GlobalRollbackResponseProto) AbstractTransactionResponseProto(io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto) AbstractMessageProto(io.seata.serializer.protobuf.generated.AbstractMessageProto)

Example 8 with AbstractMessageProto

use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.

the class MergedWarpMessageConvertor method convert2Proto.

@Override
public MergedWarpMessageProto convert2Proto(MergedWarpMessage mergedWarpMessage) {
    final short typeCode = mergedWarpMessage.getTypeCode();
    final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
    List<Any> lists = new ArrayList<>();
    for (AbstractMessage msg : mergedWarpMessage.msgs) {
        final PbConvertor pbConvertor = ProtobufConvertManager.getInstance().fetchConvertor(msg.getClass().getName());
        lists.add(Any.pack((Message) pbConvertor.convert2Proto(msg)));
    }
    MergedWarpMessageProto mergedWarpMessageProto = MergedWarpMessageProto.newBuilder().setAbstractMessage(abstractMessage).addAllMsgs(lists).addAllMsgIds(mergedWarpMessage.msgIds).build();
    return mergedWarpMessageProto;
}
Also used : MergedWarpMessageProto(io.seata.serializer.protobuf.generated.MergedWarpMessageProto) AbstractMessage(io.seata.core.protocol.AbstractMessage) AbstractMessage(io.seata.core.protocol.AbstractMessage) Message(com.google.protobuf.Message) MergedWarpMessage(io.seata.core.protocol.MergedWarpMessage) ArrayList(java.util.ArrayList) Any(com.google.protobuf.Any) AbstractMessageProto(io.seata.serializer.protobuf.generated.AbstractMessageProto)

Example 9 with AbstractMessageProto

use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.

the class RegisterTMRequestConvertor method convert2Proto.

@Override
public RegisterTMRequestProto convert2Proto(RegisterTMRequest registerTMRequest) {
    final short typeCode = registerTMRequest.getTypeCode();
    final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
    final String extraData = registerTMRequest.getExtraData();
    AbstractIdentifyRequestProto abstractIdentifyRequestProto = AbstractIdentifyRequestProto.newBuilder().setAbstractMessage(abstractMessage).setApplicationId(registerTMRequest.getApplicationId()).setExtraData(extraData == null ? "" : extraData).setTransactionServiceGroup(registerTMRequest.getTransactionServiceGroup()).setVersion(registerTMRequest.getVersion()).build();
    RegisterTMRequestProto result = RegisterTMRequestProto.newBuilder().setAbstractIdentifyRequest(abstractIdentifyRequestProto).build();
    return result;
}
Also used : RegisterTMRequestProto(io.seata.serializer.protobuf.generated.RegisterTMRequestProto) AbstractIdentifyRequestProto(io.seata.serializer.protobuf.generated.AbstractIdentifyRequestProto) AbstractMessageProto(io.seata.serializer.protobuf.generated.AbstractMessageProto)

Example 10 with AbstractMessageProto

use of io.seata.serializer.protobuf.generated.AbstractMessageProto in project seata by seata.

the class UndoLogDeleteRequestConvertor method convert2Proto.

@Override
public UndoLogDeleteRequestProto convert2Proto(UndoLogDeleteRequest undoLogDeleteRequest) {
    final short typeCode = undoLogDeleteRequest.getTypeCode();
    final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();
    final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto.newBuilder().setAbstractMessage(abstractMessage).build();
    final UndoLogDeleteRequestProto undoLogDeleteRequestProto = UndoLogDeleteRequestProto.newBuilder().setAbstractTransactionRequest(abstractTransactionRequestProto).setSaveDays(undoLogDeleteRequest.getSaveDays()).setBranchType(BranchTypeProto.valueOf(undoLogDeleteRequest.getBranchType().name())).setResourceId(undoLogDeleteRequest.getResourceId()).build();
    return undoLogDeleteRequestProto;
}
Also used : UndoLogDeleteRequestProto(io.seata.serializer.protobuf.generated.UndoLogDeleteRequestProto) AbstractMessageProto(io.seata.serializer.protobuf.generated.AbstractMessageProto) AbstractTransactionRequestProto(io.seata.serializer.protobuf.generated.AbstractTransactionRequestProto)

Aggregations

AbstractMessageProto (io.seata.serializer.protobuf.generated.AbstractMessageProto)27 AbstractResultMessageProto (io.seata.serializer.protobuf.generated.AbstractResultMessageProto)12 AbstractTransactionRequestProto (io.seata.serializer.protobuf.generated.AbstractTransactionRequestProto)11 AbstractTransactionResponseProto (io.seata.serializer.protobuf.generated.AbstractTransactionResponseProto)10 AbstractGlobalEndRequestProto (io.seata.serializer.protobuf.generated.AbstractGlobalEndRequestProto)4 AbstractGlobalEndResponseProto (io.seata.serializer.protobuf.generated.AbstractGlobalEndResponseProto)4 Any (com.google.protobuf.Any)2 Message (com.google.protobuf.Message)2 AbstractMessage (io.seata.core.protocol.AbstractMessage)2 AbstractBranchEndRequestProto (io.seata.serializer.protobuf.generated.AbstractBranchEndRequestProto)2 AbstractBranchEndResponseProto (io.seata.serializer.protobuf.generated.AbstractBranchEndResponseProto)2 AbstractIdentifyRequestProto (io.seata.serializer.protobuf.generated.AbstractIdentifyRequestProto)2 AbstractIdentifyResponseProto (io.seata.serializer.protobuf.generated.AbstractIdentifyResponseProto)2 BranchRegisterRequestProto (io.seata.serializer.protobuf.generated.BranchRegisterRequestProto)2 ArrayList (java.util.ArrayList)2 AbstractResultMessage (io.seata.core.protocol.AbstractResultMessage)1 MergeResultMessage (io.seata.core.protocol.MergeResultMessage)1 MergedWarpMessage (io.seata.core.protocol.MergedWarpMessage)1 BranchCommitRequestProto (io.seata.serializer.protobuf.generated.BranchCommitRequestProto)1 BranchCommitResponseProto (io.seata.serializer.protobuf.generated.BranchCommitResponseProto)1