CollectingFilter
The CollectingFilter
is similar to the ELMappingFilter
but instead of storing the data attributes or control values in the repository of the entity, it uses a specified repository and stores the data in a HashSet. This set is accessible with the attribute's name and can be used to efficiently query for existence of values in filtering conditions of subsequent entities.
Configuration
Name | Type, usage constraints, defaults | Description |
---|---|---|
repository | required: paraVal default: none type: string | The repository name used to store either the attribute or control values. |
Example
The following example shows how the CollectingFilter
can be used to store user IDs in a set:
<dataFilter type="CollectingFilter">
!-- the filter configuration -->
<dp:paraVal name="repository" value="storage" />
<!-- attribute created on the control object -->
<dp:ctlVal name="userId" value="#{in.user.id}"/>
</dataFilter>
A filter of a subsequent entity uses the stored users for filtering:
<dataFilter type="ELMappingFilter">
<dp:paraVal name="skipwhen" value="#{coll:contains(ctl.storage.userId, in.user.uid)}" />
</dataFilter>