Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Cache Filter can be used to cache the response of a WebService. 
We support caching on two different scopes, the ApplicationScope or the SessionScope.
Depending on which scope you would like to use, you need to apply different Data Provider class in the definition node. 
For the SessionScope, use the class:  org.adfemg.datacontrol.xml.provider.filter.cache.SessionScopeCacheFilter 
For the ApplicationScope , use the class:  org.adfemg.datacontrol.xml.provider.filter.cache.ApplicationScopeCacheFilter

Normally you typically use a CacheFilter on reference data that is static for the duration of a session or application. However, in this example we will use the HR example WebService we have been using throughout the Developers Guide.

 

Code Block
languagexml
titleData Control
    <AdapterDataControl id="HrWSData" FactoryClass="oracle.adf.model.adapter.DataControlFactoryImpl"
                        ImplDef="org.adfemg.datacontrol.xml.DataControlDefinition" SupportsTransactions="false"
                        SupportsSortCollection="false" SupportsResetState="false" SupportsRangesize="false"
                        SupportsFindMode="false" SupportsUpdates="false"
                        Definition="org.adfemg.xmldc.demo.view.HrWSData" BeanClass="org.adfemg.xmldc.demo.view.HrWSData"
                        xmlns="http://xmlns.oracle.com/adfm/datacontrol">
        <Source>
            <definition xmlns="http://adfemg.org/adfm/datacontrol/configuration"
                        schema="http://xmldc-sample.appspot.com/HR.xsd" schema-root="ListAllDepartmentsResponse"
                        dc-operation="getDepartments">
                <data-provider class="org.adfemg.datacontrol.xml.provider.filter.cache.ApplicationScopeCacheFilter">
                    <parameters>
                        <parameter name="clone" value="false"/>
                    </parameters>
                    <data-provider class="org.adfemg.datacontrol.xml.provider.data.WSDataProvider">
                        <parameters>
                            <parameter name="endPointUrl"
                                       value="http://xmldc-sample.appspot.com/HumanResourcesService"/>
                            <xml-parameter name="requestElement">
                                <![CDATA[
                              <hr:ListAllDepartmentsRequest xmlns:hr="http://adfemg.org/HR"/>
                            ]]>
                            </xml-parameter>
                        </parameters>
                    </data-provider>
                </data-provider>
            </definition>
        </Source>
    </AdapterDataControl>



Image Added

Clone parameter

Both the CacheFilters can take one parameter, the parameter 'clone', this is the parameter that specifies whether the cached XML Element should be cloned before returning it. This is typically used when the CacheFilter is nested in other DataFilter(s) that manipulate the element and you want to make sure the cached element is not altered.