Package org.forgerock.services
Class TransactionId
java.lang.Object
org.forgerock.services.TransactionId
TransactionId value should be unique per request coming from an external agent so that all events occurring in
response to the same external stimulus can be tied together.
Calls to external systems should propagate the value returned by
createSubTransactionId()
so that Audit
events reported by the external system can also be tied back to the original stimulus.
Due to the fact that each TransactionId instance creates a sequence of sub-transaction IDs, the same TransactionId
object should be used while fulfilling a given request; it is not appropriate to create multiple instances of
TransactionId with the same value as this would lead to duplicate sub-transaction ID values. As such, two instances
of TransactionId with the same value are not considered equal.
This class is thread-safe.- Since:
- 2.0
-
Constructor Summary
ConstructorDescriptionConstruct aTransactionId
with a random value.TransactionId
(String value) Construct aTransactionId
with the specified value. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new TransactionId, child of this one.getValue()
Returns the value of this TransactionId.toJson()
Returns a representation of this TransactionId as a JsonValue.static TransactionId
Creates a TransactionId from a JsonValue.
-
Constructor Details
-
TransactionId
public TransactionId()Construct aTransactionId
with a random value. -
TransactionId
Construct aTransactionId
with the specified value. The value must not be null nor empty.- Parameters:
value
- The value to initialize the transactionId from.
-
-
Method Details
-
getValue
Returns the value of this TransactionId.- Returns:
- Non-null,
TransactionId
value.
-
createSubTransactionId
Creates a new TransactionId, child of this one.- Returns:
- Non-null,
TransactionId
value that can be passed to an external system.
-
toJson
Returns a representation of this TransactionId as a JsonValue. The JsonValue will be composed of 2 fields : value and subTransactionIdCounter.- Returns:
- a representation of this TransactionId as a JsonValue.
-
valueOf
Creates a TransactionId from a JsonValue.- Parameters:
value
- the JsonValue used to create the TransactionId, composed of 2 fields : value and subTransactionIdCounter.- Returns:
- a TransactionId initialized with the values provided by the JsonValue.
-