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() + " does not exist") ;
}
rr.setRouteRecordId(rr1.getRouteRecordId()) ;