mirror of https://github.com/apache/openjpa.git
Add braces for a few one line if statements.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@797626 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
81c7abc64e
commit
e7f9191695
|
@ -417,12 +417,11 @@ public class StateManagerImpl
|
||||||
* Fire the given lifecycle event to all listeners.
|
* Fire the given lifecycle event to all listeners.
|
||||||
*/
|
*/
|
||||||
private boolean fireLifecycleEvent(int type) {
|
private boolean fireLifecycleEvent(int type) {
|
||||||
if (type == LifecycleEvent.AFTER_PERSIST
|
if (type == LifecycleEvent.AFTER_PERSIST
|
||||||
&& _broker.getConfiguration().getCallbackOptionsInstance()
|
&& _broker.getConfiguration().getCallbackOptionsInstance().getPostPersistCallbackImmediate()) {
|
||||||
.getPostPersistCallbackImmediate())
|
|
||||||
fetchObjectId();
|
fetchObjectId();
|
||||||
return _broker.fireLifecycleEvent(getManagedInstance(), null,
|
}
|
||||||
_meta, type);
|
return _broker.fireLifecycleEvent(getManagedInstance(), null, _meta, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load(FetchConfiguration fetch) {
|
public void load(FetchConfiguration fetch) {
|
||||||
|
|
|
@ -412,16 +412,19 @@ public class EntityManagerFactoryImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLoaded(Object entity, String attribute) {
|
public boolean isLoaded(Object entity, String attribute) {
|
||||||
if (entity == null)
|
if (entity == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (entity instanceof PersistenceCapable) {
|
if (entity instanceof PersistenceCapable) {
|
||||||
PersistenceCapable pc = (PersistenceCapable)entity;
|
PersistenceCapable pc = (PersistenceCapable)entity;
|
||||||
if (!isManagedBy(pc))
|
if (!isManagedBy(pc)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
StateManager sm = pc.pcGetStateManager();
|
StateManager sm = pc.pcGetStateManager();
|
||||||
if (sm != null && sm instanceof OpenJPAStateManager)
|
if (sm != null && sm instanceof OpenJPAStateManager) {
|
||||||
return isLoaded((OpenJPAStateManager)sm, attribute);
|
return isLoaded((OpenJPAStateManager)sm, attribute);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -434,22 +437,26 @@ public class EntityManagerFactoryImpl
|
||||||
* this persistence unit.
|
* this persistence unit.
|
||||||
*/
|
*/
|
||||||
private boolean isManagedBy(PersistenceCapable entity) {
|
private boolean isManagedBy(PersistenceCapable entity) {
|
||||||
if (!isOpen())
|
if (!isOpen()) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
Object abfobj = JPAFacadeHelper.toBrokerFactory(this);
|
Object abfobj = JPAFacadeHelper.toBrokerFactory(this);
|
||||||
if (abfobj == null)
|
if (abfobj == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if (abfobj instanceof AbstractBrokerFactory) {
|
if (abfobj instanceof AbstractBrokerFactory) {
|
||||||
AbstractBrokerFactory abf = (AbstractBrokerFactory)abfobj;
|
AbstractBrokerFactory abf = (AbstractBrokerFactory)abfobj;
|
||||||
Collection<?> brokers = abf.getOpenBrokers();
|
Collection<?> brokers = abf.getOpenBrokers();
|
||||||
if (brokers == null || brokers.size() == 0)
|
if (brokers == null || brokers.size() == 0) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
// Cycle through all brokers managed by this factory.
|
// Cycle through all brokers managed by this factory.
|
||||||
Broker[] brokerArr = brokers.toArray(new Broker[brokers.size()]);
|
Broker[] brokerArr = brokers.toArray(new Broker[brokers.size()]);
|
||||||
for (Broker broker : brokerArr) {
|
for (Broker broker : brokerArr) {
|
||||||
if (broker != null && !broker.isClosed() &&
|
if (broker != null && !broker.isClosed() &&
|
||||||
broker.isPersistent(entity))
|
broker.isPersistent(entity)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -467,11 +474,13 @@ public class EntityManagerFactoryImpl
|
||||||
if (attr != null) {
|
if (attr != null) {
|
||||||
FieldMetaData fmd = sm.getMetaData().getField(attr);
|
FieldMetaData fmd = sm.getMetaData().getField(attr);
|
||||||
// Could not find field metadata for the specified attribute.
|
// Could not find field metadata for the specified attribute.
|
||||||
if (fmd == null)
|
if (fmd == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
// If the attribute is not loaded, return false.
|
// If the attribute is not loaded, return false.
|
||||||
if (!loadSet.get(fmd.getIndex()))
|
if (!loadSet.get(fmd.getIndex())) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Check load state of all persistent eager fetch attributes. Per
|
// Check load state of all persistent eager fetch attributes. Per
|
||||||
// contract, if any of them are not loaded, return false.
|
// contract, if any of them are not loaded, return false.
|
||||||
|
|
Loading…
Reference in New Issue