Project Wonder 2.0

er.extensions
Class ERXPrimaryKeyListQualifier

java.lang.Object
  extended bycom.webobjects.eocontrol.EOQualifier
      extended bycom.webobjects.eocontrol.EOKeyValueQualifier
          extended byer.extensions.ERXInQualifier
              extended byer.extensions.ERXPrimaryKeyListQualifier
All Implemented Interfaces:
Cloneable, EOKeyValueArchiving, EOQualifierEvaluation, NSCoding, Serializable

public class ERXPrimaryKeyListQualifier
extends ERXInQualifier

The primary key list qualifier is used to generate a qualifier that can be used to filter a result set for a given set of primary keys. Note that this uses the IN expression and as such may not work with some databases.

Given a list of EOs, this generates a query looking like ... t0.ID in (< the list of primary Keys for EOs in the list>) .. this is useful for pre-fetching type uses.

See Also:
Serialized Form

Nested Class Summary
static class ERXPrimaryKeyListQualifier.KeyValueQualifierSQLGenerationSupport
          Support class that listens for EOKeyValueQualifiers that have an isContainedInArray-selector and replaces these with the ERXPrimaryKeyListQualifier.
 
Nested classes inherited from class er.extensions.ERXInQualifier
ERXInQualifier.InQualifierSQLGenerationSupport
 
Nested classes inherited from class com.webobjects.eocontrol.EOQualifier
EOQualifier.Comparison, EOQualifier.ComparisonSupport, EOQualifier.QualifierVariableSubstitutionException
 
Nested classes inherited from class 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 inherited from class com.webobjects.eocontrol.EOKeyValueArchiving
EOKeyValueArchiving._NullValueSupport, EOKeyValueArchiving._NumberSupport, EOKeyValueArchiving._TimestampSupport, EOKeyValueArchiving.Awaking, EOKeyValueArchiving.FinishInitialization, EOKeyValueArchiving.Support
 
Field Summary
static String IsContainedInArraySelectorName
           
protected static ERXLogger log
          logging support
 
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
ERXPrimaryKeyListQualifier(NSArray eos)
          Constructs a primary key list qualifer for a given set of enterprise objects.
ERXPrimaryKeyListQualifier(String key, NSArray eos)
          Constructs a primary key list qualifer for a given set of enterprise objects and the primary key attribute name.
ERXPrimaryKeyListQualifier(String key, String foreignKey, NSArray eos)
          Constructs a primary key list qualifer for a given set of enterprise objects, the primary key attribute name and a foreign key.
 
Method Summary
 Object clone()
           
static void installSupport()
           
protected static String primaryKeyNameForObjects(NSArray eos)
          Calculates the primary key attribute name for an array of enterprise objects.
protected static NSArray validateObjects(NSArray eos)
          Simple validation routine used to ensure that the objects being passed in are enterprise objects and have more than one in the array.
 
Methods inherited from class er.extensions.ERXInQualifier
evaluateWithObject, toString, values
 
Methods inherited from class com.webobjects.eocontrol.EOKeyValueQualifier
_accept, addQualifierKeysToSet, classForCoder, decodeObject, decodeWithKeyValueUnarchiver, encodeWithCoder, encodeWithKeyValueArchiver, equals, key, qualifierWithBindings, selector, validateKeysWithRootClassDescription, 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

log

protected static final ERXLogger log
logging support


IsContainedInArraySelectorName

public static String IsContainedInArraySelectorName
Constructor Detail

ERXPrimaryKeyListQualifier

public ERXPrimaryKeyListQualifier(NSArray eos)
Constructs a primary key list qualifer for a given set of enterprise objects. For now only use this qualifier if the primary key attribute of your enterprise object is named 'id'.

Parameters:
eos - array of enterprise objects

ERXPrimaryKeyListQualifier

public ERXPrimaryKeyListQualifier(String key,
                                  NSArray eos)
Constructs a primary key list qualifer for a given set of enterprise objects and the primary key attribute name.

Parameters:
key - primary key attribute name
eos - array of enterprise objects

ERXPrimaryKeyListQualifier

public ERXPrimaryKeyListQualifier(String key,
                                  String foreignKey,
                                  NSArray eos)
Constructs a primary key list qualifer for a given set of enterprise objects, the primary key attribute name and a foreign key. This type of qualifier can be useful for prefetching a to-one relationship off of many enterprise objects.

Parameters:
key - primary key attribute name
foreignKey - attribute name.
eos - array of enterprise objects
Method Detail

installSupport

public static void installSupport()

clone

public Object clone()
Overrides:
clone in class ERXInQualifier

primaryKeyNameForObjects

protected static String primaryKeyNameForObjects(NSArray eos)
Calculates the primary key attribute name for an array of enterprise objects. This method assumes that all the entities of the objects have the same primary key attribute name.

Parameters:
eos - array of enterprise objects
Returns:
primary key name for the enterprise objects in the array.

validateObjects

protected static NSArray validateObjects(NSArray eos)
Simple validation routine used to ensure that the objects being passed in are enterprise objects and have more than one in the array.

Parameters:
eos - array of objects to check
Returns:
the array of objects if they pass the check.

Last updated: Do, Dez 9, 2004 • 12:46 PM CET

Copyright © 2002 – 2004 Project Wonder.