public ServiceResponse < DMNResult > evaluateDecisions ( String containerId , DMNContextKS payload ) { ServiceResponse < DMNResult > result = null ; if ( config . isRest ( ) ) { Map < String , Object > valuesMap = new HashMap < String , Object > ( ) ; valuesMap . put ( CONTAINER_ID , containerId ) ; result = ( ServiceResponse < DMNResult > ) ( ServiceResponse < ? > ) makeHttpPostRequestAndCreateServiceResponse ( build ( loadBalancer . getUrl ( ) , DMN_URI , valuesMap ) , payload , DMNResultKS . class ) ; } else { CommandScript script = new CommandScript ( Collections . singletonList ( ( KieServerCommand ) new DescriptorCommand ( "DMNService" , "evaluateDecisions" , serialize ( payload ) , marshaller . getFormat ( ) . getType ( ) , new Object [ ] { containerId } ) ) ) ; result = ( ServiceResponse < DMNResult > ) executeJmsCommand ( script , DescriptorCommand . class . getName ( ) , KieServerConstants . CAPABILITY_DMN , containerId ) . getResponses ( ) . get ( 0 ) ; throwExceptionOnFailure ( result ) ; if ( shouldReturnWithNullResponse ( result ) ) { return null ; } } if ( result instanceof Wrapped ) { return ( ServiceResponse < DMNResult > ) ( ( Wrapped ) result ) . unwrap ( ) ; } ServiceResponse < DMNResult > result2 = ( ServiceResponse < DMNResult > ) result ; // coerce numbers to BigDecimal as per DMN spec. // alternative to the below will require instructing special config of kie-server JSONMarshaller // to manage scalar values when deserializing from JSON always as a BigDecimal instead of default Jackson NumberDeserializers if ( config . getMarshallingFormat ( ) == MarshallingFormat . JSON ) { recurseAndModifyByCoercingNumbers ( result2 . getResult ( ) . getContext ( ) ) ; for ( DMNDecisionResult dr : result2 . getResult ( ) . getDecisionResults ( ) ) { recurseAndModifyByCoercingNumbers ( dr . getResult ( ) ) ; } } return result2 ; }
DO NOT ADD