All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.demos.travel.flight.rules.CarrierRestrictionDip

java.lang.Object
   |
   +----com.ibm.beans.dip.SimpleDip
           |
           +----com.ibm.beans.demos.travel.flight.rules.CarrierRestrictionDip

public class CarrierRestrictionDip
extends SimpleDip
implements DipPropertyChangeListener, Serializable
This class implements a business rule which restricts the flight carriers (airlines) accessible via the FlightInfoDapProperties. It does this by hooking to the sql property and adding an SQL query clause which eliminates the particular carrier. The carrier to restrict is a property of this dip.

See the Carrier Restriction Dip Usage Guide for information regarding how to setup and use this dip.


Constructor Index

 o CarrierRestrictionDip()

Method Index

 o createImplementation(Object)
Checks the object to which the dip is being applied to ensure that the object is a FlightInfoDapProperties.
 o createPropertyChangeListener(Object, String[])
Creates the object to receive notification when the SQL property changes.
 o getCarrier()
Gets the name of the airline to restrict usage of.
 o includeInMorphedClass(String)
Determines if a method should be included in a morphed class.
 o propertyChange(PropertyChangeEvent)
Handles a property change event.
 o setCarrier(String)
Sets the name of the airline to restrict usage of.
 o typeName()
Defines this dip to be related to restricting use of an airline carrier.

Constructors

 o CarrierRestrictionDip
 public CarrierRestrictionDip()

Methods

 o setCarrier
 public void setCarrier(String carrierName)
Sets the name of the airline to restrict usage of.

 o getCarrier
 public String getCarrier()
Gets the name of the airline to restrict usage of.

 o typeName
 public final String typeName()
Defines this dip to be related to restricting use of an airline carrier.

Returns:
The type name of the dip.
Overrides:
typeName in class SimpleDip
 o includeInMorphedClass
 public boolean includeInMorphedClass(String methodName)
Determines if a method should be included in a morphed class. When the dip is applied to a class as a pre-dip during morphing, and the user elects to only override those methods in the dippable class that the pre-dips agrees to, this method is used to determine if a dip agrees to including a specific method.

The only method of the dippable bean that the CarrierRestrictionDip needs to be wrapped is the setSQLString method.

Parameters:
methodName - Name of the method to be considered
Returns:
boolean indicating whether to wrap given method
Overrides:
includeInMorphedClass in class SimpleDip
 o createImplementation
 public Object createImplementation(Object obj) throws DipRejectAdditionException
Checks the object to which the dip is being applied to ensure that the object is a FlightInfoDapProperties. If it is not, then an exception is thrown and the application of the dip is rejected.

Parameters:
obj - The bean being dipped.
Throws: DipRejectAdditionException
This method will throw this exception if obj is not a FlightInfoDapProperties.
Overrides:
createImplementation in class SimpleDip
 o createPropertyChangeListener
 public DipPropertyChangeListener[] createPropertyChangeListener(Object imp,
                                                                 String methods[]) throws DipRejectAdditionException
Creates the object to receive notification when the SQL property changes.

Parameters:
imp - The implementation returned by createImplementation.
methods - The array of methods in the dippable bean.
Returns:
The array of DipPropertyChangeListeners with the dip itself set to listen at the appropriate method index to receive property change notifications.
Throws: DipRejectAdditionException
This method will throw this exception if some needed methods of the dippable bean were not wrapped.
Overrides:
createPropertyChangeListener in class SimpleDip
 o propertyChange
 public void propertyChange(PropertyChangeEvent e)
Handles a property change event. The Carrier Restriction Dip will enforce appropriate SQL clauses to remove the designated carrier from the list of carriers possible.


All Packages  Class Hierarchy  This Package  Previous  Next  Index