WebObjects 5.2

com.webobjects.eocontrol
Class EONotQualifier

java.lang.Object
  |
  +--com.webobjects.eocontrol.EOQualifier
        |
        +--com.webobjects.eocontrol.EONotQualifier
All Implemented Interfaces:
EOKeyValueArchiving, EOQualifierEvaluation, NSCoding, Serializable

public class EONotQualifier
extends EOQualifier
implements NSCoding, EOKeyValueArchiving

EONotQualifier is a subclass of EOQualifier that contains a single qualifier. When an EONotQualifier object is evaluated, it returns the inverse of the result obtained by evaluating the qualifier it contains.

EONotQualifier implements the EOQualifierEvaluation interface, which defines the method evaluateWithObject for in-memory evaluation. When an EONotQualifier object receives an evaluateWithObject message, it evaluates the given object to determine if it satisfies the qualifier criteria.

You can generate SQL code for an EONotQualifier using the EOSQLExpression static method sqlStringForNegatedQualifier.

See Also:
Serialized Form

Inner classes inherited from class com.webobjects.eocontrol.EOQualifier
EOQualifier.Comparison, EOQualifier.ComparisonSupport, EOQualifier.QualifierVariableSubstitutionException
 
Inner classes inherited from class com.webobjects.foundation.NSCoding
NSCoding.Support
 
Inner classes inherited from class com.webobjects.eocontrol.EOKeyValueArchiving
EOKeyValueArchiving.Awaking, EOKeyValueArchiving.FinishInitialization, EOKeyValueArchiving.Support
 
Fields inherited from class com.webobjects.eocontrol.EOQualifier
QualifierOperatorCaseInsensitiveLike, QualifierOperatorContains, QualifierOperatorEqual, QualifierOperatorGreaterThan, QualifierOperatorGreaterThanOrEqualTo, QualifierOperatorLessThan, QualifierOperatorLessThanOrEqualTo, QualifierOperatorLike, QualifierOperatorNotEqual
 
Constructor Summary
EONotQualifier(EOQualifier qualifier)
          Creates and returns a new EONotQualifier.
 
Method Summary
 void addQualifierKeysToSet(NSMutableSet qualKeys)
          Adds the receiver's qualifier keys to qualKeys.
 Class classForCoder()
          Allows the receiver, before being encoded, to substitute a class other than its own in a coder.
static Object decodeObject(NSCoder coder)
           
static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
           
 void encodeWithCoder(NSCoder coder)
          Encodes the receiver using coder.
 void encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
          Asks the receiver to archive its state into the EOKeyValueArchiver archiver.
 boolean equals(Object other)
           
 boolean evaluateWithObject(Object object)
          Returns true if the object object satisfies the EONotQualifier, false otherwise.
 EOQualifier qualifier()
           
 EOQualifier qualifierWithBindings(NSDictionary bindings, boolean requiresAll)
          Returns a new qualifier substituting all variables with values found in bindings.
 String toString()
          Converts the receiver to a string.
 void validateKeysWithRootClassDescription(EOClassDescription classDesc)
          Ensures that the receiver contains keys and key paths that belong to or originate from classDesc.
 
Methods inherited from class com.webobjects.eocontrol.EOQualifier
allQualifierKeys, allQualifierOperators, bindingKeys, clone, 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
 

Constructor Detail

EONotQualifier

public EONotQualifier(EOQualifier qualifier)
Creates and returns a new EONotQualifier.

If qualifier is specified, it is used as the qualifier. For example, the following code excerpt constructs a qualifier, baseQual, and uses it to initialize an EONotQualifier, negQual. The EONotQualifier negQual is then used to filter an in-memory array. The code excerpt returns an array of Guest objects whose lastName properties do not have the same value as the lastName property of the guest's sponsoring member (this example is based on the Rentals sample database). In other words, the EONotQualifier negQual inverts the effects of baseQual.

NSArray guests EOQualifier baseQual; EONotQualifier negQual; baseQual = EOQualifier.qualifierWithQualifierFormat(lastName = member.lastName, null); negQual = new EONotQualifier(baseQual); return EOQualifier.filteredArrayWithQualifier(guests, negQual);

Parameters:
qualifier - abstract class for objects that hold information used to restrict selections on objects or database rows according to specified criteria.
Method Detail

addQualifierKeysToSet

public void addQualifierKeysToSet(NSMutableSet qualKeys)
Adds the receiver's qualifier keys to qualKeys. The subclasses in the EOControl framework do this by traversing the tree of qualifiers. Node qualifiers (such as EOAndQualifier) recursively invoke this method until they reach a leaf qualifier (such as EOKeyValueQualifier) which adds its key to the set.

Subclasses of EOQualifier must implement this method.

Overrides:
addQualifierKeysToSet in class EOQualifier
Parameters:
qualKeys - input array of qualifier keys

classForCoder

public Class classForCoder()
Description copied from interface: NSCoding
Allows the receiver, before being encoded, to substitute a class other than its own in a coder. For example, private subclasses can substitute the name of a public superclass when being encoded.
Specified by:
classForCoder in interface NSCoding
Returns:
the substituted class

decodeObject

public static Object decodeObject(NSCoder coder)
Parameters:
coder - input array of data
Returns:
object created from the data in the coder

decodeWithKeyValueUnarchiver

public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
Parameters:
unarchiver - source of archived qualifier
Returns:
object decoded from unarchiver

encodeWithCoder

public void encodeWithCoder(NSCoder coder)
Description copied from interface: NSCoding
Encodes the receiver using coder. Object type information along with an object's data is stored.
Specified by:
encodeWithCoder in interface NSCoding
Parameters:
coder - the input array with data

encodeWithKeyValueArchiver

public void encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
Description copied from interface: EOKeyValueArchiving
Asks the receiver to archive its state into the EOKeyValueArchiver archiver.
Specified by:
encodeWithKeyValueArchiver in interface EOKeyValueArchiving
Parameters:
archiver - destination for archived qualifier

equals

public boolean equals(Object other)
Overrides:
equals in class Object
Parameters:
other - target of comparison
Returns:
true if this qualifier is equal to the input object

evaluateWithObject

public boolean evaluateWithObject(Object object)
Returns true if the object object satisfies the EONotQualifier, false otherwise. This method can throw one of several possible exceptions if an error occurs. If the application allows users to construct arbitrary qualifiers (such as through a user interface), you may want to write code to catch any exceptions and respond to errors (for example, by displaying a panel saying that the user typed a poorly formed qualifier).
Overrides:
evaluateWithObject in class EOQualifier
Parameters:
object - the input object
Returns:
true if the object object satisfies the EONotQualifier, false otherwise
Throws:
exception - when an error occurs

qualifier

public EOQualifier qualifier()
Returns:
the inverted qualifier

qualifierWithBindings

public EOQualifier qualifierWithBindings(NSDictionary bindings,
                                         boolean requiresAll)
Returns a new qualifier substituting all variables with values found in bindings. If requiresAll is true, any variable not found in bindings throws an exception. If requiresAll is false, missing variable values cause the qualifier node to be pruned from the tree.
Overrides:
qualifierWithBindings in class EOQualifier
Parameters:
bindings - the input array with bindings
requiresAll - true if all the values are required, false otherwise
Returns:
the EOQualifier object with the bindings

toString

public String toString()
Converts the receiver to a string.
Overrides:
toString in class Object
Returns:
the string corresponding to the qualifier

validateKeysWithRootClassDescription

public void validateKeysWithRootClassDescription(EOClassDescription classDesc)
Ensures that the receiver contains keys and key paths that belong to or originate from classDesc. This method raises an exception if an unknown key is found, otherwise it returns null to indicate that the keys contained by the qualifier are valid.
Overrides:
validateKeysWithRootClassDescription in class EOQualifier
Parameters:
classDesc - bridge between enterprise objects and the metadata contained in an external source of information.
Throws:
exception - if unknown key is found

Last updated Fri Feb 21 13:15:00 PST 2003.

Copyright © 2003 Apple Computer, Inc.