private void updateGroupSources(List<String> batchList,List<Group> currentGroups) throws SQLException, AdeException {
  PreparedStatement sourceListStatement=prepareStatement("SELECT SOURCES.SOURCE_INTERNAL_ID, SOURCES.SOURCE_ID FROM " + SOURCES_TABLE + " INNER JOIN "+ MANAGED_SYSTEMS_TABLE+ " ON SOURCES.SOURCE_INTERNAL_ID=MANAGED_SYSTEMS.SOURCE_INTERNAL_ID WHERE "+ "UPPER("+ MANAGED_SYSTEMS_TABLE+ ".OPERATING_SYSTEM)='LINUX' ",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
  ResultSet sourcesResult=sourceListStatement.executeQuery();
  updateGroupSources(currentGroups,sourcesResult,batchList);
  sourcesResult.close();
  sourceListStatement.close();
}

private void updateGroupSources ( List < String > batchList , List < Group > currentGroups ) throws SQLException , AdeException { PreparedStatement sourceListStatement = prepareStatement ( "SELECT SOURCES.SOURCE_INTERNAL_ID, SOURCES.SOURCE_ID FROM " + SOURCES_TABLE + " INNER JOIN " + MANAGED_SYSTEMS_TABLE + " ON SOURCES.SOURCE_INTERNAL_ID=MANAGED_SYSTEMS.SOURCE_INTERNAL_ID WHERE " + "UPPER(" + MANAGED_SYSTEMS_TABLE + ".OPERATING_SYSTEM)='LINUX' " , ResultSet . TYPE_SCROLL_INSENSITIVE , ResultSet . CONCUR_READ_ONLY ) ; ResultSet sourcesResult = sourceListStatement . executeQuery ( ) ; updateGroupSources ( currentGroups , sourcesResult , batchList ) ; sourcesResult . close ( ) ; sourceListStatement . close ( ) ; }
helper method for preparing the sql statement to get the list of sources for updating . the sources group references will be updated according to the new set of groups .
