Project Wonder 5.0.0.8795

er.extensions.eof.qualifiers
Class ERXToManyQualifier

java.lang.Object
  extended by com.webobjects.eocontrol.EOQualifier
      extended by com.webobjects.eocontrol.EOKeyValueQualifier
          extended by er.extensions.qualifiers.ERXKeyValueQualifier
              extended by er.extensions.eof.qualifiers.ERXToManyQualifier
All Implemented Interfaces:
EOKeyValueArchiving, EOQualifierEvaluation, NSCoding, IERXChainableQualifier, Serializable, Cloneable
Direct Known Subclasses:
ERXEOToManyQualifier

public class ERXToManyQualifier
extends ERXKeyValueQualifier
implements Cloneable

Optimized toMany qualifier, much, much better SQL than the Apple provided qualifier. Really nice when you want to find all the eos that have say five of the ten eos in their toMany relationship. This qualifier will always only generate three joins no matter how many eos you are trying to find. Example usage:


 NSArray employees; // given, can be null
 // Find all of the departments that have all of those employees
 ERXToManyQualifier q = new ERXToManyQualifier("toEmployees", employees);
 EOFetchSpecification fs = new EOFetchSpecification("Department", q, null);
 NSArray departments = ec.objectsWithFetchSpecification(fs);
 
If you want to find say departments that have 5 or more of the given employees (imagine you have a list of 10 or so), then you could construct the qualifier like:
ERXToManyQualifier q = new ERXToManyQualifier("toEmployees", employees, 5);
or to find any department that has at least one of the given employees
ERXToManyQualifier q = new ERXToManyQualifier("toEmployees", employees, 1);

See Also:
Serialized Form

Nested Class Summary
static class ERXToManyQualifier.ToManyQualifierSQLGenerationSupport
          Adds SQL generation support.
 
Nested classes/interfaces inherited from class com.webobjects.eocontrol.EOQualifier
EOQualifier.Comparison, EOQualifier.ComparisonSupport, EOQualifier.QualifierVariableSubstitutionException
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSCoding
NSCoding._BigDecimalSupport, NSCoding._BigIntegerSupport, NSCoding._BooleanSupport, NSCoding._ByteSupport, NSCoding._CharacterSupport, NSCoding._DateSupport, NSCoding._DoubleSupport, NSCoding._FloatSupport, NSCoding._IntegerSupport, NSCoding._LongSupport, NSCoding._NumberSupport, NSCoding._ShortSupport, NSCoding._StringSupport, NSCoding.Support
 
Nested classes/interfaces inherited from interface com.webobjects.eocontrol.EOKeyValueArchiving
EOKeyValueArchiving._NullValueSupport, EOKeyValueArchiving._NumberSupport, EOKeyValueArchiving._TimestampSupport, EOKeyValueArchiving.Awaking, EOKeyValueArchiving.FinishInitialization, EOKeyValueArchiving.Support
 
Field Summary
static Logger log
          logging support
static String MatchesAllInArraySelectorName
           
 
Fields inherited from class com.webobjects.eocontrol.EOKeyValueQualifier
_CLASS, _key, _lowercaseCache, _selector, _value
 
Fields inherited from class com.webobjects.eocontrol.EOQualifier
QualifierOperatorCaseInsensitiveLike, QualifierOperatorContains, QualifierOperatorEqual, QualifierOperatorGreaterThan, QualifierOperatorGreaterThanOrEqualTo, QualifierOperatorLessThan, QualifierOperatorLessThanOrEqualTo, QualifierOperatorLike, QualifierOperatorNotEqual
 
Constructor Summary
ERXToManyQualifier(String toManyKey, NSArray elements)
           
ERXToManyQualifier(String toManyKey, NSArray elements, int minCount)
           
 
Method Summary
 void addQualifierKeysToSet(NSMutableSet arg0)
           
 Object clone()
          Implementation of the Cloneable interface.
 NSArray elements()
           
 boolean evaluateWithObject(Object object)
           
 String key()
           
 int minCount()
           
 EOQualifier qualifierWithBindings(NSDictionary arg0, boolean arg1)
           
 String toString()
          Description of the qualfier.
 void validateKeysWithRootClassDescription(EOClassDescription arg0)
           
 
Methods inherited from class er.extensions.qualifiers.ERXKeyValueQualifier
and, filter, filtered, first, not, one, or, requiredOne
 
Methods inherited from class com.webobjects.eocontrol.EOKeyValueQualifier
_accept, classForCoder, decodeObject, decodeWithKeyValueUnarchiver, encodeWithCoder, encodeWithKeyValueArchiver, equals, selector, value
 
Methods inherited from class com.webobjects.eocontrol.EOQualifier
_isEmpty, allQualifierKeys, allQualifierOperators, bindingKeys, filterArrayWithQualifier, filteredArrayWithQualifier, keyPathForBindingKey, operatorSelectorForSelectorNamed, operatorSelectorForString, qualifierToMatchAllValues, qualifierToMatchAnyValue, qualifierWithQualifierFormat, relationalQualifierOperators, stringForOperatorSelector
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MatchesAllInArraySelectorName

public static String MatchesAllInArraySelectorName

log

public static final Logger log
logging support

Constructor Detail

ERXToManyQualifier

public ERXToManyQualifier(String toManyKey,
                          NSArray elements)

ERXToManyQualifier

public ERXToManyQualifier(String toManyKey,
                          NSArray elements,
                          int minCount)
Method Detail

elements

public NSArray elements()

key

public String key()
Overrides:
key in class EOKeyValueQualifier

minCount

public int minCount()

toString

public String toString()
Description of the qualfier.

Overrides:
toString in class EOKeyValueQualifier
Returns:
description of the key and which elements it should contain.

clone

public Object clone()
Implementation of the Cloneable interface.

Overrides:
clone in class EOQualifier
Returns:
clone of the qualifier.

qualifierWithBindings

public EOQualifier qualifierWithBindings(NSDictionary arg0,
                                         boolean arg1)
Overrides:
qualifierWithBindings in class EOKeyValueQualifier

validateKeysWithRootClassDescription

public void validateKeysWithRootClassDescription(EOClassDescription arg0)
Overrides:
validateKeysWithRootClassDescription in class EOKeyValueQualifier

addQualifierKeysToSet

public void addQualifierKeysToSet(NSMutableSet arg0)
Overrides:
addQualifierKeysToSet in class EOKeyValueQualifier

evaluateWithObject

public boolean evaluateWithObject(Object object)
Specified by:
evaluateWithObject in interface EOQualifierEvaluation
Overrides:
evaluateWithObject in class EOKeyValueQualifier

Last updated: Fri, Jan 9, 2009 • 04:35 AM EST

Copyright © 2002 – 2007 Project Wonder.