Class BusinessAlgorithmContext
java.lang.Object
com.ptc.core.businessfield.server.businessObject.BusinessAlgorithmContext
This class provides a cache that custom BusinessAlgorithms can use to store state between executions of a calculation
on a collection of BusinessObjects. This class contains the collection of BusinessObjects, the index to the current
BusinessObject being processed and a cache that can contain anything the algorithm needs access to across different
objects.
This class is not thread safe. It is the responsibility of users of this class to ensure it is handled correctly if used in multiple threads. Supported API: true
Extendable: false
This class is not thread safe. It is the responsibility of users of this class to ensure it is handled correctly if used in multiple threads. Supported API: true
Extendable: false
BusinessObject-
Method Summary
Modifier and TypeMethodDescriptionRetrieves an arbitrary Object that was previous placed in the cache.Returns the business object at the current index.intReturns the index info the collection of BusinessObjects for the particular BusinessObject that is currently being processed.Get the current locale.voidStore an arbitrary piece of information in the context so that it can be reused in calculations across multiple BusinessObjects
Supported API: true
-
Method Details
-
getLocale
Get the current locale.
Supported API: true- Returns:
- the current locale that should be applied to the evaluation
-
getCurrentBusinessObject
Returns the business object at the current index. This is the BusinessObject that is currently being processed.
Supported API: true- Returns:
-
getCurrentIndex
public int getCurrentIndex()Returns the index info the collection of BusinessObjects for the particular BusinessObject that is currently being processed.
Supported API: true- Returns:
-
put
Store an arbitrary piece of information in the context so that it can be reused in calculations across multiple BusinessObjects
Supported API: true- Parameters:
businessAlgorithmClassName- The class name of the BusinessAlgorithm doing the calculation, this is required to prevent key collisions across algorithmscacheKey- An arbitrary cache key created by the BusinessAlgorithm authorcacheObject- The object to cache
-
get
Retrieves an arbitrary Object that was previous placed in the cache.
Supported API: true- Parameters:
businessAlgorithmClassName- The class name of the BusinessAlgorithm doing the calculation, this is required to prevent key collisions across algorithmscacheKey- An arbitrary cache key created by the BusinessAlgorithm author- Returns:
- The object that was in the cache, or null if this key is not found in the cache yet.
-