InstanceLifecycleListener[] ls = null;
if (event2lifecycleListeners != null) {
ls = (InstanceLifecycleListener[])
event2lifecycleListeners.get(new Integer(eventType));
}
InstanceLifecycleEvent ev;
switch(eventType) {
case HomeItf.POST_NEW: //makePersist
if (ls != null) {
ev = new InstanceLifecycleEvent(source, InstanceLifecycleEvent.CREATE, target);
for(int i=0; i < ls.length; i++)
((CreateLifecycleListener) ls[i]).postCreate(ev);
}
break;
case HomeItf.PRE_REMOVE: //deletePersistent
if (source instanceof DeleteCallback) {
((DeleteCallback) source).jdoPreDelete();
}
if (ls != null) {
ev = new InstanceLifecycleEvent(source, InstanceLifecycleEvent.DELETE, target);
for(int i=0; i < ls.length; i++)
((DeleteLifecycleListener) ls[i]).preDelete(ev);
}
break;
case HomeItf.POST_REMOVE://deletePersistent
if (ls != null) {
ev = new InstanceLifecycleEvent(source, InstanceLifecycleEvent.DELETE, target);
for(int i=0; i < ls.length; i++)
((DeleteLifecycleListener) ls[i]).postDelete(ev);
}
break;
case HomeItf.POST_LOAD:
if (source instanceof LoadCallback) {
((LoadCallback) source).jdoPostLoad();
}
if (ls != null) {
ev = new InstanceLifecycleEvent(source, InstanceLifecycleEvent.LOAD, target);
for(int i=0; i < ls.length; i++)
((LoadLifecycleListener) ls[i]).postLoad(ev);
}
break;
case HomeItf.PRE_DIRTY:
if (ls != null) {
ev = new InstanceLifecycleEvent(source, InstanceLifecycleEvent.DIRTY, target);
for(int i=0; i < ls.length; i++)
((DirtyLifecycleListener) ls[i]).preDirty(ev);
}
break;
case HomeItf.POST_DIRTY:
if (ls != null) {
ev = new InstanceLifecycleEvent(source, InstanceLifecycleEvent.DIRTY, target);
for(int i=0; i < ls.length; i++)
((DirtyLifecycleListener) ls[i]).postDirty(ev);
}
break;
case HomeItf.PRE_CREATE: //INSERT
case HomeItf.PRE_UPDATE: //UPDATE
case HomeItf.PRE_DELETE: //DELETE
if (source instanceof StoreCallback) {
((StoreCallback) source).jdoPreStore();
}
if (ls != null) {
ev = new InstanceLifecycleEvent(source, InstanceLifecycleEvent.STORE, target);
for(int i=0; i < ls.length; i++)
((StoreLifecycleListener) ls[i]).preStore(ev);
}
break;
case HomeItf.POST_CREATE:
case HomeItf.POST_UPDATE:
case HomeItf.POST_DELETE:
if (ls != null) {
ev = new InstanceLifecycleEvent(source, InstanceLifecycleEvent.STORE, target);
for(int i=0; i < ls.length; i++)
((StoreLifecycleListener) ls[i]).postStore(ev);
}
break;
case HomeItf.PRE_CLEAR:
if (source instanceof ClearCallback) {
((ClearCallback) source).jdoPreClear();
}
if (ls != null) {
ev = new InstanceLifecycleEvent(source, InstanceLifecycleEvent.CLEAR, target);
for(int i=0; i < ls.length; i++)
((ClearLifecycleListener) ls[i]).preClear(ev);
}
break;
case HomeItf.POST_CLEAR:
if (ls != null) {
ev = new InstanceLifecycleEvent(source, InstanceLifecycleEvent.CLEAR, target);
for(int i=0; i < ls.length; i++)
((ClearLifecycleListener) ls[i]).postClear(ev);
}
break;
case HomeItf.PRE_ATTACH:
if (ls != null) {
ev = new InstanceLifecycleEvent(source, InstanceLifecycleEvent.ATTACH, target);
for(int i=0; i < ls.length; i++)
((AttachLifecycleListener) ls[i]).preAttach(ev);
}
break;
case HomeItf.POST_ATTACH:
if (ls != null) {
ev = new InstanceLifecycleEvent(source, InstanceLifecycleEvent.ATTACH, target);
for(int i=0; i < ls.length; i++)
((AttachLifecycleListener) ls[i]).postAttach(ev);
}
break;
case HomeItf.PRE_DETACH:
if (ls != null) {
ev = new InstanceLifecycleEvent(source, InstanceLifecycleEvent.DETACH, target);
for(int i=0; i < ls.length; i++)
((DetachLifecycleListener) ls[i]).preDetach(ev);
}
break;
case HomeItf.POST_DETACH:
if (ls != null) {
ev = new InstanceLifecycleEvent(source, InstanceLifecycleEvent.DETACH, target);
for(int i=0; i < ls.length; i++)
((DetachLifecycleListener) ls[i]).postDetach(ev);
}
break;
}