[rules-users] Why the drools modified object does not reflect the changes when I call the remote web service?

Nuwan Bandara mail.nuwan at gmail.com
Mon Jul 29 16:33:30 EDT 2013


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:


   - JBoss 5
   - Uses XLS decision table for the drools rules file
   - Front end uses jbosseap5 and back-end users JBoss 5


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;

    }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130729/62d7ddf7/attachment.html 


More information about the rules-users mailing list