private void validateRequiredParams ( ) { String [ ] uriStrings = getURI ( ) . split ( "\\?" ) ; if ( uriStrings . length > 0 ) { List < String > requiredParms = extractRequiredParamsInURI ( uriStrings [ 0 ] ) ; for ( String param : requiredParms ) { Utils . require ( commandParams . containsKey ( param ) , "missing param: " + param ) ; } } if ( metadataJson . containsKey ( INPUT_ENTITY ) ) { String paramValue = metadataJson . getString ( INPUT_ENTITY ) ; if ( paramValue != null ) { JsonObject parametersNode = metadataJson . getJsonObject ( PARAMETERS ) ; if ( parametersNode != null ) { if ( parametersNode . keySet ( ) . size ( ) == 1 ) { //parent node usually "params" JsonObject params = parametersNode . getJsonObject ( parametersNode . keySet ( ) . iterator ( ) . next ( ) ) ; for ( String param : params . keySet ( ) ) { JsonObject paramNode = params . getJsonObject ( param ) ; if ( paramNode . keySet ( ) . contains ( _REQUIRED ) ) { setCompound ( true ) ; Utils . require ( commandParams . containsKey ( param ) , "missing param: " + param ) ; } } } } else { Utils . require ( commandParams . containsKey ( paramValue ) , "missing param: " + paramValue ) ; } } } }
Validate Required Params