Map<String, EjbDeployment> ejbDeployments = ejbModule.getOpenejbJar().getDeploymentsByEjbName();
for (EnterpriseBean enterpriseBean : ejbModule.getEjbJar().getEnterpriseBeans()) {
// Get the OpenEJB deployment from openejb-jar.xml
EjbDeployment ejbDeployment = ejbDeployments.get(enterpriseBean.getEjbName());
enterpriseBean.setId(ejbDeployment.getDeploymentId());
// Copy all links over to mappedName
for (ResourceRef ref : enterpriseBean.getResourceRef()) {
ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
if (resourceLink != null && resourceLink.getResId() != null /* don't overwrite with null */) {
ref.setMappedName(resourceLink.getResId());
}
}
for (ResourceEnvRef ref : enterpriseBean.getResourceEnvRef()) {
ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
if (resourceLink != null && resourceLink.getResId() != null /* don't overwrite with null */) {
ref.setMappedName(resourceLink.getResId());
}
}
for (MessageDestinationRef ref : enterpriseBean.getMessageDestinationRef()) {
ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
if (resourceLink != null && resourceLink.getResId() != null /* don't overwrite with null */) {
ref.setMappedName(resourceLink.getResId());
}
}
for (EjbRef ref : enterpriseBean.getEjbRef()) {
EjbLink ejbLink = ejbDeployment.getEjbLink(ref.getName());
if (ejbLink != null && ejbLink.getDeployentId() != null /* don't overwrite with null */) {
ref.setMappedName(ejbLink.getDeployentId());
}
}
for (EjbLocalRef ref : enterpriseBean.getEjbLocalRef()) {
EjbLink ejbLink = ejbDeployment.getEjbLink(ref.getName());
if (ejbLink != null && ejbLink.getDeployentId() != null /* don't overwrite with null */) {
ref.setMappedName(ejbLink.getDeployentId());
}
}
}