Difference between revisions of "DataRetriever"

From GreenVulcano Wiki
Jump to: navigation, search
Line 5: Line 5:
 
! Attribute !! Type !! Description
 
! Attribute !! Type !! Description
 
|-
 
|-
| cacheable || optional || (true|false): If true the calculated function value, for the given parameters set, is cached for future access during the service processing.<br/> The cache is cancelled at service end. <br/>  Default false.
+
| cacheable || optional || If true the calculated function value, for the given parameters set, is cached for future access during the service processing.<br/> The cache is cancelled at service end. <br/>  Default false.
 
|-
 
|-
| DataRetriever || optional || DB query. Might contain [[placeholders]].
+
| DataRetriever || optional || The helper function. Might contain [[placeholders]].
 
|-
 
|-
 
| method || required || Helper function name.
 
| method || required || Helper function name.
Line 13: Line 13:
 
| signature || optional || Comma-separated list of parameters name to be substituted in the function.
 
| signature || optional || Comma-separated list of parameters name to be substituted in the function.
 
|}
 
|}
 +
 +
 +
==Examples of GenericRetriever services==
 +
 +
<syntaxhighlight lang="xml">
 +
<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>
 +
</syntaxhighlight>

Revision as of 17:55, 23 February 2012

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 services

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