Class TreeState.Builder

java.lang.Object
org.forgerock.am.trees.model.TreeState.Builder
Enclosing class:
TreeState

public static final class TreeState.Builder extends Object
A builder for TreeState objects.
  • Method Details

    • withSharedState

      public TreeState.Builder withSharedState(JsonValue sharedState)
      Sets the shared state.
      Parameters:
      sharedState - the shared state
      Returns:
      this builder
    • withSharedStateFrom

      public TreeState.Builder withSharedStateFrom(TreeState previousState, Action action)
      Sets the shared state from the provided action if present, or the previous tree state otherwise. Also sets the error message and lockout message if present.
      Parameters:
      previousState - the previous tree state
      action - the last action
      Returns:
      this builder
    • withTransientState

      public TreeState.Builder withTransientState(JsonValue transientState)
      Sets the transient state.
      Parameters:
      transientState - the transient state
      Returns:
      this builder
    • withTransientStateFrom

      public TreeState.Builder withTransientStateFrom(TreeState previousState, Action action)
      Sets the transient state from the provided action if present, or the previous tree state otherwise.
      Parameters:
      previousState - the previous tree state
      action - the last action
      Returns:
      this builder
    • withSecureState

      public TreeState.Builder withSecureState(JsonValue secureState)
      Sets the secure state.
      Parameters:
      secureState - the secure state
      Returns:
      this builder
    • withUnencryptedSecureState

      public TreeState.Builder withUnencryptedSecureState(JsonValue unencryptedSecureState)
      Sets the unencrypted secure state.
      Parameters:
      unencryptedSecureState - the unencrypted secure state
      Returns:
      this builder
    • withCurrentNodeId

      public TreeState.Builder withCurrentNodeId(UUID currentNodeId)
      Sets the current node ID.
      Parameters:
      currentNodeId - the current node ID
      Returns:
      this builder
    • withSessionProperties

      public TreeState.Builder withSessionProperties(SessionProperties sessionProperties)
      Sets the session properties.
      Parameters:
      sessionProperties - the session properties
      Returns:
      this builder
    • withSessionPropertiesFrom

      public TreeState.Builder withSessionPropertiesFrom(TreeState previousState, Action action)
      Sets the combined session properties from the provided action and previous state. Sets the max session time and max idle time from the action if present, or the previous tree state otherwise.
      Parameters:
      previousState - the previous tree state
      action - the last action
      Returns:
      this builder
    • withSessionHooks

      public TreeState.Builder withSessionHooks(List<JsonValue> sessionHooks)
      Sets the session hooks.
      Parameters:
      sessionHooks - the session hooks
      Returns:
      this builder
    • withSessionHooksFrom

      public TreeState.Builder withSessionHooksFrom(TreeState previousState, Action action)
      Sets the session hooks from the previous state, followed by those from the provided action.
      Parameters:
      previousState - the previous tree state
      action - the last action
      Returns:
      this builder
    • withWebhooks

      public TreeState.Builder withWebhooks(List<String> webhooks)
      Sets the webhooks.
      Parameters:
      webhooks - the webhooks
      Returns:
      this builder
    • withWebhooksFrom

      public TreeState.Builder withWebhooksFrom(TreeState previousState, Action action)
      Sets the webhooks from the previous state, followed by those from the provided action.
      Parameters:
      previousState - the previous tree state
      action - the last action
      Returns:
      this builder
    • withUniversalId

      public TreeState.Builder withUniversalId(String universalId)
      Sets the universal ID.
      Parameters:
      universalId - the universal ID
      Returns:
      this builder
    • withUniversalIdFrom

      public TreeState.Builder withUniversalIdFrom(TreeState previousState, Action action)
      Sets the universal ID from the provided action if present, or the previous tree state otherwise.
      Parameters:
      previousState - the previous tree state
      action - the last action
      Returns:
      this builder
    • withIdentifiedIdentity

      public TreeState.Builder withIdentifiedIdentity(IdentifiedIdentity identifiedIdentity)
      Sets the identified identity.
      Parameters:
      identifiedIdentity - the identified identity
      Returns:
      this builder
    • withIdentifiedIdentityFrom

      public TreeState.Builder withIdentifiedIdentityFrom(TreeState previousState, Action action)
      Sets the identified identity from the provided action if present, or the previous tree state otherwise. Logs a warning if both are present and different.
      Parameters:
      previousState - the previous tree state
      action - the last action
      Returns:
      this builder
    • withMaxTreeDuration

      public TreeState.Builder withMaxTreeDuration(Duration maxTreeDuration)
      Sets the maximum duration of the tree.
      Parameters:
      maxTreeDuration - the maximum duration of the tree
      Returns:
      this builder
    • withMaxTreeDurationFrom

      public TreeState.Builder withMaxTreeDurationFrom(TreeState previousState, Action action)
      Sets the maximum duration of the tree from the provided action if present, or the previous tree state otherwise.
      Parameters:
      previousState - the previous tree state
      action - the last action
      Returns:
      this builder
    • build

      public TreeState build()
      Builds the TreeState object with the provided properties.
      Returns:
      the TreeState object