private boolean checkRecordContainsSolrFields ( Map < String , Field > recordFieldMap , Record record , List < String > solrFieldsMap , Errors errorToThrow ) throws StageException { // for (Map.Entry<String, Field> recordFieldMapEntry : recordFieldMap.entrySet()) List < String > fieldsFound = new ArrayList <> ( ) ; recordFieldMap . keySet ( ) . forEach ( recordFieldKey -> { if ( solrFieldsMap . contains ( recordFieldKey ) ) { fieldsFound . add ( recordFieldKey ) ; } } ) ; // if record does not contain solr fields then process error accordingly if ( solrFieldsMap . size ( ) != fieldsFound . size ( ) ) { Set < String > missingFields = new HashSet <> ( ) ; solrFieldsMap . forEach ( requiredField -> { if ( ! fieldsFound . contains ( requiredField ) ) { missingFields . add ( requiredField ) ; } } ) ; handleError ( record , errorToThrow , Joiner . on ( "," ) . join ( missingFields ) ) ; return false ; } return true ; }
Checks whether the record contains solr fields in solrFieldsMap or not .