/** * Getter for property 'source'. This is the session from which the event * originated. * <p/> * Some of the pre-* events had previous exposed the event source using * getSource() because they had not originally extended from * {@link AbstractEvent}. * * @return Value for property 'source'. * * @deprecated Use {@link #getSession} instead */ @Deprecated public EventSource getSource() { return getSession(); }
private void synchronizePersisterState(AbstractPreDatabaseOperationEvent event, Object[] state) { EntityPersister persister = event.getPersister(); synchronizePersisterState(event, state, persister, persister.getPropertyNames()); }
private void synchronizePersisterState(AbstractPreDatabaseOperationEvent event, Object[] state, EntityPersister persister, String[] propertyNames) { Object entity = event.getEntity(); EntityReflector reflector = persistentEntity.getReflector(); HashMap<Integer, Object> changedState= new HashMap<>(); EntityMetamodel entityMetamodel = persister.getEntityMetamodel(); for (int i = 0; i < propertyNames.length; i++) { String p = propertyNames[i]; Integer index = entityMetamodel.getPropertyIndexOrNull(p); if(index == null) continue; PersistentProperty property = persistentEntity.getPropertyByName(p); if (property == null) { continue; } String propertyName = property.getName(); if(GormProperties.VERSION.equals(propertyName)) { continue; } Object value = reflector.getProperty(entity, propertyName); if(state[index] != value) { changedState.put(i, value); } state[index] = value; } synchronizeEntityUpdateActionState(event, entity, changedState); }
protected void performSecurityCheck( SessionImplementor session, PermissionCheckEntityInformation entityInformation, PermissibleAction action) { if ( jaccService == null ) { jaccService = session.getFactory().getServiceRegistry().getService( JaccService.class ); } jaccService.checkPermission( entityInformation, action ); } }
/** * Getter for property 'source'. This is the session from which the event * originated. * <p/> * Some of the pre-* events had previous exposed the event source using * getSource() because they had not originally extended from * {@link AbstractEvent}. * * @return Value for property 'source'. * @deprecated Use {@link #getSession} instead */ public EventSource getSource() { return getSession(); } }
/** * Getter for property 'source'. This is the session from which the event * originated. * <p/> * Some of the pre-* events had previous exposed the event source using * getSource() because they had not originally extended from * {@link AbstractEvent}. * * @return Value for property 'source'. * @deprecated Use {@link #getSession} instead */ public EventSource getSource() { return getSession(); } }
/** * Getter for property 'source'. This is the session from which the event * originated. * <p/> * Some of the pre-* events had previous exposed the event source using * getContainer() because they had not originally extended from * {@link AbstractEvent}. * * @return Value for property 'source'. * * @deprecated Use {@link #getSession} instead */ @Deprecated public EventSource getSource() { return getSession(); }
private void synchronizeEntityUpdateActionState(AbstractPreDatabaseOperationEvent event, Object entity, HashMap<Integer, Object> changedState) { if(actionQueueUpdatesField != null && event instanceof PreInsertEvent && changedState.size() > 0) { try { ExecutableList<EntityUpdateAction> updates = (ExecutableList<EntityUpdateAction>)actionQueueUpdatesField.get(event.getSession().getActionQueue()); if(updates != null) { for (EntityUpdateAction updateAction : updates) { if(updateAction.getInstance() == entity) { Object[] updateState = (Object[])entityUpdateActionStateField.get(updateAction); if (updateState != null) { for(Map.Entry<Integer, Object> entry : changedState.entrySet()) { updateState[entry.getKey()] = entry.getValue(); } } } } } } catch (Exception e) { LOG.warn("Error synchronizing object state with Hibernate: " + e.getMessage(), e); } } }
protected void performSecurityCheck( SessionImplementor session, PermissionCheckEntityInformation entityInformation, PermissibleAction action) { if ( jaccService == null ) { jaccService = session.getFactory().getServiceRegistry().getService( JaccService.class ); } jaccService.checkPermission( entityInformation, action ); } }