void setContext(String contextName, Object context)
None
You might explicitly set the map execution context if you want to execute a submap with a relationship transformation. In this case, you would choose to create a new context with its own calling context (initiator) in the map context so that the relationship behaves correctly.
Currently, you can only use the CxExecutionContext() to set the map execution context, and only save one MapExeContext() instance in the CxExecutionContext(). If you use setContext()to set a new MapExeContext()into the CxExecutionContext(), the old one will be gone.
The following example shows the use of setContext():
mapExeContext originalMapExeContext = (MapExeContext)
cwExecCtx.getContext(CxExecutionContext.MAPCONTEXT);
MapExeContext newMapExeContext = new MapExeContext();
newMapExeContext.setInitiator(originalMapExeContext.getInitiator());
newMapExeContext.setConnName(originalMapExeContext.getConnName());
newMapExeContext.setLocale(originalMapExeContext.getLocale());
cwExecCtx.setContext(CxExecutionContext.MAPCONTEXT,
newMapExeContext);
The following example saves a map execution context into a global execution context:
globalExeContext.setContext(CxExecutionContext.MAPCONTEXT, mapExeContext);
The following example shows how to set the map execution context:
CxExecutionContext cwCtx = new CxExecutionContext(); MapExeContext mapCtx = new MapExeContext(); cwCtx.setContext(CxExecutionContext.MAPCONTEXT, mapCtx);
// do some work involving execution context
cwExecCtx.setContext(CxExecutionContext.MAPCONTEXT, originalMapExeContext);