@Override public SolverInstance getSolverWithBestSolution(String containerId, String solverId) { checkMandatoryParameter("ContainerID", containerId); checkMandatoryParameter("SolverId", solverId); if (config.isRest()) { String uri = getURI(containerId, solverId) + "/" + RestURI.SOLVER_BEST_SOLUTION; return makeHttpGetRequestAndCreateCustomResponse(uri, SolverInstance.class); } else { CommandScript script = new CommandScript(Collections.singletonList(new GetSolverWithBestSolutionCommand(containerId, solverId))); ServiceResponse<SolverInstance> response = (ServiceResponse<SolverInstance>) executeJmsCommand(script, GetSolverWithBestSolutionCommand.class.getName(), KieServerConstants.CAPABILITY_BRP, containerId).getResponses().get(0); throwExceptionOnFailure(response); if (shouldReturnWithNullResponse(response)) { return null; } return response.getResult(); } }