Difference between revisions of "GenericRetriever"

From GreenVulcano Wiki
Jump to: navigation, search
(Created page with "==Description== The GenericRetriever element allows you to define a helper to use into the XSL transformations. We define the functions that run SQL select statement and return...")
 
 
(3 intermediate revisions by 2 users not shown)
Line 9: Line 9:
 
=={{GVESB}} configuration==
 
=={{GVESB}} configuration==
  
GenericRetriever element is used by [[RetrieverConfig]].
+
GenericRetriever element is used by [[Retriever_Config|RetrieverConfig]].
  
 
The following table shows its attributes:
 
The following table shows its attributes:
Line 23: Line 23:
 
* [[Description]]
 
* [[Description]]
 
* [[DataRetriever]]
 
* [[DataRetriever]]
 +
 +
 +
===An example===
 +
 +
Define the following GenericRetriever:
 +
<syntaxhighlight lang="XML">
 +
    <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 method="getPersonID" signature="NAME,CITY">
 +
            select ID from PERSON
 +
            where NAME=‘@{{NAME}}’
 +
            and ID_CITY=(select ID from CITY where NAME=‘@{{CITY}}’)
 +
        </DataRetriever>
 +
    </GenericRetriever>
 +
</syntaxhighlight>
 +
 +
to be applied to the transformation:
 +
<syntaxhighlight lang="XML">
 +
    <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>
 +
</syntaxhighlight>

Latest revision as of 13:55, 22 May 2012

Description

The GenericRetriever element allows you to define a helper to use into the XSL transformations.

We define the functions that run SQL select statement and return the first field of the first record.

The statement to be executed can contain metadata resolved at runtime.

GreenVulcano® ESB configuration

GenericRetriever element is used by RetrieverConfig.

The following table shows its attributes:

Attribute Type Description
type fixed retriever (unmodifiable)
class fixed it.greenvulcano.gvesb.datahandling.utils.GenericRetriever

Might contain the sub-elements:


An example

Define the following GenericRetriever:

    <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 method="getPersonID" signature="NAME,CITY">
             select ID from PERSON
             where NAME=‘@{{NAME}}’
             and ID_CITY=(select ID from CITY where NAME=‘@{{CITY}}’)
        </DataRetriever>
    </GenericRetriever>

to be applied to the transformation:

    <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>