Criteria


In order to use a tag as a search criterion, it must be defined as searchable when it was created!


Search criteria represent the content of the search form.


The advanced search can be configured to display, by default, criteria that the user only needs to fill in before running the search. This property is placed in the AdvancedCriteriaPresenter bean. Criteria are added via the fixedCriterionPresenters property:


<property name="fixedCriterionPresenters">
	<list>
	</list>
</property>


Between the tags<list> and </list> add your search criteria.

Place the criterion definition at the beginning of the XML body. The NomAdherentCriterion search criterion is defined as follows:

  • the NomClient tag which is a search criterion
  • The criterion is a STRING character string
  • EQUALS_TO is the operator that will help the search to find the client


XML code: Definition of Criteria

<bean id="NomAdherentCriterion" class="com.flower.docs.gui.client.search.criterion.SimpleCriterionPresenter">
    <property name="model">
        <bean class="com.flower.docs.domain.search.Criterion">
            <property name="name" value="NomClient" />
            <property name="type">
                <value type="com.flower.docs.domain.search.Types">STRING</value>
            </property>
            <property name="operator">
                <value type="com.flower.docs.domain.search.Operators">EQUALS_TO</value>
            </property>
        </bean>
    </property>
</bean>

Note: The definition remains the same for the RefClientCriterion criteria and PrenomClientCriterion, we just need to change the values of the properties description, nom and the id identifier of the bean.


The different properties of a criterion :

  • name: (here equal to NomClient) the symbolic name of the tag to be used as a criterion.

  • type: the type of value to be entered in the field (Field type).

  • operator: the default operator displayed in the search (Operator).


Reference the criteria in the list using the bean identifier:


<property name="fixedCriterionPresenters">
	<list>
		<ref bean="RefClientCriterion" />
		<ref bean="NomAdherentCriterion" />
        <ref bean="PrenomClientCriterion" />
	</list>
</property>