private void postDelete() { PostDeleteEventListener[] postListeners = getSession().getListeners() .getPostDeleteEventListeners(); if (postListeners.length>0) { PostDeleteEvent postEvent = new PostDeleteEvent( getInstance(), getId(), state, getPersister(), (EventSource) getSession() ); for ( int i = 0; i < postListeners.length; i++ ) { postListeners[i].onPostDelete(postEvent); } } }
private void postCommitDelete() { PostDeleteEventListener[] postListeners = getSession().getListeners() .getPostCommitDeleteEventListeners(); if (postListeners.length>0) { PostDeleteEvent postEvent = new PostDeleteEvent( getInstance(), getId(), state, getPersister(), (EventSource) getSession() ); for ( int i = 0; i < postListeners.length; i++ ) { postListeners[i].onPostDelete(postEvent); } } }
private static void addEventListeners(PageContext pc, SessionFactoryData data, Key key) throws PageException { if(!data.getORMConfiguration().eventHandling()) return; String eventHandler = data.getORMConfiguration().eventHandler(); AllEventListener listener=null; if(!Util.isEmpty(eventHandler,true)){ //try { Component c = pc.loadComponent(eventHandler.trim()); listener = new AllEventListener(c); //config.setInterceptor(listener); //}catch (PageException e) {e.printStackTrace();} } Configuration conf = data.getConfiguration(key); conf.setInterceptor(new InterceptorImpl(listener)); EventListeners listeners = conf.getEventListeners(); Map<String, CFCInfo> cfcs = data.getCFCs(key); // post delete List<EventListener> list=merge(listener,cfcs,CommonUtil.POST_DELETE); listeners.setPostDeleteEventListeners(list.toArray(new PostDeleteEventListener[list.size()])); // post insert list=merge(listener,cfcs,CommonUtil.POST_INSERT); listeners.setPostInsertEventListeners(list.toArray(new PostInsertEventListener[list.size()])); // post update list=merge(listener,cfcs,CommonUtil.POST_UPDATE); listeners.setPostUpdateEventListeners(list.toArray(new PostUpdateEventListener[list.size()])); // post load list=merge(listener,cfcs,CommonUtil.POST_LOAD); listeners.setPostLoadEventListeners(list.toArray(new PostLoadEventListener[list.size()])); // pre delete list=merge(listener,cfcs,CommonUtil.PRE_DELETE); listeners.setPreDeleteEventListeners(list.toArray(new PreDeleteEventListener[list.size()])); // pre insert //list=merge(listener,cfcs,CommonUtil.PRE_INSERT); //listeners.setPreInsertEventListeners(list.toArray(new PreInsertEventListener[list.size()])); // pre load list=merge(listener,cfcs,CommonUtil.PRE_LOAD); listeners.setPreLoadEventListeners(list.toArray(new PreLoadEventListener[list.size()])); // pre update //list=merge(listener,cfcs,CommonUtil.PRE_UPDATE); //listeners.setPreUpdateEventListeners(list.toArray(new PreUpdateEventListener[list.size()])); }