|
Oracle Fusion Applications Java API Reference for Oracle Enterprise Scheduler Service 11g Release 1 (11.1.1.5) E20742-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.as.scheduler.substitution.AbstractSubstitutor oracle.as.scheduler.substitution.ReqParamCtxtSubstitutor
public class ReqParamCtxtSubstitutor
Perform token substitutions on a RequestParameters
object using a
set of ReqParamCtxtSubstitutionHandler
s.
Typical usage is:
RequestParameters rp = new RequestParameters(); rp.add("COLOR", "red"); rp.add("GARMENT", "sneaker"); rp.add("CLOTHES", "Today I am wearing a ${COLOR} ${GARMENT} and a ${COLOR} ${REQ_PARAMS:GARMENT}."); rp.add(SystemProperty.SUBSITUTION_HANDLERS, "user.package.RandItemsHandler,user.package.FamousItemsHandler"); ReqeustParametersSubstitution rpSub = new ReqParamCtxtSubstitutor(context, rp); String todaysClothing = rpSub.getSubstitutedValue("CLOTHING"); rpSub.close();The above code assumes that the user-created
SubstitutionHandler
called
RandItemsHandler
. If RandItemsHandler
returns
"jacket"
for GARMENT
, then the value of todaysClothing
would be "Today I am wearing a red jacket and a red sneaker"
.
For the first instance of GARMENT
we don't specify which handler to use,
so we get the value from the first handler that claims it; in this case,
RandItemsHander
provides the value. However, we qualify the
second instance of GARMENT
with REQ_PARAMS
, meaning that we
only ask handlers with the ID of REQ_PARAMS
to provide the value.
A subsitution token can also specify a list of IDs to query, for example
"The sky is ${MARS,EARTH,JUPITER:SKY_COLOR}."
. The
substitution handler determines the order in which they are evaluated; the
order of IDs in the token does not matter.
The pre-built substitution handlers RequestParamSubstitutionHandler
and RequestContextSubstitutionHandler
are always included after
the user-specified handlers.
ReqParamCtxtSubstitutionHandler
,
Substitutor
,
RequestParameters
Constructor Summary | |
---|---|
ReqParamCtxtSubstitutor(RequestExecutionContext context,
RequestParameters requestParams)
|
Method Summary | |
---|---|
java.lang.String |
getOriginalValue(java.lang.String name)
Does not perform any substitutions on the requestParams values, but converts all values to String as does getSubstitutedValues() |
java.lang.String |
getSubstitutedValue(java.lang.String name)
Recursively replaces all tokens in the RequestParameter name
with the results from matching handlers. |
void |
initialize(RequestExecutionContext context,
RequestParameters requestParams)
Provide the source RequestParameters used for the handlers. |
protected boolean |
initializeHandler(SubstitutionHandler handlerSH)
Implementations of AbstractSubstitutor may override this
method to perform implementation specific initialization for each handler
instance. |
void |
setSubstitutionHandlers(java.util.List<SubstitutionHandler> subsHandlers)
Set the list of SubstitutionHandler s to use. |
Methods inherited from class oracle.as.scheduler.substitution.AbstractSubstitutor |
---|
close, closeHandlers, getMatchingHandler, setSubstitutionHandlers, stringToHandlers, substitute, substituteTokens |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface oracle.as.scheduler.substitution.Substitutor |
---|
close, setSubstitutionHandlers, substitute |
Constructor Detail |
---|
public ReqParamCtxtSubstitutor(RequestExecutionContext context, RequestParameters requestParams)
Method Detail |
---|
public void initialize(RequestExecutionContext context, RequestParameters requestParams)
requestParams.getValue(SystemProperty.SUBSTITUTION_HANDLERS)
.
requestParams
- Parameters to use for substitution.public void setSubstitutionHandlers(java.util.List<SubstitutionHandler> subsHandlers)
AbstractSubstitutor
SubstitutionHandler
s to use.
setSubstitutionHandlers
in interface Substitutor
setSubstitutionHandlers
in class AbstractSubstitutor
subsHandlers
- List of SubstitutionHandler
sprotected boolean initializeHandler(SubstitutionHandler handlerSH)
AbstractSubstitutor
AbstractSubstitutor
may override this
method to perform implementation specific initialization for each handler
instance.
initializeHandler
in class AbstractSubstitutor
public java.lang.String getOriginalValue(java.lang.String name)
name
- The parameter name
public java.lang.String getSubstitutedValue(java.lang.String name)
name
with the results from matching handlers. Any tokens that are not
recognized by any handlers will remain in the string.
name
- The parameter name
|
Oracle Fusion Applications Java API Reference for Oracle Enterprise Scheduler Service 11g Release 1 (11.1.1.5) E20742-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |