it.openutils.hibernate.example
Class ExampleTree

java.lang.Object
  extended by it.openutils.hibernate.example.ExampleTree
All Implemented Interfaces:
Serializable

public class ExampleTree
extends Object
implements Serializable

facility to create subcriteria and examples for associations of an input entity

Author:
gcatania
See Also:
Serialized Form

Constructor Summary
ExampleTree(Object entity)
          builds an instance of ExampleTree associated with the input entity
 
Method Summary
 ExampleTree add(String associationPath, org.hibernate.criterion.Criterion criterion)
          add an additional criterion for properties of the subentity at the given path
 org.hibernate.Criteria appendTo(org.hibernate.Criteria crit, org.hibernate.Session ses)
          appends examples and subcriteria, created for the entity this example tree was initialized with, to the input criteria, and then returns it
 org.hibernate.Criteria create(org.hibernate.Session ses)
          creates a criteria with the input session, adds to it an example for the input entity, and creates subcriteria and related examples for non-null property values on the filter entity that correspond to associations
 ExampleTree enableLike()
          Use the "like" operator for all string-valued properties
 ExampleTree enableLike(org.hibernate.criterion.MatchMode matchMode)
          Use the "like" operator for all string-valued properties
 ExampleTree excludeNone()
          Don't exclude null or zero-valued properties
 ExampleTree excludeProperty(String associationPath, String propertyName)
          exclude a property from the default filter (note that additional conditions may still be applied for this property)
 ExampleTree excludeZeroes()
          Exclude zero-valued properties
 ExampleTree ignoreCase()
          Ignore case for all string-valued properties
 ExampleTree overridePropertyFilter(String associationPath, String propertyName, org.hibernate.criterion.Criterion override)
          override filter behavior for a given property with the input criterion.
 ExampleTree setEscapeCharacter(Character escapeCharacter)
          Set escape character for "like" clause
 ExampleTree setPropertySelector(org.hibernate.criterion.Example.PropertySelector selector)
          Set the property selector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExampleTree

public ExampleTree(Object entity)
builds an instance of ExampleTree associated with the input entity

Parameters:
entity - the example entity
Method Detail

create

public org.hibernate.Criteria create(org.hibernate.Session ses)
creates a criteria with the input session, adds to it an example for the input entity, and creates subcriteria and related examples for non-null property values on the filter entity that correspond to associations

Parameters:
ses - the session
Returns:
a criteria for this example tree

appendTo

public org.hibernate.Criteria appendTo(org.hibernate.Criteria crit,
                                       org.hibernate.Session ses)
appends examples and subcriteria, created for the entity this example tree was initialized with, to the input criteria, and then returns it

Parameters:
crit - the criteria to append to
ses - the session
Returns:
the input criteria with the added subcriteria and examples

setEscapeCharacter

public ExampleTree setEscapeCharacter(Character escapeCharacter)
Set escape character for "like" clause

Parameters:
escapeCharacter - the escape character
Returns:
this, for method concatenation

setPropertySelector

public ExampleTree setPropertySelector(org.hibernate.criterion.Example.PropertySelector selector)
Set the property selector

Parameters:
selector - the property selector
Returns:
this, for method concatenation

excludeZeroes

public ExampleTree excludeZeroes()
Exclude zero-valued properties

Returns:
this, for method concatenation

excludeNone

public ExampleTree excludeNone()
Don't exclude null or zero-valued properties

Returns:
this, for method concatenation

enableLike

public ExampleTree enableLike(org.hibernate.criterion.MatchMode matchMode)
Use the "like" operator for all string-valued properties

Parameters:
matchMode - the match mode
Returns:
this, for method concatenation

enableLike

public ExampleTree enableLike()
Use the "like" operator for all string-valued properties

Returns:
this, for method concatenation

ignoreCase

public ExampleTree ignoreCase()
Ignore case for all string-valued properties

Returns:
this, for method concatenation

add

public ExampleTree add(String associationPath,
                       org.hibernate.criterion.Criterion criterion)
add an additional criterion for properties of the subentity at the given path

Parameters:
associationPath - the association path with respect to the filter entity
criterion - the criterion to add
Returns:
this, for method concatenation

excludeProperty

public ExampleTree excludeProperty(String associationPath,
                                   String propertyName)
exclude a property from the default filter (note that additional conditions may still be applied for this property)

Parameters:
associationPath - the association path of the property with respect to the filter entity
propertyName - the property name
Returns:
this, for method concatenation

overridePropertyFilter

public ExampleTree overridePropertyFilter(String associationPath,
                                          String propertyName,
                                          org.hibernate.criterion.Criterion override)
override filter behavior for a given property with the input criterion.

Parameters:
associationPath - the association path of the property
propertyName - the property name
override - the new filter behavior for the property
Returns:
this, for method concatenation


Copyright © 2005-2011 Openmind. All Rights Reserved.