Difference between revisions of "GenericRetriever"

From GreenVulcano Wiki
Jump to: navigation, search
 
Line 29: Line 29:
 
Define the following GenericRetriever:
 
Define the following GenericRetriever:
 
<syntaxhighlight lang="XML">
 
<syntaxhighlight lang="XML">
<GenericRetriever class="it.greenvulcano.gvesb.datahandling.utils.GenericRetriever"
+
    <GenericRetriever class="it.greenvulcano.gvesb.datahandling.utils.GenericRetriever" type="retriever">
                                              type="retriever">
+
        <DataRetriever cacheable="true" method="getCityID"  signature="NAME">
      <DataRetriever cacheable="true" method="getCityID"  signature="NAME">
+
            select ID from CITY
                select ID from CITY
+
            where NAME=‘@{{NAME}}’
                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>
 
         </DataRetriever>
</GenericRetriever>
+
        <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>
 
</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>