if (openejbJar == null) return;
if (sunEjbJar == null) return;
if (sunEjbJar.getEnterpriseBeans() == null) return;
for (Ejb ejb : sunEjbJar.getEnterpriseBeans().getEjb()) {
Cmp cmp = ejb.getCmp();
if (cmp == null) {
// skip non cmp beans
continue;
}
// skip all non-CMP beans
EnterpriseBean enterpriseBean = ejbJar.getEnterpriseBean(ejb.getEjbName());
if (!(enterpriseBean instanceof org.apache.openejb.jee.EntityBean) ||
((EntityBean) enterpriseBean).getPersistenceType() != PersistenceType.CONTAINER) {
continue;
}
EntityBean bean = (EntityBean) enterpriseBean;
EntityData entityData = entities.get(moduleId + "#" + ejb.getEjbName());
if (entityData == null) {
// todo warn no such ejb in the ejb-jar.xml
continue;
}
Collection<String> cmpFields = new ArrayList<String>(bean.getCmpField().size());
for (CmpField cmpField : bean.getCmpField()) {
cmpFields.add(cmpField.getFieldName());
}
OneOneFinders oneOneFinders = cmp.getOneOneFinders();
if (oneOneFinders != null) {
for (Finder finder : oneOneFinders.getFinder()) {
List<List<String>> params = parseQueryParamters(finder.getQueryParams());
String queryFilter = finder.getQueryFilter();
String ejbQl = convertToEjbQl(entityData.entity.getName(), cmpFields, finder.getQueryParams(), queryFilter);