@ Override @ Path ( "/{assetPath}" ) @ ApiOperation ( value = "Apply rules identified by assetPath." , notes = "Query may contain runtime values" ) @ ApiImplicitParams ( { @ ApiImplicitParam ( name = "FactsObject" , paramType = "body" , required = true , value = "Input to apply rules against" ) , @ ApiImplicitParam ( name = "assetPath" , paramType = "path" , required = true , value = "Identifies a .drl or .xlsx asset" ) , @ ApiImplicitParam ( name = "rules-executor" , paramType = "header" , required = false , value = "Default is Drools" ) } ) public JSONObject post ( String path , JSONObject content , Map < String , String > headers ) throws ServiceException , JSONException { Asset rules = getRulesAsset ( path ) ; Operand input = new Operand ( content ) ; input . setContext ( getContext ( path ) ) ; Query query = getQuery ( path , headers ) ; input . setParams ( query . getFilters ( ) ) ; input . setMeta ( headers ) ; JSONObject response = invokeRules ( rules , input , getExecutor ( headers ) ) ; Status status = input . getStatus ( ) ; if ( status != null ) { headers . put ( Listener . METAINFO_HTTP_STATUS_CODE , String . valueOf ( status . getCode ( ) ) ) ; if ( response == null ) return status . getJson ( ) ; } return response ; }
Apply rules designated in asset path against incoming JSONObject .