gov.nih.nci.caarray.domain.search
Class ExampleSearchCriteria<T extends com.fiveamsolutions.nci.commons.data.persistent.PersistentObject>

java.lang.Object
  extended by gov.nih.nci.caarray.domain.search.ExampleSearchCriteria<T>
Type Parameters:
T - class of the example entity

public class ExampleSearchCriteria<T extends com.fiveamsolutions.nci.commons.data.persistent.PersistentObject>
extends java.lang.Object

Simple bean to hold example search criteria.

Author:
dkokotov

Constructor Summary
ExampleSearchCriteria(T example)
          Create a new example search criteria with given example, using exact matching, excluding null properties.
ExampleSearchCriteria(T example, org.hibernate.criterion.MatchMode matchMode)
          Create a new example search criteria with given example, using the given match mode, excluding null properties.
ExampleSearchCriteria(T example, org.hibernate.criterion.MatchMode matchMode, boolean excludeNulls)
          Create a new example search criteria with given example, using the given match mode and given null property handling.
ExampleSearchCriteria(T example, org.hibernate.criterion.MatchMode matchMode, boolean excludeNulls, java.util.Collection<java.lang.String> excludeProperties)
          Create a new example search criteria with given example, using the given match mode and given null property handling.
 
Method Summary
 ExampleSearchCriteria<T> excludeNulls()
          Set this criteria to exclude null properties from comparison.
 ExampleSearchCriteria<T> excludeProperties(java.lang.String... properties)
          Set this criteria to exclude given properties from comparison.
 ExampleSearchCriteria<T> excludeZeroes()
          Set this criteria to exclude zero-valued properties from comparison.
static
<T extends com.fiveamsolutions.nci.commons.data.persistent.PersistentObject>
ExampleSearchCriteria<T>
forEntity(T entity)
          Create a new example search criteria with given example, using exact matching, excluding null properties.
 T getExample()
           
 java.util.Collection<java.lang.String> getExcludeProperties()
           
 org.hibernate.criterion.MatchMode getMatchMode()
           
 ExampleSearchCriteria<T> includeNulls()
          Set this criteria to include null properties in the comparison.
 ExampleSearchCriteria<T> includeProperties(java.lang.String... properties)
          Set this criteria to include given properties from comparison.
 ExampleSearchCriteria<T> includeZeroes()
          Set this criteria to include zero-valued properties in the comparison.
 boolean isExcludeNulls()
           
 boolean isExcludeZeroes()
           
 ExampleSearchCriteria<T> matchUsing(org.hibernate.criterion.MatchMode mode)
          Set the match mode of this criteria to given match mode.
 void setExample(T example)
           
 void setExcludeNulls(boolean excludeNulls)
           
 void setExcludeProperties(java.util.Collection<java.lang.String> excludeProperties)
           
 void setExcludeZeroes(boolean excludeZeroes)
           
 void setMatchMode(org.hibernate.criterion.MatchMode matchMode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExampleSearchCriteria

public ExampleSearchCriteria(T example)
Create a new example search criteria with given example, using exact matching, excluding null properties.

Parameters:
example - the example

ExampleSearchCriteria

public ExampleSearchCriteria(T example,
                             org.hibernate.criterion.MatchMode matchMode)
Create a new example search criteria with given example, using the given match mode, excluding null properties.

Parameters:
example - the example
matchMode - how string properties in the example should be compared against candidate matches.

ExampleSearchCriteria

public ExampleSearchCriteria(T example,
                             org.hibernate.criterion.MatchMode matchMode,
                             boolean excludeNulls)
Create a new example search criteria with given example, using the given match mode and given null property handling.

Parameters:
example - the example
matchMode - how string properties in the example should be compared against candidate matches.
excludeNulls - if true, properties in the example with a null value will be excluded from comparison; if false, they will be excluded, so candidate matches must also have null values for those properties.

ExampleSearchCriteria

public ExampleSearchCriteria(T example,
                             org.hibernate.criterion.MatchMode matchMode,
                             boolean excludeNulls,
                             java.util.Collection<java.lang.String> excludeProperties)
Create a new example search criteria with given example, using the given match mode and given null property handling.

Parameters:
example - the example
matchMode - how string properties in the example should be compared against candidate matches.
excludeNulls - if true, properties in the example with a null value will be excluded from comparison; if false, they will be excluded, so candidate matches must also have null values for those properties.
excludeProperties - exclude the given properties from comparison.
Method Detail

forEntity

public static <T extends com.fiveamsolutions.nci.commons.data.persistent.PersistentObject> ExampleSearchCriteria<T> forEntity(T entity)
Create a new example search criteria with given example, using exact matching, excluding null properties. Intended for builder-style creation of the criteria.

Type Parameters:
T - class of example entity
Parameters:
entity - the example
Returns:
the new example criteria

matchUsing

public ExampleSearchCriteria<T> matchUsing(org.hibernate.criterion.MatchMode mode)
Set the match mode of this criteria to given match mode.

Parameters:
mode - the new match mode
Returns:
this

excludeNulls

public ExampleSearchCriteria<T> excludeNulls()
Set this criteria to exclude null properties from comparison.

Returns:
this

includeNulls

public ExampleSearchCriteria<T> includeNulls()
Set this criteria to include null properties in the comparison.

Returns:
this

excludeProperties

public ExampleSearchCriteria<T> excludeProperties(java.lang.String... properties)
Set this criteria to exclude given properties from comparison.

Parameters:
properties - the given properties to exclude.
Returns:
this

includeProperties

public ExampleSearchCriteria<T> includeProperties(java.lang.String... properties)
Set this criteria to include given properties from comparison.

Parameters:
properties - the given properties to include.
Returns:
this

excludeZeroes

public ExampleSearchCriteria<T> excludeZeroes()
Set this criteria to exclude zero-valued properties from comparison.

Returns:
this

includeZeroes

public ExampleSearchCriteria<T> includeZeroes()
Set this criteria to include zero-valued properties in the comparison.

Returns:
this

getExample

public T getExample()
Returns:
the example

setExample

public void setExample(T example)
Parameters:
example - the example to set

getMatchMode

public org.hibernate.criterion.MatchMode getMatchMode()
Returns:
the matchMode

setMatchMode

public void setMatchMode(org.hibernate.criterion.MatchMode matchMode)
Parameters:
matchMode - the matchMode to set

isExcludeNulls

public boolean isExcludeNulls()
Returns:
the excludeNulls

setExcludeNulls

public void setExcludeNulls(boolean excludeNulls)
Parameters:
excludeNulls - the excludeNulls to set

getExcludeProperties

public java.util.Collection<java.lang.String> getExcludeProperties()
Returns:
the excludeProperties

setExcludeProperties

public void setExcludeProperties(java.util.Collection<java.lang.String> excludeProperties)
Parameters:
excludeProperties - the excludeProperties to set

isExcludeZeroes

public boolean isExcludeZeroes()
Returns:
the excludeZeroes

setExcludeZeroes

public void setExcludeZeroes(boolean excludeZeroes)
Parameters:
excludeZeroes - the excludeZeroes to set