All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.isuwang.soa.core.SoaHeader Maven / Gradle / Ivy

package com.isuwang.soa.core;

import java.util.Optional;

/**
 * Created by tangliu on 2016/1/11.
 */
public class SoaHeader {

    /**
     * 服务名称
     */
    private String serviceName;

    /**
     * 方法名称
     */
    private String methodName;

    /**
     * 版本号
     */
    private String versionName;

    /**
     * 调用源
     */
    private Optional callerFrom = Optional.empty();

    /**
     * 返回码
     */
    private Optional respCode = Optional.empty();

    /**
     * 返回信息
     */
    private Optional respMessage = Optional.empty();

    /**
     * 调用源ip
     */
    private Optional callerIp = Optional.empty();

    /**
     * 操作人编号
     */
    private Optional operatorId = Optional.empty();

    /**
     * 操作人名称
     */
    private Optional operatorName = Optional.empty();

    /**
     * 客户编号
     */
    private Optional customerId = Optional.empty();

    /**
     * 客户名称
     */
    private Optional customerName = Optional.empty();


    /**
     * 全局事务id
     */
    private Optional transactionId = Optional.empty();

    /**
     * 当前过程所属序列号
     */
    private Optional transactionSequence = Optional.empty();

    public String toString() {

        StringBuilder sb = new StringBuilder("{");

        sb.append("\"").append("serviceName").append("\":\"").append(this.serviceName).append("\",");
        sb.append("\"").append("methodName").append("\":\"").append(this.methodName).append("\",");
        sb.append("\"").append("versionName").append("\":\"").append(this.versionName).append("\",");
        sb.append("\"").append("transactionId").append("\":\"").append(this.transactionId.isPresent() ? this.transactionId.get() : null).append("\",");
        sb.append("\"").append("transactionSequence").append("\":\"").append(this.transactionSequence.isPresent() ? this.transactionSequence.get() : null).append("\",");
        sb.append("\"").append("callerFrom").append("\":\"").append(this.callerFrom.isPresent() ? this.callerFrom.get() : null).append("\",");
        sb.append("\"").append("callerIp").append("\":\"").append(this.callerIp.isPresent() ? this.callerIp.get() : null).append("\",");
        sb.append("\"").append("operatorId").append("\":").append(this.operatorId.isPresent() ? this.operatorId.get() : null).append(",");
        sb.append("\"").append("operatorName").append("\":\"").append(this.operatorName.isPresent() ? this.operatorName.get() : null).append("\",");
        sb.append("\"").append("customerId").append("\":").append(this.customerId.isPresent() ? this.customerId.get() : null).append(",");
        sb.append("\"").append("customerName").append("\":\"").append(this.customerName.isPresent() ? this.customerName.get() : null).append("\",");
        sb.append("\"").append("respCode").append("\":\"").append(this.respCode.isPresent() ? this.respCode.get() : null).append("\",");
        sb.append("\"").append("respMessage").append("\":\"").append(this.respMessage.isPresent() ? this.respMessage.get() : null).append("\",");

        sb.deleteCharAt(sb.lastIndexOf(","));
        sb.append("}");
        return sb.toString();
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public String getVersionName() {
        return versionName;
    }

    public void setVersionName(String versionName) {
        this.versionName = versionName;
    }

    public Optional getCallerIp() {
        return callerIp;
    }

    public void setCallerIp(Optional callerIp) {
        this.callerIp = callerIp;
    }

    public Optional getOperatorId() {
        return operatorId;
    }

    public void setOperatorId(Optional operatorId) {
        this.operatorId = operatorId;
    }

    public Optional getOperatorName() {
        return operatorName;
    }

    public void setOperatorName(Optional operatorName) {
        this.operatorName = operatorName;
    }

    public Optional getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Optional customerId) {
        this.customerId = customerId;
    }

    public Optional getCustomerName() {
        return customerName;
    }

    public void setCustomerName(Optional customerName) {
        this.customerName = customerName;
    }

    public Optional getRespCode() {
        return respCode;
    }

    public void setRespCode(Optional respCode) {
        this.respCode = respCode;
    }

    public Optional getRespMessage() {
        return respMessage;
    }

    public void setRespMessage(Optional respMessage) {
        this.respMessage = respMessage;
    }

    public Optional getCallerFrom() {
        return callerFrom;
    }

    public void setCallerFrom(Optional callerFrom) {
        this.callerFrom = callerFrom;
    }

    public Optional getTransactionId() {
        return transactionId;
    }

    public void setTransactionId(Optional transactionId) {
        this.transactionId = transactionId;
    }

    public Optional getTransactionSequence() {
        return transactionSequence;
    }

    public void setTransactionSequence(Optional transactionSequence) {
        this.transactionSequence = transactionSequence;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy