Class JpqlFilterImpl<V>

All Implemented Interfaces:
AttachNotifier, Component, Component.BelongToFrame, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, CompositeWithCaption, CompositeWithDescription, CompositeWithHtmlCaption, CompositeWithHtmlDescription, FilterComponent, HasContextHelp, HasDebugId, HasHtmlCaption, HasHtmlDescription, HasHtmlSanitizer, HasValue<V>, JpqlFilter<V>, Requirable, SingleFilterComponent<V>, SupportsCaptionPosition, Validatable

public class JpqlFilterImpl<V> extends AbstractSingleFilterComponent<V> implements JpqlFilter<V>
  • Field Details

    • JPQL_FILTER_STYLENAME

      protected static final String JPQL_FILTER_STYLENAME
      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

    • JpqlFilterImpl

      public JpqlFilterImpl()
  • Method Details

    • setJpqlFilterSupport

      @Autowired public void setJpqlFilterSupport(JpqlFilterSupport jpqlFilterSupport)
    • initRootComponent

      protected void initRootComponent(HBoxLayout root)
      Overrides:
      initRootComponent in class AbstractSingleFilterComponent<V>
    • createQueryCondition

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

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

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

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

      public String getParameterName()
      Specified by:
      getParameterName in interface SingleFilterComponent<V>
      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.
      Specified by:
      setParameterName in interface SingleFilterComponent<V>
      Parameters:
      parameterName - a name of the associated query parameter name
    • getParameterClass

      public Class getParameterClass()
      Specified by:
      getParameterClass in interface JpqlFilter<V>
      Returns:
      a Java class of the associated query parameter
    • setParameterClass

      public void setParameterClass(Class parameterClass)
      Description copied from interface: JpqlFilter
      Sets a Java class of the associated query parameter.
      Specified by:
      setParameterClass in interface JpqlFilter<V>
      Parameters:
      parameterClass - a Java class of the associated query parameter
    • getWhere

      public String getWhere()
      Description copied from interface: JpqlFilter
      Returns a 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 ?
       
      Specified by:
      getWhere in interface JpqlFilter<V>
      Returns:
      a JPQL expression which will be added to the 'where' data loader query section
      See Also:
    • getJoin

      @Nullable public String getJoin()
      Description copied from interface: JpqlFilter
      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
       
      Specified by:
      getJoin in interface JpqlFilter<V>
      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)
      Description copied from interface: JpqlFilter
      Sets JPQL expressions which will be added to the data loader query 'from' and 'where' sections.
      Specified by:
      setCondition in interface JpqlFilter<V>
      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()
      Specified by:
      hasInExpression in interface JpqlFilter<V>
      Returns:
      whether the query condition has an IN expression and the value is a collection
    • setHasInExpression

      public void setHasInExpression(boolean hasInExpression)
      Description copied from interface: JpqlFilter
      Sets whether the query condition has an IN expression and the value is a collection.
      Specified by:
      setHasInExpression in interface JpqlFilter<V>
      Parameters:
      hasInExpression - whether the query condition has an IN expression
    • resetQueryCondition

      protected void resetQueryCondition()