ca.sqlpower.wabit
Interface WabitObject

All Known Subinterfaces:
ReportContentRenderer, ResultSetProducer, WabitBackgroundWorker, WabitObjectReportRenderer
All Known Implementing Classes:
AbstractWabitObject, CellSetRenderer, Chart, ChartColumn, ChartRenderer, ColumnInfo, ContentBox, Grant, Group, GroupMember, Guide, ImageRenderer, Label, Layout, OlapQuery, Page, QueryCache, Report, ReportTask, ResultSetRenderer, Template, User, WabitColumnItem, WabitConstantItem, WabitConstantsContainer, WabitContainer, WabitDataSource, WabitImage, WabitItem, WabitJoin, WabitOlapAxis, WabitOlapDimension, WabitOlapExclusion, WabitOlapInclusion, WabitOlapSelection, WabitTableContainer, WabitWorkspace

public interface WabitObject


Method Summary
 void addChild(WabitObject child, int index)
          Adds the given child object to this object.
 void addWabitListener(WabitListener l)
          Adds a listener that will be notified when children are added to or removed from this object, when properties change, and when a transaction starts and ends.
 boolean allowsChildren()
          Returns true if this object may contain children.
 void begin(java.lang.String message)
          Starts a transaction that will pool multiple events into a compound event.
 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()
          Disconnects this object from any other objects it is listening to, closes any open connections, and performs any other necessary operations to ensure that this object can be discarded.
 void commit()
          Signals the end of a transaction of a compound event.
 void generateNewUUID()
          Sets the UUID of this object to a newly generated UUID.
 java.util.List<? extends WabitObject> getChildren()
          Returns an unmodifiable list of the children in this WabitObject.
<T extends WabitObject>
java.util.List<T>
getChildren(java.lang.Class<T> type)
          Returns a list of all children of the given type
 java.util.List<WabitObject> getDependencies()
          Returns a list of all WabitObjects that this Wabit object is dependent on.
 java.lang.String getName()
          Returns the short name for this object.
 WabitObject getParent()
          Returns the parent of this WabitObject.
 java.lang.String getUUID()
           
 boolean removeChild(WabitObject child)
          Removes the given child object from this object.
 void removeDependency(WabitObject dependency)
          Removes the given object as a dependency of this object.
 void removeWabitListener(WabitListener l)
          Removes a listener that was previously attached to this wabit object.
 void rollback(java.lang.String message)
          Signals the roll back of a transaction.
 void setName(java.lang.String name)
          Sets the name for this object
 void setParent(WabitObject parent)
          Sets the parent of this object to the given object.
 void setUUID(java.lang.String uuid)
           
 

Method Detail

addWabitListener

void addWabitListener(WabitListener l)
Adds a listener that will be notified when children are added to or removed from this object, when properties change, and when a transaction starts and ends. The events will always be fired in the foreground.

Parameters:
l - The listener to add.
See Also:
WabitListener, WabitSession.runInForeground(Runnable)

removeWabitListener

void removeWabitListener(WabitListener l)
Removes a listener that was previously attached to this wabit object.

Parameters:
l - The listener to remove.

getParent

WabitObject getParent()
Returns the parent of this WabitObject. This will be null when the object is first created until it is added as a child to another object. If this object is never added as a child to another object this will remain null and the object may be treated as the root node of a WabitObject tree.

Returns:
The parent of this object.

setParent

void setParent(WabitObject parent)
Sets the parent of this object to the given object. This should only be done when this object is being added as a child to another object.

Parameters:
parent - The new parent of this object.

getChildren

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


allowsChildren

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

See Also:
childPositionOffset(Class)

childPositionOffset

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.

Throws:
java.lang.IllegalArgumentException - if the given child class is not valid for this OLAPObject.

removeChild

boolean removeChild(WabitObject child)
                    throws ObjectDependentException,
                           java.lang.IllegalArgumentException
Removes the given child object from this object. If the given child is not an actual child of this object an illegal argument exception will be thrown. If the child has dependencies and cannot be removed an object dependent exception will be thrown.

Parameters:
child - The object to remove as a child of this object.
Returns:
True if the child was successfully removed. False if the child was not removed from this object.
Throws:
ObjectDependentException
java.lang.IllegalArgumentException

addChild

void addChild(WabitObject child,
              int index)
              throws java.lang.IllegalArgumentException
Adds the given child object to this object.

Parameters:
child - The object to add as a child of this object.
index - The index to add the child to. This cannot be greater than the number of children in the object of the given type. This is the position of the child in the list of children of a specific type. The position of the child is in respect to children of its type.
Throws:
java.lang.IllegalArgumentException - If the given child is not a valid child type of the object.

getName

@Nullable
java.lang.String getName()
Returns the short name for this object.


setName

void setName(@Nullable
             java.lang.String name)
Sets the name for this object


getUUID

java.lang.String getUUID()

setUUID

void setUUID(java.lang.String uuid)

generateNewUUID

void generateNewUUID()
Sets the UUID of this object to a newly generated UUID. This is necessary if the object is being cloned or copied to a new workspace.


removeDependency

void removeDependency(@Nonnull
                      WabitObject dependency)
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.


getDependencies

java.util.List<WabitObject> getDependencies()
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.


cleanup

CleanupExceptions cleanup()
Disconnects this object from any other objects it is listening to, closes any open connections, and performs any other necessary operations to ensure that this object can be discarded. Once this object has been cleaned up none of its methods should be called. This method will only cleanup this object and not its descendants. To clean up this object and its descendants see WabitUtils.cleanupWabitObject(WabitObject).

Calling cleanup does not mean the object must be disconnected from the workspace as all objects will be cleaned up when the session is closing. The object can also still have other objects dependent on it unlike removeChild(WabitObject).

Returns:
A collection of exceptions and errors that occurred during cleanup if any occurred.

begin

void begin(java.lang.String message)
Starts a transaction that will pool multiple events into a compound event.

Parameters:
message - Description of the compound event.

commit

void commit()
Signals the end of a transaction of a compound event.


rollback

void rollback(java.lang.String message)
Signals the roll back of a transaction. The events of the transaction should not be acted on and/or should be undone.

Parameters:
message - Reason for the roll back.

getChildren

<T extends WabitObject> java.util.List<T> getChildren(java.lang.Class<T> type)
Returns a list of all children of the given type



Copyright © 2009. All Rights Reserved.