List of usage examples for org.hibernate.event.spi PreDeleteEvent getEntity
@Override
public Object getEntity()
From source file:com.invariantproperties.sandbox.springentitylistener.listener.HibernateEntityListenersAdapter.java
License:Apache License
/** * @see org.hibernate.event.spi.PreDeleteEventListener#onPreDelete(org.hibernate * .event.spi.PreDeleteEvent)//from w w w . j a va 2 s .c o m */ @Override public boolean onPreDelete(PreDeleteEvent event) { execute(preRemove, event.getEntity()); return false; }
From source file:com.mpe.common.validation.BeanValidationEventListener.java
License:Open Source License
public boolean onPreDelete(PreDeleteEvent event) { validate(event.getEntity(), event.getPersister().getEntityMode(), event.getPersister(), event.getSession().getFactory(), GroupsPerOperation.Operation.DELETE); return false; }
From source file:es.logongas.ix3.dao.impl.rules.EventListenerImplRuleEngine.java
License:Apache License
@Override public boolean onPreDelete(PreDeleteEvent pde) { autowired();//from w w w. j a v a 2 s. c o m EntityMode entityMode = pde.getPersister().getEntityMode(); RuleContext ruleContext = new RuleContextImplNoPrincipal(pde.getEntity(), pde.getEntity()); fireRules(ruleContext, pde.getPersister(), null, entityMode, RuleGroupPredefined.PreDelete.class, RuleGroupPredefined.PreInsertOrUpdateOrDelete.class, RuleGroupPredefined.PreUpdateOrDelete.class); return false; }
From source file:org.flowerplatform.web.security.sandbox.SecurityEntityListener.java
License:Open Source License
/** * @author Florin/*from w ww. j a v a2s .c o m*/ * @author Cristi * @return * */ @Override public boolean onPreDelete(PreDeleteEvent evt) { if (evt.getEntity() instanceof User) { final Entity entity = (Entity) evt.getEntity(); if (CommunicationPlugin.getInstance().getCommunicationChannelManager() != null) { // condition for junit tests final List<CommunicationChannel> clientsToDisconnect = new ArrayList<CommunicationChannel>(); CommunicationPlugin.getInstance().getCommunicationChannelManager() .iterateCommunicationChannels(new RunnableWithParam<Boolean, CommunicationChannel>() { @Override public Boolean run(CommunicationChannel param) { if (param.getPrincipal().getUserId() == entity.getId()) { clientsToDisconnect.add((CommunicationChannel) param); } return null; } }); // we do this here, after the loop, to avoid ConcurrentModifException for (CommunicationChannel channel : clientsToDisconnect) { channel.disconnect(); } } } return false; }
From source file:org.grails.orm.hibernate.event.listener.HibernateEventListener.java
License:Apache License
public boolean onPreDelete(PreDeleteEvent event) { boolean evict = false; ClosureEventListener eventListener = findEventListener(event.getEntity(), event.getPersister().getFactory()); if (eventListener != null) { evict = eventListener.onPreDelete(event); }/* w w w . j av a2 s .co m*/ return evict; }
From source file:org.grails.orm.hibernate.EventTriggeringInterceptor.java
License:Apache License
public boolean onPreDelete(PreDeleteEvent event) { boolean evict = false; ClosureEventListener eventListener = findEventListener(event.getEntity()); if (eventListener != null) { evict = eventListener.onPreDelete(event); }/*from w w w . j av a 2s . c o m*/ return evict; }
From source file:org.grails.orm.hibernate.support.ClosureEventListener.java
License:Apache License
public boolean onPreDelete(final PreDeleteEvent event) { if (preDeleteEventListener == null) { return false; }/*from w ww . j a v a 2 s .c o m*/ return doWithManualSession(event, new Closure<Boolean>(this) { @Override public Boolean call() { return preDeleteEventListener.call(event.getEntity()); } }); }
From source file:org.grails.orm.hibernate.support.ClosureEventTriggeringInterceptor.java
License:Apache License
public boolean onPreDelete(PreDeleteEvent hibernateEvent) { AbstractPersistenceEvent event = new org.grails.datastore.mapping.engine.event.PreDeleteEvent( findDatastore(hibernateEvent), hibernateEvent.getEntity()); publishEvent(hibernateEvent, event); return event.isCancelled(); }