When I use the local drools rules instance, object gets updated and reflects the changes accordingly but when I use the remote web service call to use the remote drools engine, rules get executed correctly but updated values does not get reflected back in the return object.


Environment into:


Currently I have drools engine running on front end server (referred as local) and back-end server (referred as remote) both. When I call the local drools engine it works. But when I call the remote server through REST web server function get executed correctly but updated values are not in the object when it comes back to the front end.

Here’s the function that I use in the decision table (.xls)

function boolean setCTCFlag(Object resultViewMapObj, String siteCode){

        boolean flag = false;

        Map<String, ResultView> resultViewMap = (Map<String, ResultView>) resultViewMapObj;

        List<ResultView> resultViewList = new ArrayList<ResultView>();

        resultViewList = new ArrayList<ResultView> (resultViewMap.values());

        ResultView resultView = new ResultView();

        resultView = resultViewList.get(0);

        if(resultView.getSampleView().getSample() != null){

            String sampleInd = resultView.getSampleView().getSample().getSampleIndicator();

            if(sampleInd != null && sampleInd.length() != 0){

                String[] sampleIndComp = sampleInd.split(""[^\\w\\s]"");

                for(int i = 0; i<sampleIndComp.length; i++){

                        LabelValueView labelValueView = new LabelValueView();

                        labelValueView.setLabel(sampleIndComp[i].trim());

                        labelValueView.setValue(" ");

                        // DOTO: this is the issue

                        //       folowing line gets executed but changes do not get reflected in the object.

                        //       Only happens when this called remotely.  

                        resultView.getDynamicFields().put("CTC_CLIENT_FLAG", labelValueView);

                        flag = true;

                }

            }

        }

        return flag;

    }