Class ContextUtility
java.lang.Object
com.broadleafcommerce.data.tracking.core.context.ContextUtility
Utility class for temporarily setting several values on
ContextInfo
for the scope of a
block of code embodied in a Supplier
.- Author:
- Jeff Fischer
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ThreadLocal<Boolean>
static final ThreadLocal<Boolean>
-
Method Summary
Modifier and TypeMethodDescriptionstatic <P> P
doWithActiveCheck
(Supplier<P> function, ContextInfo contextInfo) Similar toforceDoWithActiveCheck(Supplier, ContextInfo)
, except the state is not forced, nor is it immutable for the duration of the call.static <P> P
doWithoutActiveCheck
(Supplier<P> function, ContextInfo contextInfo) Similar toforceDoWithoutActiveCheck(Supplier, ContextInfo)
, except the state is not forced, nor is it immutable for the duration of the call.static <P> P
doWithoutCache
(Supplier<P> function) Execute this flow with cache disabled.static <P> P
forceDoWithActiveCheck
(Supplier<P> function, ContextInfo contextInfo) Force active date checking to be enabled during this flow.static <P> P
forceDoWithoutActiveCheck
(Supplier<P> function, ContextInfo contextInfo) Force active date checking to be disabled during this flow.
-
Field Details
-
ACTIVE_DATE_FILTER_CONTEXT
-
ACTIVE_FLAG_FILTER_CONTEXT
-
-
Method Details
-
forceDoWithoutActiveCheck
Force active date checking to be disabled during this flow. This value will be immutable for the duration of this call.- Type Parameters:
P
- The result type- Parameters:
function
- The code to process with active date handling disabledcontextInfo
- The current context information- Returns:
- The result of the call
-
doWithoutActiveCheck
Similar toforceDoWithoutActiveCheck(Supplier, ContextInfo)
, except the state is not forced, nor is it immutable for the duration of the call.- Type Parameters:
P
- The result type- Parameters:
function
- The code to process with active date handling disabledcontextInfo
- The current context information- Returns:
- The result of the call
-
doWithoutCache
Execute this flow with cache disabled.- Type Parameters:
P
- he result type- Parameters:
function
- The code to process with cache handling disabled- Returns:
- The result of the call
-
forceDoWithActiveCheck
Force active date checking to be enabled during this flow. This value will be immutable for the duration of this call.- Type Parameters:
P
- The result type- Parameters:
function
- The code to process with active date handling enabledcontextInfo
- The current context information- Returns:
- The result of the call
-
doWithActiveCheck
Similar toforceDoWithActiveCheck(Supplier, ContextInfo)
, except the state is not forced, nor is it immutable for the duration of the call.- Type Parameters:
P
- The result type- Parameters:
function
- The code to process with active date handling enabledcontextInfo
- The current context information- Returns:
- The result of the call
-