Class JpqlFilter<V>

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<com.vaadin.flow.component.customfield.CustomField<T>,T>
com.vaadin.flow.component.customfield.CustomField<V>
io.jmix.flowui.component.filer.SingleFilterComponentBase<V>
io.jmix.flowui.component.jpqlfilter.JpqlFilter<V>
Type Parameters:
V - value type
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.customfield.CustomField>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<com.vaadin.flow.component.customfield.CustomField>, com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.customfield.CustomField>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<V>,V>,V>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<V>,V>,V>, com.vaadin.flow.component.shared.HasTooltip, FilterComponent, SingleFilterComponent<V>, HasRequired, SupportsLabelPosition, SupportsValidation<V>, Serializable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

public class JpqlFilter<V> extends SingleFilterComponentBase<V>
JpqlFilter is a UI component used for filtering entities returned by the DataLoader. The component contains JPQL expressions that will be added to the 'from' and 'where' data loader query sections. The component can automatically render proper layout for setting a condition value. In general case a JpqlFilter layout contains a label and a field for editing a condition value.
See Also:
  • Field Details

    • JPQL_FILTER_CLASS_NAME

      protected static final String JPQL_FILTER_CLASS_NAME
      See Also:
    • jpqlFilterSupport

      protected JpqlFilterSupport jpqlFilterSupport
    • parameterName

      protected String parameterName
    • parameterClass

      protected Class<?> parameterClass
    • where

      protected String where
    • join

      protected String join
    • hasInExpression

      protected boolean hasInExpression
  • Constructor Details

    • JpqlFilter

      public JpqlFilter()
  • Method Details

    • autowireDependencies

      protected void autowireDependencies()
      Overrides:
      autowireDependencies in class SingleFilterComponentBase<V>
    • initRootComponent

      protected void initRootComponent(com.vaadin.flow.component.orderedlayout.HorizontalLayout root)
      Overrides:
      initRootComponent in class SingleFilterComponentBase<V>
    • createQueryCondition

      protected JpqlCondition createQueryCondition()
      Specified by:
      createQueryCondition in class SingleFilterComponentBase<V>
    • getInnerComponentPrefix

      public String getInnerComponentPrefix()
      Specified by:
      getInnerComponentPrefix in class SingleFilterComponentBase<V>
    • getQueryCondition

      public JpqlCondition getQueryCondition()
      Specified by:
      getQueryCondition in interface FilterComponent
      Overrides:
      getQueryCondition in class SingleFilterComponentBase<V>
      Returns:
      a JpqlCondition related to the current JpqlFilter
    • updateQueryCondition

      protected void updateQueryCondition(@Nullable V newValue)
      Specified by:
      updateQueryCondition in class SingleFilterComponentBase<V>
    • getParameterName

      public String getParameterName()
      Returns:
      the name of the associated query parameter name
    • setParameterName

      public void setParameterName(String parameterName)
      Description copied from interface: SingleFilterComponent
      Sets the name of the associated query parameter name.
      Parameters:
      parameterName - a name of the associated query parameter name
    • getParameterClass

      public Class<?> getParameterClass()
      Returns:
      a Java class of the associated query parameter
    • setParameterClass

      public void setParameterClass(Class<?> parameterClass)
      Sets a Java class of the associated query parameter.
      Parameters:
      parameterClass - a Java class of the associated query parameter
    • getWhere

      public String getWhere()
      Returns a JPQL expression which will be added to the 'where' data loader query section.

      The {E} placeholder should be used in the expression instead of the alias of the entity being selected. The condition can only have one parameter denoted by ? if used.

      Example of selecting Car entities by an attribute of the joined Repair collection:

       r.description like ?
       
      Returns:
      a JPQL expression which will be added to the 'where' data loader query section
      See Also:
    • getJoin

      @Nullable public String getJoin()
      Returns a JPQL expression which will be added to the 'from' data loader query section.

      This can be required to create a complex condition based on an attribute of a related collection. The expression should be started with join or left join statements.

      The {E} placeholder should be used in the expression instead of the alias of the entity being selected.

      Example of joining the Repair collection when selecting Car entities:

       join {E}.repairs r
       
      Returns:
      a JPQL expression which will be added to the 'from' data loader query section
      See Also:
    • setCondition

      public void setCondition(String where, @Nullable String join)
      Sets JPQL expressions which will be added to the data loader query 'from' and 'where' sections.
      Parameters:
      where - a JPQL expression which will be added to the 'where' data loader query section
      join - a JPQL expression which will be added to the 'from' data loader query section
      See Also:
    • hasInExpression

      public boolean hasInExpression()
      Returns:
      whether the query condition has an IN expression and the value is a collection
    • setHasInExpression

      public void setHasInExpression(boolean hasInExpression)
      Sets whether the query condition has an IN expression and the value is a collection.
      Parameters:
      hasInExpression - whether the query condition has an IN expression
    • resetQueryCondition

      protected void resetQueryCondition()