|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.sqlpower.wabit.dao.session.WorkspacePersisterListener
public class WorkspacePersisterListener
An implementation of WabitListener used exclusively for listening to
a WabitWorkspace and its children. When an event is fired from an
object this listener will convert the event into persist calls. The persist
calls will be made on the target persister.
| Constructor Summary | |
|---|---|
WorkspacePersisterListener(WabitSession session,
ca.sqlpower.dao.SPPersister targetPersister)
This listener should be added through the static method for attaching a listener to a session. |
|
WorkspacePersisterListener(WabitSession session,
ca.sqlpower.dao.SPPersister targetPersister,
WabitSessionPersister eventSource)
This listener should be added through the static method for attaching a listener to a session. |
|
| Method Summary | |
|---|---|
static WorkspacePersisterListener |
attachListener(WabitSession session,
ca.sqlpower.dao.SPPersister targetPersister,
WabitSessionPersister eventSource)
This will connect a new instance of this listener to the workspace and all of its descendants. |
void |
childAdded(ca.sqlpower.object.SPChildEvent e)
|
void |
childRemoved(ca.sqlpower.object.SPChildEvent e)
|
protected void |
persistChild(ca.sqlpower.object.SPObject parent,
ca.sqlpower.object.SPObject child,
java.lang.Class<? extends ca.sqlpower.object.SPObject> childClassType,
int indexOfChild)
Calls SPPersister.persistObject(String, String, String, int)
for the child object and
SPPersister.persistProperty(String, String, DataType, Object)
for each property on the object. |
void |
persistObject(ca.sqlpower.object.SPObject wo)
Persists the given object and all of its descendants to the next persister. |
void |
propertyChange(java.beans.PropertyChangeEvent evt)
|
void |
transactionEnded(ca.sqlpower.util.TransactionEvent e)
|
void |
transactionRollback(ca.sqlpower.util.TransactionEvent e)
|
void |
transactionStarted(ca.sqlpower.util.TransactionEvent e)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WorkspacePersisterListener(WabitSession session,
ca.sqlpower.dao.SPPersister targetPersister)
A new listener should only be created in testing. To properly add a
listener to a session see
#attachListener(WabitSession, SPPersister).
session - The session whose workspace will be listened to.targetPersister - The persister that will have the events be forwarded to as
persist calls.
public WorkspacePersisterListener(WabitSession session,
ca.sqlpower.dao.SPPersister targetPersister,
WabitSessionPersister eventSource)
A new listener should only be created in testing. To properly add a
listener to a session see
#attachListener(WabitSession, SPPersister).
session - The session whose workspace will be listened to.targetPersister - The persister that will have the events be forwarded to as
persist calls.eventSource - A SPPersister that this listener will consult in
order to perform 'echo-cancellation' of events.| Method Detail |
|---|
public static WorkspacePersisterListener attachListener(WabitSession session,
ca.sqlpower.dao.SPPersister targetPersister,
WabitSessionPersister eventSource)
session - The session to listen to for lifecycle changes and its
workspace will be listened to by a new persister listener.targetPersister - This persister will have persist methods called on it when
events occur in the workspace in the given session.public void transactionEnded(ca.sqlpower.util.TransactionEvent e)
transactionEnded in interface ca.sqlpower.object.SPListenerpublic void transactionRollback(ca.sqlpower.util.TransactionEvent e)
transactionRollback in interface ca.sqlpower.object.SPListenerpublic void transactionStarted(ca.sqlpower.util.TransactionEvent e)
transactionStarted in interface ca.sqlpower.object.SPListenerpublic void childAdded(ca.sqlpower.object.SPChildEvent e)
childAdded in interface ca.sqlpower.object.SPListenerpublic void persistObject(ca.sqlpower.object.SPObject wo)
wo - The root of the tree of objects that will be persisted. This
object and all of its children will be persisted.
protected void persistChild(ca.sqlpower.object.SPObject parent,
ca.sqlpower.object.SPObject child,
java.lang.Class<? extends ca.sqlpower.object.SPObject> childClassType,
int indexOfChild)
SPPersister.persistObject(String, String, String, int)
for the child object and
SPPersister.persistProperty(String, String, DataType, Object)
for each property on the object.
parent - The parent of the object being persisted as added to this
object.child - The child object that was added to its parent.childClassType - The object type of the child added.indexOfChild - The index of the child in the child list of the parent.public void childRemoved(ca.sqlpower.object.SPChildEvent e)
childRemoved in interface ca.sqlpower.object.SPListenerpublic void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange in interface java.beans.PropertyChangeListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||