diff options
Diffstat (limited to 'eaaf_core_utils/src')
-rw-r--r-- | eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/TransactionIdUtils.java | 53 |
1 files changed, 50 insertions, 3 deletions
diff --git a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/TransactionIdUtils.java b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/TransactionIdUtils.java index d8976548..4cbcfa70 100644 --- a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/TransactionIdUtils.java +++ b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/TransactionIdUtils.java @@ -30,8 +30,19 @@ import at.gv.egiz.eaaf.core.api.IRequest; public class TransactionIdUtils { // MDC variables for logging + /** + * To correlate technical logs over one single transactions. + */ public static final String MDC_TRANSACTION_ID = "transactionId"; + + /** + * To correlate technical logs over a set of transactions, like SSO. + */ public static final String MDC_SESSION_ID = "sessionId"; + + /** + * Unique application identifier that is processed in this transaction. + */ public static final String MDC_SERVICEPROVIDER_ID = "oaId"; /** @@ -59,34 +70,70 @@ public class TransactionIdUtils { } + /** + * Set unique service-provider identifier for Logging purposes. + * + * @param oaUniqueId Unique application Id + */ public static void setServiceProviderId(final String oaUniqueId) { org.slf4j.MDC.put(MDC_SERVICEPROVIDER_ID, oaUniqueId); } + /** + * Remove service-provider identifier for Logging. + */ public static void removeServiceProviderId() { org.slf4j.MDC.remove(MDC_SERVICEPROVIDER_ID); } - public static void setTransactionId(final String pendingRequestID) { - org.slf4j.MDC.put(MDC_TRANSACTION_ID, "TID-" + pendingRequestID); + /** + * Get Id to correlate technical logs over one single transactions. + * + * @return Unique transaction Id + */ + public static String getTransactionId() { + return org.slf4j.MDC.get(MDC_TRANSACTION_ID); } + /** + * Set Id to correlate technical logs over one single transactions. + * + * @param transactionId Unique transaction Id + */ + public static void setTransactionId(final String transactionId) { + org.slf4j.MDC.put(MDC_TRANSACTION_ID, transactionId); + + } + + /** + * Remove transactionId for Logging. + */ public static void removeTransactionId() { org.slf4j.MDC.remove(MDC_TRANSACTION_ID); } + /** + * Set Id to correlate technical logs over a set of transactions, like SSO. + * + * @param uniqueSessionId Unique Id + */ public static void setSessionId(final String uniqueSessionId) { - org.slf4j.MDC.put(MDC_SESSION_ID, "SID-" + uniqueSessionId); + org.slf4j.MDC.put(MDC_SESSION_ID, uniqueSessionId); } + /** + * Remove sessionId for Logging. + * + */ public static void removeSessionId() { org.slf4j.MDC.remove(MDC_SESSION_ID); } + } |