com.anasoft.os.daofusion.criteria
Interface FilterCriterionProvider

All Known Implementing Classes:
SimpleFilterCriterionProvider

public interface FilterCriterionProvider

Generic Criterion instance provider contract used by the FilterCriterion.

Implementations of this interface are responsible for providing an appropriate Criterion instance for the given property of the target persistent entity.

Author:
vojtech.szocs
See Also:
FilterCriterion

Method Summary
 boolean enabled(java.lang.Object[] filterObjectValues, java.lang.Object[] directValues)
          Returns a flag indicating whether to use this provider during the FilterCriterion instance processing.
 org.hibernate.criterion.Criterion getCriterion(java.lang.String targetPropertyName, java.lang.Object[] filterObjectValues, java.lang.Object[] directValues)
          Returns a Criterion instance corresponding to the given property of the target persistent entity.
 

Method Detail

getCriterion

org.hibernate.criterion.Criterion getCriterion(java.lang.String targetPropertyName,
                                               java.lang.Object[] filterObjectValues,
                                               java.lang.Object[] directValues)
Returns a Criterion instance corresponding to the given property of the target persistent entity.

Sample method implementations:

 return Restrictions.isNotNull(targetPropertyName);
 
 return Restrictions.eq(targetPropertyName, filterObjectValues[0]);
 
 return Restrictions.between(targetPropertyName, directValues[0], directValues[1]);
 

Parameters:
targetPropertyName - Name of the target property for which to create the Criterion instance (either a direct or indirect association to the target persistent entity).
filterObjectValues - Values extracted from the filter object.
directValues - Values provided directly by the user.
Returns:
Criterion instance for the given property.

enabled

boolean enabled(java.lang.Object[] filterObjectValues,
                java.lang.Object[] directValues)
Returns a flag indicating whether to use this provider during the FilterCriterion instance processing.

Use this method for disabling the Criterion instance provider in certain situations, for example:

Note that this method is called before each getCriterion(String, Object[], Object[]) invocation during the FilterCriterion instance processing.

Parameters:
filterObjectValues - Values extracted from the filter object.
directValues - Values provided directly by the user.
Returns:
true to use this provider during the FilterCriterion instance processing, false otherwise.


Copyright © 2008-2009 ANASOFT and contributors. All Rights Reserved.