Enum Class ContextContainer

java.lang.Object
java.lang.Enum<ContextContainer>
org.chenile.core.context.ContextContainer
All Implemented Interfaces:
Serializable, Comparable<ContextContainer>, Constable

public enum ContextContainer extends Enum<ContextContainer>
This is a class that can be used to obtain access to headers passed in the transport. Typically, services only accept payload and selected headers. They don't accept all the headers because it can dilute the method signature. For example, an Order Service may not accept the name of the user though it is available as a header.

But it is possible that some of the header attributes may be needed by the service though it is not explicitly passed to it. This class allows the service (or the classes thst it calls) to access header information.

It is important to note that this is stored as a ThreadLocal and hence will not be available in Reactive environments.

  • Enum Constant Details

  • Field Details

  • Constructor Details

    • ContextContainer

      private ContextContainer()
  • Method Details

    • values

      public static ContextContainer[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ContextContainer valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getInstance

      public static ContextContainer getInstance()
    • getExtension

      public static Object getExtension(String key)
    • putExtension

      public static Object putExtension(String key, Object value)
    • getContextExtensions

      public static Map<String,Object> getContextExtensions()
      If anyone needs a thread local they should use this. This will get cleared at the end of each request and hence behaves predictably.
      Returns:
      a map where the caller can store its info
    • setRequestId

      public void setRequestId(String requestId)
    • getRequestId

      public String getRequestId()
    • getContext

      public ContextContainer.Context getContext()
    • clear

      public void clear()
    • setAuthentication

      public void setAuthentication(org.springframework.security.core.Authentication authenticationContext)
    • getAuthentication

      public org.springframework.security.core.Authentication getAuthentication()
    • put

      public void put(String key, String value)
    • get

      public String get(String key)
    • getProtectedHeader

      public String getProtectedHeader(String headerName)
    • getHeader

      public String getHeader(String headerName)
    • setUserId

      public void setUserId(String userId)
    • getUser

      public String getUser()
    • setRegion

      public void setRegion(String regionId)
    • getRegion

      public String getRegion()
    • getGroupId

      public String getGroupId()
      Returns:
      the groupId
    • setGroupId

      public void setGroupId(String groupId)
      Parameters:
      groupId - the groupId to set
    • getEmployeeId

      public String getEmployeeId()
      Returns:
      the employeeId
    • setEmployeeId

      public void setEmployeeId(String employeeId)
      Parameters:
      employeeId - the employeeId to set
    • getAppType

      public String getAppType()
      Returns:
      the appType
    • setAppType

      public void setAppType(String appType)
      Parameters:
      appType - the appType to set
    • getTenantType

      public String getTenantType()
      Returns:
      the tenantType
    • setTenantType

      public void setTenantType(String tenantType)
      Parameters:
      tenantType - the tenantType to set
    • isActive

      public boolean isActive()
      Returns:
      the isActive
    • setActive

      public void setActive(Boolean isActive)
      Parameters:
      isActive - the isActive to set
    • isVerified

      public boolean isVerified()
      Returns:
      the isVerified
    • setVerified

      public void setVerified(Boolean isVerified)
      Parameters:
      isVerified - the isVerified to set
    • isOnDemand

      public boolean isOnDemand()
      Returns:
      the isOnDemand
    • setOnDemand

      public void setOnDemand(Boolean isOnDemand)
      Parameters:
      isOnDemand - the isOnDemand to set
    • isInternal

      public boolean isInternal()
      Returns:
      the isInternal
    • setInternal

      public void setInternal(Boolean isInternal)
      Parameters:
      isInternal - the isInternal to set
    • getTrajectory

      public String getTrajectory()
      Returns:
      the trajectory
    • setTrajectory

      public void setTrajectory(String trajectory)
      Parameters:
      trajectory - the trajectory to set
    • getUserAgent

      public String getUserAgent()
      Returns:
      the userAgent
    • setUserAgent

      public void setUserAgent(String userAgent)
      Parameters:
      userAgent - the userAgent to set
    • getBatchId

      private String getBatchId()
    • setBatchId

      private void setBatchId(String batchId)
    • getTenant

      public String getTenant()
    • setTenant

      public void setTenant(String tenant)
    • getDeviceId

      private String getDeviceId()
      Returns:
      the deviceId
    • setDeviceId

      private void setDeviceId(String deviceId)
      Parameters:
      deviceId - the deviceId to set
    • toMap

      public Map<String,String> toMap()
    • fromSimpleMap

      public void fromSimpleMap(ContextContainer.SimpleMap map)
    • fromMap

      public void fromMap(Map<String,String> map)