ca.sqlpower.wabit
Class WabitJoin

java.lang.Object
  extended by ca.sqlpower.wabit.AbstractWabitObject
      extended by ca.sqlpower.wabit.WabitJoin
All Implemented Interfaces:
ca.sqlpower.query.Join, WabitObject

public class WabitJoin
extends AbstractWabitObject
implements ca.sqlpower.query.Join

Wraps a SQLJoin and converts events on the join to WabitListener events.


Constructor Summary
WabitJoin(QueryCache query, ca.sqlpower.query.SQLJoin delegate)
          Constructs a WabitJoin that converts SQLJoin events to WabitListener events.
 
Method Summary
 void addJoinChangeListener(java.beans.PropertyChangeListener l)
           
 boolean allowsChildren()
          Returns true if this object may contain children.
 int childPositionOffset(java.lang.Class<? extends WabitObject> childType)
          Returns the position in the list that would be returned by getChildren() that the first object of type childClass is, or where it would be if there were any children of that type.
 CleanupExceptions cleanup()
          Default cleanup method that does nothing.
protected  void firePropertyChangeEvent(java.beans.PropertyChangeEvent evt)
           
 java.util.List<? extends WabitObject> getChildren()
          Returns an unmodifiable list of the children in this WabitObject.
 java.lang.String getComparator()
           
 ca.sqlpower.query.SQLJoin getDelegate()
          Returns the SQLJoin delegate of this object.
 java.util.List<WabitObject> getDependencies()
          Returns a list of all WabitObjects that this Wabit object is dependent on.
 ca.sqlpower.query.Item getLeftColumn()
           
 QueryCache getQuery()
          XXX The query may be equivalent to the parent.
 ca.sqlpower.query.Item getRightColumn()
           
 boolean isLeftColumnOuterJoin()
           
 boolean isRightColumnOuterJoin()
           
 void removeAllListeners()
          This remove all the listeners inside this object's delegate to ensure that listeners do not remain attached to the join when it is removed.
protected  boolean removeChildImpl(WabitObject child)
          This is the object specific implementation of removeChild.
 void removeDependency(WabitObject dependency)
          Removes the given object as a dependency of this object.
 void removeJoinChangeListener(java.beans.PropertyChangeListener l)
           
 void setComparator(java.lang.String comparator)
           
 void setLeftColumnOuterJoin(boolean isOuterJoin)
           
 void setRightColumnOuterJoin(boolean isOuterJoin)
           
 
Methods inherited from class ca.sqlpower.wabit.AbstractWabitObject
addChild, addChildImpl, addWabitListener, begin, beginTransaction, commit, commitTransaction, equals, fireChildAdded, fireChildRemoved, firePropertyChange, firePropertyChange, firePropertyChange, fireTransactionEnded, fireTransactionRollback, fireTransactionStarted, generateNewUUID, getChildren, getName, getParent, getSession, getUUID, isForegroundThread, removeChild, removeWabitListener, rollback, rollbackTransaction, runInBackground, runInForeground, setName, setParent, setUUID, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ca.sqlpower.query.Join
getName, getUUID, setName, setUUID
 

Constructor Detail

WabitJoin

public WabitJoin(QueryCache query,
                 ca.sqlpower.query.SQLJoin delegate)
Constructs a WabitJoin that converts SQLJoin events to WabitListener events.

Parameters:
query - The QueryCache this WabitJoin will be a part of. This is passed in to find the appropriate WabitItem objects for the left and right columns of the given SQLJoin. If new WabitItems are created here their UUIDs would not match the WabitItems in the QueryCache and be considered different object.
delegate - The SQLJoin to listen to.
Method Detail

firePropertyChangeEvent

protected void firePropertyChangeEvent(java.beans.PropertyChangeEvent evt)

cleanup

public CleanupExceptions cleanup()
Description copied from class: AbstractWabitObject
Default cleanup method that does nothing. Override and implement this method if cleanup is necessary.

Specified by:
cleanup in interface WabitObject
Overrides:
cleanup in class AbstractWabitObject
Returns:
A collection of exceptions and errors that occurred during cleanup if any occurred.

getQuery

public QueryCache getQuery()
XXX The query may be equivalent to the parent. If this is the case the query variable should be merged with the parent.


getDelegate

public ca.sqlpower.query.SQLJoin getDelegate()
Returns the SQLJoin delegate of this object. XXX This method should be removed in the future to make its delegate a proper delegate.


removeChildImpl

protected boolean removeChildImpl(WabitObject child)
Description copied from class: AbstractWabitObject
This is the object specific implementation of removeChild. There are checks in the removeChild method to ensure the child being removed has no dependencies and is a child of this object.

Specified by:
removeChildImpl in class AbstractWabitObject
See Also:
AbstractWabitObject.removeChild(WabitObject)

allowsChildren

public boolean allowsChildren()
Description copied from interface: WabitObject
Returns true if this object may contain children. Not all types of WabitObjects can be a child to any WabitObject.

Specified by:
allowsChildren in interface WabitObject
See Also:
WabitObject.childPositionOffset(Class)

childPositionOffset

public int childPositionOffset(java.lang.Class<? extends WabitObject> childType)
Description copied from interface: WabitObject
Returns the position in the list that would be returned by getChildren() that the first object of type childClass is, or where it would be if there were any children of that type.

Specified by:
childPositionOffset in interface WabitObject

getChildren

public java.util.List<? extends WabitObject> getChildren()
Description copied from interface: WabitObject
Returns an unmodifiable list of the children in this WabitObject. If there are no children in this WabitObject an empty list should be returned.

Specified by:
getChildren in interface WabitObject

getDependencies

public java.util.List<WabitObject> getDependencies()
Description copied from interface: WabitObject
Returns a list of all WabitObjects that this Wabit object is dependent on. Children of a WabitObject are not dependencies and will not be returned in this list. If there are no objects this Wabit object is dependent on an empty list should be returned. These are only the immediate dependencies of this object. If you want to find the dependencies of this object's dependencies as well it may be useful to look at WorkspaceGraphModel to make a full graph of all of the dependencies.

Specified by:
getDependencies in interface WabitObject

removeDependency

public void removeDependency(WabitObject dependency)
Description copied from interface: WabitObject
Removes the given object as a dependency of this object. For this object to no longer be dependent on the given dependency all of its children must also not be dependent on the given dependency when this method returns. This may remove this object from its parent if necessary.

Specified by:
removeDependency in interface WabitObject

setLeftColumnOuterJoin

public void setLeftColumnOuterJoin(boolean isOuterJoin)
Specified by:
setLeftColumnOuterJoin in interface ca.sqlpower.query.Join

isLeftColumnOuterJoin

public boolean isLeftColumnOuterJoin()
Specified by:
isLeftColumnOuterJoin in interface ca.sqlpower.query.Join

setRightColumnOuterJoin

public void setRightColumnOuterJoin(boolean isOuterJoin)
Specified by:
setRightColumnOuterJoin in interface ca.sqlpower.query.Join

isRightColumnOuterJoin

public boolean isRightColumnOuterJoin()
Specified by:
isRightColumnOuterJoin in interface ca.sqlpower.query.Join

setComparator

public void setComparator(java.lang.String comparator)
Specified by:
setComparator in interface ca.sqlpower.query.Join

getComparator

public java.lang.String getComparator()
Specified by:
getComparator in interface ca.sqlpower.query.Join

addJoinChangeListener

public void addJoinChangeListener(java.beans.PropertyChangeListener l)
Specified by:
addJoinChangeListener in interface ca.sqlpower.query.Join

getLeftColumn

public ca.sqlpower.query.Item getLeftColumn()
Specified by:
getLeftColumn in interface ca.sqlpower.query.Join

getRightColumn

public ca.sqlpower.query.Item getRightColumn()
Specified by:
getRightColumn in interface ca.sqlpower.query.Join

removeAllListeners

public void removeAllListeners()
This remove all the listeners inside this object's delegate to ensure that listeners do not remain attached to the join when it is removed. Used for deleting a join.

XXX This should be removed and objects adding listeners to a join should remove the joins appropriately when they are not needed.

Specified by:
removeAllListeners in interface ca.sqlpower.query.Join

removeJoinChangeListener

public void removeJoinChangeListener(java.beans.PropertyChangeListener l)
Specified by:
removeJoinChangeListener in interface ca.sqlpower.query.Join


Copyright © 2009. All Rights Reserved.