[framework] TxCore → common-framework (ACM-FW-001)
This commit is contained in:
parent
a9be4bc4ef
commit
f10a82ec16
1 changed files with 47 additions and 0 deletions
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.klaro.acquirecore.framework;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transaction result DTO. Migrated from txcore.h tx_result_t.
|
||||||
|
*/
|
||||||
|
public class TxResult {
|
||||||
|
private boolean success;
|
||||||
|
private String txId;
|
||||||
|
private String message;
|
||||||
|
private Object data;
|
||||||
|
private long durationMs;
|
||||||
|
|
||||||
|
public TxResult() {}
|
||||||
|
|
||||||
|
public TxResult(boolean success, String txId) {
|
||||||
|
this.success = success;
|
||||||
|
this.txId = txId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TxResult(boolean success, String txId, String message) {
|
||||||
|
this(success, txId);
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TxResult ok(String txId) {
|
||||||
|
return new TxResult(true, txId, "Transaction committed successfully");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TxResult ok(String txId, String message) {
|
||||||
|
return new TxResult(true, txId, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TxResult fail(String txId, String message) {
|
||||||
|
return new TxResult(false, txId, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSuccess() { return success; }
|
||||||
|
public void setSuccess(boolean success) { this.success = success; }
|
||||||
|
public String getTxId() { return txId; }
|
||||||
|
public void setTxId(String txId) { this.txId = txId; }
|
||||||
|
public String getMessage() { return message; }
|
||||||
|
public void setMessage(String message) { this.message = message; }
|
||||||
|
public Object getData() { return data; }
|
||||||
|
public void setData(Object data) { this.data = data; }
|
||||||
|
public long getDurationMs() { return durationMs; }
|
||||||
|
public void setDurationMs(long durationMs) { this.durationMs = durationMs; }
|
||||||
|
}
|
||||||
Reference in a new issue