Class VitamSession

java.lang.Object
fr.gouv.vitam.common.model.VitamSession

public class VitamSession extends Object

Generic VitamSession object ; used to store thread context information.

Only one instance of this class must be used per thread. In fact, only VitamThreadFactory.VitamThread should be allowed to create one.

Finally, this class is NOT threadsafe ; only the thread "owning" the instance should be used to access it. Any other thread will cause an IllegalStateException when mutating its state.

  • Constructor Details

  • Method Details

    • from

      public static VitamSession from(VitamSession origin)
      Build a clone of the original VitamSession, attached to the same thread.
      Parameters:
      origin - VitamSession to clone
      Returns:
      A new session
    • getOther

      public Object getOther()
      Returns:
      the other
    • setOther

      public VitamSession setOther(Object other)
      Parameters:
      other - the other to set
      Returns:
      this
    • getRequestId

      public String getRequestId()
      Returns:
      the current X-Request-Id
    • setRequestId

      public void setRequestId(String newRequestId)
      Set the request id and saves it to the MDC
      Parameters:
      newRequestId - the request id
    • setInternalRequestId

      public void setInternalRequestId(String newRequestId)
      Set the server request id
      Parameters:
      newRequestId - the request id
    • getInternalRequestId

      public String getInternalRequestId()
      Get the server request id
      Returns:
      internalRequestId
    • getTenantId

      public Integer getTenantId()
      Returns:
      the current X-Tenant-Id
    • setTenantId

      public void setTenantId(Integer newTenantId)
      Sets the tenantId
      Parameters:
      newTenantId -
    • setRequestId

      public void setRequestId(GUID guid)
      Sets the request id from the guid
      Parameters:
      guid - the guid
    • getContractId

      public String getContractId()
      Returns:
      contract Id
    • setContractId

      public void setContractId(String contractId)
      Parameters:
      contractId -
    • getContract

      public AccessContractModel getContract()
      Returns:
      AccessContractModel
    • setContract

      public void setContract(AccessContractModel contract)
      Parameters:
      contract -
    • getContextId

      public String getContextId()
      Get vitam security context id
      Returns:
      contextId
    • setContextId

      public void setContextId(String contextId)
      Set vitam security context id
      Parameters:
      contextId -
    • getSecurityProfileIdentifier

      public String getSecurityProfileIdentifier()
      Get securityProfileIdentifier
      Returns:
      securityProfileIdentifier
    • setSecurityProfileIdentifier

      public void setSecurityProfileIdentifier(String securityProfileIdentifier)
      Set securityProfileIdentifier
      Parameters:
      securityProfileIdentifier -
    • getApplicationSessionId

      public String getApplicationSessionId()
      Get vitam application session id
      Returns:
      applicationSessionId
    • setApplicationSessionId

      public void setApplicationSessionId(String applicationSessionId)
      Set vitam application session id
      Parameters:
      applicationSessionId -
    • getPersonalCertificate

      public String getPersonalCertificate()
      Get personalCertificate
      Returns:
      personalCertificate
    • setPersonalCertificate

      public void setPersonalCertificate(String personalCertificate)
      Set personalCertificate
      Parameters:
      personalCertificate -
    • mutateFrom

      public void mutateFrom(@NotNull @NotNull VitamSession newSession)
      Get the content of a given VitamSession and copy its internal values to the current instance
      Parameters:
      newSession - Source session
    • erase

      public void erase()
      Erase the content of the VitamSession
    • checkValidRequestId

      public void checkValidRequestId()
      Check if the session contains a valid request id
      Throws:
      IllegalArgumentException
    • initIfAbsent

      public void initIfAbsent(Integer tenantId)
    • toString

      public String toString()
      Overrides:
      toString in class Object