private void checkRequestedVars ( CoverageCollection gcd , NcssGridParamsBean params ) throws VariableNotContainedInDatasetException { // if var == all --> all variables requested if ( params . getVar ( ) . get ( 0 ) . equalsIgnoreCase ( "all" ) ) { params . setVar ( getAllGridNames ( gcd ) ) ; return ; } // Check vars are contained in the grid for ( String gridName : params . getVar ( ) ) { Coverage grid = gcd . findCoverage ( gridName ) ; if ( grid == null ) throw new VariableNotContainedInDatasetException ( "Variable: " + gridName + " is not contained in the requested dataset" ) ; } }
Checks that all the requested vars exist . If all fills out the param . vars with all grid names Throws exception if some of the variables in the request are not contained in the dataset