use of org.broadleafcommerce.openadmin.server.service.persistence.PersistenceManager in project BroadleafCommerce by BroadleafCommerce.
the class AbstractRuleBuilderFieldService method onApplicationEvent.
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
// This bean only is valid when the following bean is active. (admin)
if (applicationContext.containsBean(PersistenceManagerFactory.getPersistenceManagerRef()) && applicationContext.containsBean("blPersistenceManagerFactory")) {
// initialize the factory bean
applicationContext.getBean("blPersistenceManagerFactory");
PersistenceManager persistenceManager = PersistenceManagerFactory.getDefaultPersistenceManager();
dynamicEntityDao = persistenceManager.getDynamicEntityDao();
setFields(new ArrayList<FieldData>());
// This cannot be null during startup as we do not want to remove the null safety checks in a multi-tenant env.
boolean contextWasNull = false;
if (BroadleafRequestContext.getBroadleafRequestContext() == null) {
BroadleafRequestContext brc = new BroadleafRequestContext();
brc.setIgnoreSite(true);
BroadleafRequestContext.setBroadleafRequestContext(brc);
contextWasNull = true;
}
try {
init();
// Initialize additional static fields method for the component.
if (extensionManager != null) {
extensionManager.getProxy().addFields(fields, getName(), getDtoClassName());
}
validateRuleBuilderState(this);
} finally {
if (contextWasNull) {
BroadleafRequestContext.setBroadleafRequestContext(null);
}
}
}
}
Aggregations