use of org.broadleafcommerce.common.extensibility.jpa.convert.BroadleafPersistenceUnitDeclaringClassTransformer in project BroadleafCommerce by BroadleafCommerce.
the class MergePersistenceUnitManager method addTransformersToPersistenceUnits.
/**
* Adds all of the configured {@link #classTransformers} to all of the persistence units
* @return whether or not there was a LoadTimeWeaver registered
* @throws Exception if there was an undetectable problem during transformer addition
*/
protected boolean addTransformersToPersistenceUnits() throws Exception {
boolean weaverRegistered = true;
for (PersistenceUnitInfo pui : mergedPus.values()) {
if (pui.getProperties().containsKey(AvailableSettings.USE_CLASS_ENHANCER) && "true".equalsIgnoreCase(pui.getProperties().getProperty(AvailableSettings.USE_CLASS_ENHANCER))) {
pui.addTransformer(new InterceptFieldClassFileTransformer(pui.getManagedClassNames()));
}
for (BroadleafClassTransformer transformer : classTransformers) {
try {
boolean isTransformerQualified = !(transformer instanceof NullClassTransformer) && (pui.getPersistenceUnitName().equals("blPU") && !(transformer instanceof BroadleafPersistenceUnitDeclaringClassTransformer)) || ((transformer instanceof BroadleafPersistenceUnitDeclaringClassTransformer) && pui.getPersistenceUnitName().equals(((BroadleafPersistenceUnitDeclaringClassTransformer) transformer).getPersistenceUnitName()));
if (isTransformerQualified) {
pui.addTransformer(transformer);
}
} catch (Exception e) {
weaverRegistered = handleClassTransformerRegistrationProblem(transformer, e);
}
}
}
weaverRegistered = addNamedQueriesToPersistenceUnits(weaverRegistered);
return weaverRegistered;
}
Aggregations