protected String findWithinModule(PersistenceUnitDependencyResolver resolver, DeploymentUnit unit, String persistenceUnitName, boolean allowScoped)
{
if(!allowScoped && isScoped(unit))
return null;
PersistenceMetaData persistenceMetaData = unit.getAttachment(PersistenceMetaData.class);
if(persistenceMetaData == null)
return null;
for(PersistenceUnitMetaData persistenceUnit : persistenceMetaData.getPersistenceUnits())
{
if(persistenceUnitName == null || persistenceUnitName.length() == 0 || persistenceUnit.getName().equals(persistenceUnitName))
return resolver.createBeanName(unit, persistenceUnit.getName());
}
return null;