Cache Filter

The Cache Filter can be used to cache the response of a WebService or any other "expensie" data provider.  Out of the box, we support caching on two different scopes, the ADF ApplicationScope or the ADF SessionScope.
Depending on which scope you would like to use, you need to apply a 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.

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.

 

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