Package org.chenile.core.context
Enum Class ContextContainer
- All Implemented Interfaces:
Serializable,Comparable<ContextContainer>,Constable
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfaceNested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voidvoidorg.springframework.security.core.Authenticationprivate StringIf anyone needs a thread local they should use this.private Stringstatic ObjectgetExtension(String key) static ContextContainergetProtectedHeader(String headerName) getUser()booleanisActive()booleanbooleanbooleanbooleanvoidstatic ObjectputExtension(String key, Object value) voidvoidsetAppType(String appType) voidsetAuthentication(org.springframework.security.core.Authentication authenticationContext) private voidsetAuthUser(String userName) private voidsetBatchId(String batchId) private voidsetDeviceId(String deviceId) voidsetEmployeeId(String employeeId) voidsetGroupId(String groupId) voidsetInternal(Boolean isInternal) voidsetOnDemand(Boolean isOnDemand) voidvoidsetRequestId(String requestId) voidvoidsetTenantType(String tenantType) voidsetTestMode(String testMode) voidsetTrajectory(String trajectory) voidsetUserAgent(String userAgent) voidvoidsetVerified(Boolean isVerified) toMap()static ContextContainerReturns the enum constant of this class with the specified name.static ContextContainer[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
CONTEXT_CONTAINER
-
-
Field Details
-
contexts
-
-
Constructor Details
-
ContextContainer
private ContextContainer()
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
getInstance
-
getExtension
-
putExtension
-
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
-
getRequestId
-
getContext
-
clear
public void clear() -
setAuthentication
public void setAuthentication(org.springframework.security.core.Authentication authenticationContext) -
getAuthentication
public org.springframework.security.core.Authentication getAuthentication() -
put
-
get
-
getProtectedHeader
-
getHeader
-
setUserId
-
getUser
-
setRegion
-
getRegion
-
getGroupId
- Returns:
- the groupId
-
setGroupId
- Parameters:
groupId- the groupId to set
-
getEmployeeId
- Returns:
- the employeeId
-
setEmployeeId
- Parameters:
employeeId- the employeeId to set
-
getAppType
- Returns:
- the appType
-
setAppType
- Parameters:
appType- the appType to set
-
getTenantType
- Returns:
- the tenantType
-
setTenantType
- Parameters:
tenantType- the tenantType to set
-
isActive
public boolean isActive()- Returns:
- the isActive
-
setActive
- Parameters:
isActive- the isActive to set
-
setTestMode
-
isTestMode
public boolean isTestMode() -
isVerified
public boolean isVerified()- Returns:
- the isVerified
-
setVerified
- Parameters:
isVerified- the isVerified to set
-
isOnDemand
public boolean isOnDemand()- Returns:
- the isOnDemand
-
setOnDemand
- Parameters:
isOnDemand- the isOnDemand to set
-
isInternal
public boolean isInternal()- Returns:
- the isInternal
-
setInternal
- Parameters:
isInternal- the isInternal to set
-
getTrajectory
- Returns:
- the trajectory
-
setTrajectory
- Parameters:
trajectory- the trajectory to set
-
getUserAgent
- Returns:
- the userAgent
-
setUserAgent
- Parameters:
userAgent- the userAgent to set
-
getBatchId
-
setBatchId
-
getTenant
-
setTenant
-
setAuthUser
-
getAuthUser
-
getDeviceId
- Returns:
- the deviceId
-
setDeviceId
- Parameters:
deviceId- the deviceId to set
-
toMap
-
fromSimpleMap
-
fromMap
-