DataRetriever
The GreenVulcano® ESB element DataRetriever defines a helper function.
It is defined by four parameters:
Attribute | Type | Description |
---|---|---|
cacheable | optional | If true the calculated function value, for the given parameters set, is cached for future access during the service processing. The cache is cancelled at service end. Default false. |
DataRetriever | optional | The helper function. Might contain placeholders. |
method | required | Helper function name. |
signature | optional | Comma-separated list of parameters name to be substituted in the function. |
Examples of GenericRetriever functions
Configuration examples.
<RetrieverConfig>
<GenericRetriever class="it.greenvulcano.gvesb.datahandling.utils.GenericRetriever"
type="retriever">
<DataRetriever cacheable="true" method="getCityID" signature="NAME">
select ID from CITY
where NAME='@{{NAME}}'
</DataRetriever>
<DataRetriever cacheable="true" method="getCityName" signature="ID">
select NAME from CITY
where ID=@{{ID}}
</DataRetriever>
<DataRetriever method="getPersonID" signature="NAME,CITY">
select ID from PERSON
where NAME='@{{NAME}}'
and ID_CITY=(select ID from CITY where NAME='@{{CITY}}')
</DataRetriever>
<DataRetriever cacheable="true" method="getCardID" signature="NUMBER,ID_OWNER">
select ID from CREDIT_CARD
where CNUMBER='@{{NUMBER}}'
and ID_OWNER=@{{ID_OWNER}}
</DataRetriever>
<DataRetriever method="getSeqVal">
select SEQ_PERSON_ID.nextval from dual
</DataRetriever>
</GenericRetriever>
</RetrieverConfig>
Function description.
Function | Parameters | Cacheable | Description |
---|---|---|---|
getCityID | NAME | true | Returns the ID field of the first record of table CITY with field NAME equals to the passed parameter. The parameter is cacheable so, for the given parameter value, the subsequent call returns the same value. |
getCityName | ID | true | Returns the NAME field of the first record of table CITY with field ID equals to the passed parameter. The parameter is cacheable so, for the given parameter value, the subsequent call returns the same value. |
getPersonID | NAME,CITY | false | Returns the ID field of a record of table PERSON with field NAME equals to the first passed parameter and with an external reference to a record of table CITY with field NAME equals to the second passed parameter. |
getCardID | NUMBER,ID_OWNER | true | Returns the ID field of the first record of table CREDIT_CARD with field CNUMBER equals to the first passed parameter and the field ID_OWNER equals to the second passed parameter. The parameter is cacheable so, for the given parameters value, the subsequent call returns the same value. |
getSeqVal | false | Returns the next sequence value. |
Usage examples in XSL transformation. The examples use the calling procedure of Java classes of Xalan-J XSLT Engine.
<xsl:variable name="name" select="/PersonsData/PersonData/Name"/>
<xsl:variable name="city" select="/PersonsData/PersonData/City"/>
<xsl:element name="col">
<xsl:value-of select="java:it.greenvulcano.gvesb.datahandling.utils.GenericRetriever.getData('getPersonID',concat($name,';',$city))"/>
</xsl:element>