String valueCdXml = (String) aDomainSB.getAttribute("valueCd");
logger.debug("Retrieved valueCd of XML Domain: "+valueCdXml);
Iterator it = dbDomains.iterator();
while (it.hasNext()) {
SbiDomains d = (SbiDomains)it.next();
String valueCd = d.getValueCd();
logger.debug("Retrieved valueCd of DB Domain: "+valueCd);
if(valueCdXml.equalsIgnoreCase(valueCd)){
existsInDb = true;
logger.debug("Domain already exists in the DB");
break;
}
}
if(!existsInDb){
logger.debug("Domain doesn't exist in the DB");
SbiDomains aDomain = new SbiDomains();
aDomain.setDomainCd((String) aDomainSB.getAttribute("domainCd"));
aDomain.setDomainNm((String) aDomainSB.getAttribute("domainNm"));
aDomain.setValueCd((String) aDomainSB.getAttribute("valueCd"));
aDomain.setValueNm((String) aDomainSB.getAttribute("valueNm"));
aDomain.setValueDs((String) aDomainSB.getAttribute("valueDs"));
logger.debug("New Domain ready to be iserted in the DB");
logger.debug("Inserting Domain with valueCd = [" + aDomainSB.getAttribute("valueCd") + "], domainCd = [" + aDomainSB.getAttribute("domainCd") + "] ...");
aSession.save(aDomain);
logger.debug("New Domain iserted in the DB");
}