/** * Determines whether the specified state manager is managed by an open * broker within the persistence unit of the provided EMF instance. * @param emf OpenJPAEntityManagerFactory * @param sm StateManager * @return true if this state manager is managed by a broker within * this persistence unit. */ public static boolean isManagedBy(OpenJPAEntityManagerFactory emf, Object entity) { // Assert a valid emf was provided, it is open, and the entity is PC if (emf == null || !emf.isOpen() || !ImplHelper.isManageable(entity)) { return false; } // Assert the context is a broker PersistenceCapable pc = (PersistenceCapable)entity; if (!(pc.pcGetGenericContext() instanceof Broker)) { return false; } // Assert the broker is available and open Broker broker = (Broker)pc.pcGetGenericContext(); if (broker == null || broker.isClosed()) { return false; } // Assert the emf associated with the PC is the same as the provided emf OpenJPAEntityManagerFactory eemf = JPAFacadeHelper.toEntityManagerFactory(broker.getBrokerFactory()); if (eemf == emf && eemf.isOpen()) { return true; } return false; }
/** * Determines whether the specified state manager is managed by an open * broker within the persistence unit of the provided EMF instance. * @param emf OpenJPAEntityManagerFactory * @param sm StateManager * @return true if this state manager is managed by a broker within * this persistence unit. */ public static boolean isManagedBy(OpenJPAEntityManagerFactory emf, Object entity) { // Assert a valid emf was provided, it is open, and the entity is PC if (emf == null || !emf.isOpen() || !ImplHelper.isManageable(entity)) { return false; } // Assert the context is a broker PersistenceCapable pc = (PersistenceCapable)entity; if (!(pc.pcGetGenericContext() instanceof Broker)) { return false; } // Assert the broker is available and open Broker broker = (Broker)pc.pcGetGenericContext(); if (broker == null || broker.isClosed()) { return false; } // Assert the emf associated with the PC is the same as the provided emf OpenJPAEntityManagerFactory eemf = JPAFacadeHelper.toEntityManagerFactory(broker.getBrokerFactory()); if (eemf == emf && eemf.isOpen()) { return true; } return false; }
/** * Determines whether the specified state manager is managed by an open * broker within the persistence unit of the provided EMF instance. * @param emf OpenJPAEntityManagerFactory * @param sm StateManager * @return true if this state manager is managed by a broker within * this persistence unit. */ public static boolean isManagedBy(OpenJPAEntityManagerFactory emf, Object entity) { // Assert a valid emf was provided, it is open, and the entity is PC if (emf == null || !emf.isOpen() || !ImplHelper.isManageable(entity)) { return false; } // Assert the context is a broker PersistenceCapable pc = (PersistenceCapable)entity; if (!(pc.pcGetGenericContext() instanceof Broker)) { return false; } // Assert the broker is available and open Broker broker = (Broker)pc.pcGetGenericContext(); if (broker == null || broker.isClosed()) { return false; } // Assert the emf associated with the PC is the same as the provided emf OpenJPAEntityManagerFactory eemf = JPAFacadeHelper.toEntityManagerFactory(broker.getBrokerFactory()); if (eemf == emf && eemf.isOpen()) { return true; } return false; }
/** * Determines whether the specified state manager is managed by an open * broker within the persistence unit of the provided EMF instance. * @param emf OpenJPAEntityManagerFactory * @param sm StateManager * @return true if this state manager is managed by a broker within * this persistence unit. */ public static boolean isManagedBy(OpenJPAEntityManagerFactory emf, Object entity) { // Assert a valid emf was provided, it is open, and the entity is PC if (emf == null || !emf.isOpen() || !ImplHelper.isManageable(entity)) { return false; } // Assert the context is a broker PersistenceCapable pc = (PersistenceCapable)entity; if (!(pc.pcGetGenericContext() instanceof Broker)) { return false; } // Assert the broker is available and open Broker broker = (Broker)pc.pcGetGenericContext(); if (broker == null || broker.isClosed()) { return false; } // Assert the emf associated with the PC is the same as the provided emf OpenJPAEntityManagerFactory eemf = JPAFacadeHelper.toEntityManagerFactory(broker.getBrokerFactory()); if (eemf == emf && eemf.isOpen()) { return true; } return false; }