org.caleigo.core
Class Qualifier

java.lang.Object
  extended byorg.caleigo.core.Qualifier
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CompositeQualifier, NegateQualifier, ProxyQualifier, RelationQualifier

public abstract class Qualifier
extends java.lang.Object
implements java.io.Serializable

The Qualifier class is the abstract base class for all Qualifier classes. A Qualifier is an object that is used to address/identify a selection of objects or single entity instance. A Qualifier that defines a single entity instance is called an identity qualifier.

The class defines three abstract methods that all non abstract qualifiers must implement. All subclasses should also override the toString() method to provide a suitable readable description of the qualifier for logging purposes. The class also provides a number of help methods to aid API-users in the construction of qualifiers.

Note that new non standard qualifiers must in some way be mapped or interpreted by the IDataService:s that are to be used in colaberation with the qualifier.

Version:
1.00
Author:
Dennis Zikovic
See Also:
Serialized Form

Nested Class Summary
protected  class Qualifier.RelayListener
          Simple listener class that relays all received events to the listeners registered in the proxy object.
 
Constructor Summary
Qualifier()
           
 
Method Summary
 void addQualifierListener(IQualifierListener listener)
          Adds an IQualifierListener to receive notifications of contents and structure changes from the Qualifier object.
 Qualifier and(IFieldDescriptor fieldDescriptor, java.lang.Object relationValue)
          Creates a logic intersection between the qualifier and a new qualifier defined by the provided field descriptor and data value.
 Qualifier and(IFieldDescriptor fieldDescriptor, RelationType relationType, java.lang.Object relationValue)
          Creates a logic intersection between the qualifier and a new qualifier defined by the provided field descriptor and data value.
 Qualifier and(Qualifier qualifier)
          Creates a logic intersection between the qualifiers.
abstract  boolean canDirectlyQualify(IEntityDescriptor entityDescriptor)
          This abstract method must return true if the qualifier can select entities of the type defined by the provided entity descriptor without the nead of any complementary data.
abstract  boolean canQualify(IEntityDescriptor entityDescriptor)
          This abstract method must return true if the qualifier logically can select entities of the type defined by the provided entity descriptor.
abstract  boolean canUniquelyQualify(IEntityDescriptor entityDescriptor)
          This abstract method must return true if the qualifier can uniquely select entities of the type defined by the provided entity descriptor.
static Qualifier combine(Qualifier qualifier1, Qualifier qualifier2)
          Creates a logic intersection between the qualifiers.
static Qualifier create(IFieldDescriptor fieldDescriptor, java.lang.Object relationValue)
          Creates a new relation qualifier defined by the defined by the provided field descriptor and data value.
static Qualifier create(IFieldDescriptor fieldDescriptor, RelationType relationType, java.lang.Object relationValue)
          Creates a new relation qualifier defined by the defined by the provided field descriptor, relation type and data value.
abstract  boolean doesQualify(IEntity entity)
          This abstract method must return true if the qualifier does select the provided entity object.
protected  void fireContentChangedEvent()
          Fire a new QualifierEvent as a content change notifictaion using the current Qualifier as the source to all registered IQualifierListeners.
protected  void fireQualifierEvent(QualifierEvent event)
          Fire the provided QualifierEvent to all registered IQualifierListeners.
protected  void fireStructureChangedEvent()
          Fire a new QualifierEvent as a structure change notifictaion using the current Qualifier as the source to all registered IQualifierListeners.
 Qualifier negate()
          Returns a negated version of the qualifier.
 Qualifier or(IFieldDescriptor fieldDescriptor, java.lang.Object relationValue)
          Creates a logic union between the qualifier and a new qualifier defined by the provided field descriptor and data value.
 Qualifier or(IFieldDescriptor fieldDescriptor, RelationType relationType, java.lang.Object relationValue)
          Creates a logic union between the qualifier and a new qualifier defined by the provided field descriptor and data value.
 Qualifier or(Qualifier qualifier)
          Creates a logic union between the qualifiers.
 void removeQualifierListener(IQualifierListener listener)
          Removes the specified IQualifierListener from the Qualifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Qualifier

public Qualifier()
Method Detail

create

public static Qualifier create(IFieldDescriptor fieldDescriptor,
                               java.lang.Object relationValue)
Creates a new relation qualifier defined by the defined by the provided field descriptor and data value.


create

public static Qualifier create(IFieldDescriptor fieldDescriptor,
                               RelationType relationType,
                               java.lang.Object relationValue)
Creates a new relation qualifier defined by the defined by the provided field descriptor, relation type and data value.


combine

public static Qualifier combine(Qualifier qualifier1,
                                Qualifier qualifier2)
Creates a logic intersection between the qualifiers. Note that this method generally creates a new composite qualifier unless the called qualifier is a CompositeQualifier with the union type INTERSECTION.


doesQualify

public abstract boolean doesQualify(IEntity entity)
This abstract method must return true if the qualifier does select the provided entity object.


canQualify

public abstract boolean canQualify(IEntityDescriptor entityDescriptor)
This abstract method must return true if the qualifier logically can select entities of the type defined by the provided entity descriptor.


canDirectlyQualify

public abstract boolean canDirectlyQualify(IEntityDescriptor entityDescriptor)
This abstract method must return true if the qualifier can select entities of the type defined by the provided entity descriptor without the nead of any complementary data. No other information than can be accessed through the provided entity descriptor should be neaded if this method returns true. This validates that the doesQualify method can be called for the called qualifier.


canUniquelyQualify

public abstract boolean canUniquelyQualify(IEntityDescriptor entityDescriptor)
This abstract method must return true if the qualifier can uniquely select entities of the type defined by the provided entity descriptor. If that is the case then the qualifier is an identity qualifier and can never qualify more then a single entity instance of the specified type.


addQualifierListener

public void addQualifierListener(IQualifierListener listener)
Adds an IQualifierListener to receive notifications of contents and structure changes from the Qualifier object.


removeQualifierListener

public void removeQualifierListener(IQualifierListener listener)
Removes the specified IQualifierListener from the Qualifier.


and

public Qualifier and(Qualifier qualifier)
Creates a logic intersection between the qualifiers. Note that this method generally creates a new composite qualifier unless the called qualifier is a CompositeQualifier with the union type INTERSECTION.


and

public Qualifier and(IFieldDescriptor fieldDescriptor,
                     java.lang.Object relationValue)
Creates a logic intersection between the qualifier and a new qualifier defined by the provided field descriptor and data value. Note that this method generally creates a new composite qualifier unless the called qualifier is a CompositeQualifier with the union type INTERSECTION.


and

public Qualifier and(IFieldDescriptor fieldDescriptor,
                     RelationType relationType,
                     java.lang.Object relationValue)
Creates a logic intersection between the qualifier and a new qualifier defined by the provided field descriptor and data value. Note that this method generally creates a new composite qualifier unless the called qualifier is a CompositeQualifier with the union type INTERSECTION.


or

public Qualifier or(Qualifier qualifier)
Creates a logic union between the qualifiers. Note that this method generally creates a new composite qualifier unless the called qualifier is a CompositeQualifier with the union type UNION.


or

public Qualifier or(IFieldDescriptor fieldDescriptor,
                    java.lang.Object relationValue)
Creates a logic union between the qualifier and a new qualifier defined by the provided field descriptor and data value. Note that this method generally creates a new composite qualifier unless the called qualifier is a CompositeQualifier with the union type UNION.


or

public Qualifier or(IFieldDescriptor fieldDescriptor,
                    RelationType relationType,
                    java.lang.Object relationValue)
Creates a logic union between the qualifier and a new qualifier defined by the provided field descriptor and data value. Note that this method generally creates a new composite qualifier unless the called qualifier is a CompositeQualifier with the union type UNION.


negate

public Qualifier negate()
Returns a negated version of the qualifier.


fireQualifierEvent

protected void fireQualifierEvent(QualifierEvent event)
Fire the provided QualifierEvent to all registered IQualifierListeners.


fireStructureChangedEvent

protected void fireStructureChangedEvent()
Fire a new QualifierEvent as a structure change notifictaion using the current Qualifier as the source to all registered IQualifierListeners.


fireContentChangedEvent

protected void fireContentChangedEvent()
Fire a new QualifierEvent as a content change notifictaion using the current Qualifier as the source to all registered IQualifierListeners.



Copyright © 2005 Caleigo. All Rights Reserved.