Execution context
Almost every method in service implementation contract receives an instance of
com.hcl.unica.system.model.request.ExecutionContext
class.
- T getRequest()
This method can be used to obtain the input, or request, object passed to the service when it is executed using
executeService
method discussed in Service invocation (The T return type is the type parameter corresponding to the type parameter RQ used for defining the service). - Map<String, Object> getAttributes()
Returns a Map which can be used to store and retrieve custom attributes during service execution. It is useful for carrying execution specific temporary information across multiple callbacks. For example, if the implementation of
buildRequest
method from theRestService
interface orHttpService
interface needs to share some information withtransformResponse
method, it can share it using this attribute Map.It is important to note that Content Integration Framework creates a separate instance of
ExecutionContext
for each individual service invocation. Hence, context attributes cannot be shared across multiple service executions. Their scope is limited to individual service execution. - ServiceConfig getServiceConfig()
This method returns an instance of
com.hcl.unica.system.integration.config.ServiceConfig
class.ServiceConfig
object holds the configurations made in service declaration file for the respective service. - SystemConfig getSystemConfig()
This method returns an instance of
com.hcl.unica.system.integration.config.SystemConfig
class.SystemConfig
object contains all the configurations made in Unica Platform for the target system. In case of multi-partitioned configurations, this object will be appropriately populated by Content Integration Framework to hold partition-specific configuration for the concerned client application. To know the various system configuration settings in Unica Platform, see Unica Content Integration Administrator's Guide. - void setAttributes(Map<String, Object>)
This method can be used to set attributes in
ExecutionContext
, which can be then be obtained in other areas of the service implementation. This is useful for sharing custom contextual information during service execution. Scope of the attributes stored in execution context is limited to the current execution flow only. Attributes cannot be shared across multiple execution flows of the same service. - Locale getUserLocale ()
This method can be used to obtain signed in user’s locale.
- String localized(String key, String defaultText)
Returns the localized text for the given key. If translation does not exist for the given key in plugin’s I18n resource bundles, then returns the default text.
InboundHttpRequestContext<T>
- Map<String, Object> getPathVariables()
Inbound RESTful services can use path variables while defining the endpoint signature. Path variables allow designing dynamic URLs, wherein certain portions of the URL carry value specific to the given request context. This method can be used to obtain path variables thus defined & their values.
- Map<String, List<Object>> getRequestParams()
This method can be used to obtain request parameters & their values.
- Map<String, Object> getRequestHeaders()
This method can be used to obtain request headers & their values.