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
Modifier and TypeClassDescriptionstatic class
static interface
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
void
void
org.springframework.security.core.Authentication
private String
If anyone needs a thread local they should use this.private String
static Object
getExtension
(String key) static ContextContainer
getProtectedHeader
(String headerName) getUser()
boolean
isActive()
boolean
boolean
boolean
boolean
void
static Object
putExtension
(String key, Object value) void
void
setAppType
(String appType) void
setAuthentication
(org.springframework.security.core.Authentication authenticationContext) private void
setBatchId
(String batchId) private void
setDeviceId
(String deviceId) void
setEmployeeId
(String employeeId) void
setGroupId
(String groupId) void
setInternal
(Boolean isInternal) void
setOnDemand
(Boolean isOnDemand) void
void
setRequestId
(String requestId) void
void
setTenantType
(String tenantType) void
setTestMode
(String testMode) void
setTrajectory
(String trajectory) void
setUserAgent
(String userAgent) void
void
setVerified
(Boolean isVerified) toMap()
static ContextContainer
Returns 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
-
getDeviceId
- Returns:
- the deviceId
-
setDeviceId
- Parameters:
deviceId
- the deviceId to set
-
toMap
-
fromSimpleMap
-
fromMap
-