logger.log(Level.SEVERE, "addOrUpdateRouteGroup - exception occurred", e) ;
throw new RuntimeException("Could not persist Route Group to DB, some error occurred - " + e.getMessage()) ;
}
// Get RouteGroupID for the newly added/updated group
ObjectKey key = new ObjectKey() ;
key.setObjectName(rg.getRouteGroupName()) ;
key.setRegistrantName(rg.getOrganizationName()) ;
RouteGroup rg1 = getRouteGroup(key) ;
rg.setRouteGroupId(rg1.getRouteGroupId()) ;
if (rg.getRouteRecordList() !=null)
{
// Loop thru and insert/update row in RouteGroup_RouteRecord table
RouteRecordDAO dao = (RouteRecordDAO)SpringAppContext.getBean("RouteRecordDAO") ;
for(RouteRecord rr : rg.getRouteRecordList())
{
//TODO handle error conditions
ObjectKey key1 = new ObjectKey() ;
key1.setObjectName(rr.getRouteRecordName()) ;
key1.setRegistrantName(rr.getOrganizationName()) ;
RouteRecord rr1 = dao.getRouteRecord(key1) ;
if(rr1 == null)
{
throw new RuntimeException("RouteRecord "+rr.getRouteRecordName() + " with registrant " + key1.getRegistrantName() + " does not exist") ;
}
rr.setRouteRecordId(rr1.getRouteRecordId()) ;
addRteGrpRteRec(rg,rr) ;
}