Annotation Interface Condition


@Retention(RUNTIME) @Target({FIELD,METHOD}) public @interface Condition
Restricts the elements that appear in the collection.

Applies to collections.

You have full freedom to define how the collection data is obtained, with condition you can overwrite the default condition generated by OpenXava:

  @Condition(
    "${warehouse.zoneNumber} = ${this.warehouse.zoneNumber} AND " + 
    "${warehouse.number} = ${this.warehouse.number} AND " +
    "NOT (${number} = ${this.number})"
  )
 
If you have this collection within Carrier, you can obtain with this collection all carriers of the same warehouse but not himself, that is the list of his fellow workers. As you see you can use this in the condition in order to reference the value of a property of current object.

Since v7.7 you can use a filter to provide values for the condition arguments:

  @Condition(value="${year} = ?", filter=ActiveYearFilter.class)
  private Collection<Invoice> activeInvoices;
 
Author:
Javier Paniza
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
     
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Allows to define programmatically some logic to apply to the values entered by user when he filters the collection data.
  • Element Details

    • filter

      Class filter
      Allows to define programmatically some logic to apply to the values entered by user when he filters the collection data.
      Since:
      7.7
      Default:
      org.openxava.filters.VoidFilter.class