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
|
@ -418,11 +418,10 @@ public class StateManagerImpl
|
|||
*/
|
||||
private boolean fireLifecycleEvent(int type) {
|
||||
if (type == LifecycleEvent.AFTER_PERSIST
|
||||
&& _broker.getConfiguration().getCallbackOptionsInstance()
|
||||
.getPostPersistCallbackImmediate())
|
||||
&& _broker.getConfiguration().getCallbackOptionsInstance().getPostPersistCallbackImmediate()) {
|
||||
fetchObjectId();
|
||||
return _broker.fireLifecycleEvent(getManagedInstance(), null,
|
||||
_meta, type);
|
||||
}
|
||||
return _broker.fireLifecycleEvent(getManagedInstance(), null, _meta, type);
|
||||
}
|
||||
|
||||
public void load(FetchConfiguration fetch) {
|
||||
|
|
|
@ -412,17 +412,20 @@ public class EntityManagerFactoryImpl
|
|||
}
|
||||
|
||||
public boolean isLoaded(Object entity, String attribute) {
|
||||
if (entity == null)
|
||||
if (entity == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entity instanceof PersistenceCapable) {
|
||||
PersistenceCapable pc = (PersistenceCapable)entity;
|
||||
if (!isManagedBy(pc))
|
||||
if (!isManagedBy(pc)) {
|
||||
return false;
|
||||
}
|
||||
StateManager sm = pc.pcGetStateManager();
|
||||
if (sm != null && sm instanceof OpenJPAStateManager)
|
||||
if (sm != null && sm instanceof OpenJPAStateManager) {
|
||||
return isLoaded((OpenJPAStateManager)sm, attribute);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -434,24 +437,28 @@ public class EntityManagerFactoryImpl
|
|||
* this persistence unit.
|
||||
*/
|
||||
private boolean isManagedBy(PersistenceCapable entity) {
|
||||
if (!isOpen())
|
||||
if (!isOpen()) {
|
||||
return false;
|
||||
}
|
||||
Object abfobj = JPAFacadeHelper.toBrokerFactory(this);
|
||||
if (abfobj == null)
|
||||
if (abfobj == null) {
|
||||
return false;
|
||||
}
|
||||
if (abfobj instanceof AbstractBrokerFactory) {
|
||||
AbstractBrokerFactory abf = (AbstractBrokerFactory)abfobj;
|
||||
Collection<?> brokers = abf.getOpenBrokers();
|
||||
if (brokers == null || brokers.size() == 0)
|
||||
if (brokers == null || brokers.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
// Cycle through all brokers managed by this factory.
|
||||
Broker[] brokerArr = brokers.toArray(new Broker[brokers.size()]);
|
||||
for (Broker broker : brokerArr) {
|
||||
if (broker != null && !broker.isClosed() &&
|
||||
broker.isPersistent(entity))
|
||||
broker.isPersistent(entity)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -467,12 +474,14 @@ public class EntityManagerFactoryImpl
|
|||
if (attr != null) {
|
||||
FieldMetaData fmd = sm.getMetaData().getField(attr);
|
||||
// Could not find field metadata for the specified attribute.
|
||||
if (fmd == null)
|
||||
if (fmd == null) {
|
||||
return false;
|
||||
}
|
||||
// If the attribute is not loaded, return false.
|
||||
if (!loadSet.get(fmd.getIndex()))
|
||||
if (!loadSet.get(fmd.getIndex())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Check load state of all persistent eager fetch attributes. Per
|
||||
// contract, if any of them are not loaded, return false.
|
||||
FieldMetaData[] fmds = sm.getMetaData().getFields();
|
||||
|
|
Loading…
Reference in New Issue