public Object get(String identifier) { Object object = environment.get(identifier); if ( object == null && delegate != null ) { object = this.delegate.get( identifier ); } return object; }
/** * This method creates a entity manager. */ private EntityManager getEntityManager() { EntityManager em = (EntityManager) env.get(EnvironmentName.CMD_SCOPED_ENTITY_MANAGER); if (em != null) { sharedEM = true; return em; } EntityManagerFactory emf = (EntityManagerFactory) env.get(EnvironmentName.ENTITY_MANAGER_FACTORY); if (emf != null) { return emf.createEntityManager(); } throw new RuntimeException("Could not find EntityManager, both command-scoped EM and EMF in environment are null"); }
public DroolsSpringJpaManager(Environment env) { this.env = env; this.emf = (EntityManagerFactory) env.get( EnvironmentName.ENTITY_MANAGER_FACTORY ); isJTA = true; Boolean bool = (Boolean) env.get("IS_JTA_TRANSACTION"); if (bool != null) { isJTA = bool.booleanValue(); } getApplicationScopedPersistenceContext(); // we create this on initialisation so that we own the EMF reference // otherwise Spring will close it after the transaction finishes }
public DroolsSpringJpaManager(Environment env) { this.env = env; this.emf = (EntityManagerFactory) env.get( EnvironmentName.ENTITY_MANAGER_FACTORY ); isJTA = true; Boolean bool = (Boolean) env.get("IS_JTA_TRANSACTION"); if (bool != null) { isJTA = bool.booleanValue(); } getApplicationScopedPersistenceContext(); // we create this on initialisation so that we own the EMF reference // otherwise Spring will close it after the transaction finishes }
public DroolsSpringJpaManager(Environment env) { this.env = env; this.emf = (EntityManagerFactory) env.get( EnvironmentName.ENTITY_MANAGER_FACTORY ); isJTA = true; Boolean bool = (Boolean) env.get("IS_JTA_TRANSACTION"); if (bool != null) { isJTA = bool.booleanValue(); } getApplicationScopedPersistenceContext(); // we create this on initialisation so that we own the EMF reference // otherwise Spring will close it after the transaction finishes }
public ObjectMarshallingStrategyStore getObjectMarshallingStrategyStore() { if ( this.marshallingStore == null ) { this.marshallingStore = new ObjectMarshallingStrategyStoreImpl( (ObjectMarshallingStrategy[]) this.environment.get( EnvironmentName.OBJECT_MARSHALLING_STRATEGIES ) ); } return this.marshallingStore; }
public void clearPersistenceContext() { if ( TransactionSynchronizationManager.hasResource( "cmdEM" ) ) { EntityManager cmdScopedEntityManager = (EntityManager) this.env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ); if ( cmdScopedEntityManager != null ) { cmdScopedEntityManager.clear(); } } }
public void clearPersistenceContext() { if ( TransactionSynchronizationManager.hasResource( "cmdEM" ) ) { EntityManager cmdScopedEntityManager = (EntityManager) this.env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ); if ( cmdScopedEntityManager != null ) { cmdScopedEntityManager.clear(); } } }
public void clearPersistenceContext() { if ( TransactionSynchronizationManager.hasResource( "cmdEM" ) ) { EntityManager cmdScopedEntityManager = (EntityManager) this.env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ); if ( cmdScopedEntityManager != null ) { cmdScopedEntityManager.clear(); } } }
public PersistenceContext getCommandScopedPersistenceContext() { return new JpaPersistenceContext( (EntityManager) this.env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ), isJTA ); }
public PersistenceContext getCommandScopedPersistenceContext() { return new JpaPersistenceContext( (EntityManager) this.env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ), isJTA ); }
public PersistenceContext getCommandScopedPersistenceContext() { return new JpaPersistenceContext( (EntityManager) this.env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ), isJTA ); }
public ProcessPersistenceContext getProcessPersistenceContext() { return new JpaProcessPersistenceContext( (EntityManager) this.env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ) ); }
public JPAWorkingMemoryDbLogger(KnowledgeRuntimeEventManager session) { super(session); if (session instanceof KnowledgeRuntime) { env = ((KnowledgeRuntime) session).getEnvironment(); } else if (session instanceof StatelessKnowledgeSessionImpl) { env = ((StatelessKnowledgeSessionImpl) session).getEnvironment(); } else { throw new IllegalArgumentException( "Not supported session in logger: " + session.getClass()); } Boolean bool = (Boolean) env.get("IS_JTA_TRANSACTION"); if (bool != null) { isJTA = bool.booleanValue(); } }
public void endCommandScopedEntityManager() { if ( TransactionSynchronizationManager.hasResource( "cmdEM" ) ) { TransactionSynchronizationManager.unbindResource( "cmdEM" ); if ( this.env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ) != null ) { getCommandScopedPersistenceContext().close(); } } }
public void endCommandScopedEntityManager() { if ( TransactionSynchronizationManager.hasResource( "cmdEM" ) ) { TransactionSynchronizationManager.unbindResource( "cmdEM" ); if ( this.env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ) != null ) { getCommandScopedPersistenceContext().close(); } } }
public void endCommandScopedEntityManager() { if ( TransactionSynchronizationManager.hasResource( "cmdEM" ) ) { TransactionSynchronizationManager.unbindResource( "cmdEM" ); if ( this.env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ) != null ) { getCommandScopedPersistenceContext().close(); } } }
public void beginCommandScopedEntityManager() { EntityManager cmdScopedEntityManager = (EntityManager) env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ); if ( cmdScopedEntityManager == null || !cmdScopedEntityManager.isOpen() ) { EntityManagerHolder emHolder = (EntityManagerHolder) TransactionSynchronizationManager.getResource( "cmdEM" ); EntityManager em = null; if ( emHolder == null ) { em = this.emf.createEntityManager(); emHolder = new EntityManagerHolder( em ); TransactionSynchronizationManager.bindResource( "cmdEM", emHolder ); } else { em = emHolder.getEntityManager(); } this.env.set( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER, em ); } if (isJTA) { this.getCommandScopedPersistenceContext().joinTransaction(); this.appScopedEntityManager.joinTransaction(); } }
public void beginCommandScopedEntityManager() { EntityManager cmdScopedEntityManager = (EntityManager) env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ); if ( cmdScopedEntityManager == null || !cmdScopedEntityManager.isOpen() ) { EntityManagerHolder emHolder = (EntityManagerHolder) TransactionSynchronizationManager.getResource( "cmdEM" ); EntityManager em = null; if ( emHolder == null ) { em = this.emf.createEntityManager(); emHolder = new EntityManagerHolder( em ); TransactionSynchronizationManager.bindResource( "cmdEM", emHolder ); } else { em = emHolder.getEntityManager(); } this.env.set( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER, em ); } if (isJTA) { this.getCommandScopedPersistenceContext().joinTransaction(); this.appScopedEntityManager.joinTransaction(); } }
public void beginCommandScopedEntityManager() { EntityManager cmdScopedEntityManager = (EntityManager) env.get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER ); if ( cmdScopedEntityManager == null || !cmdScopedEntityManager.isOpen() ) { EntityManagerHolder emHolder = (EntityManagerHolder) TransactionSynchronizationManager.getResource( "cmdEM" ); EntityManager em = null; if ( emHolder == null ) { em = this.emf.createEntityManager(); emHolder = new EntityManagerHolder( em ); TransactionSynchronizationManager.bindResource( "cmdEM", emHolder ); } else { em = emHolder.getEntityManager(); } this.env.set( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER, em ); } if (isJTA) { this.getCommandScopedPersistenceContext().joinTransaction(); this.appScopedEntityManager.joinTransaction(); } }