Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-3144

UnMatch Listener for Compensation Actions

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Critical
    • 5.4.0.Final
    • None
    • drools-core (expert)
    • None

    Description

      Here's what I'd like to be able to do:

      rule "serviceConflict"
          when
              $leftProcessAssignment : MrProcessAssignment($service : service, $machine : machine, $leftId : id)
              $rightProcessAssignment : MrProcessAssignment(service == $service, machine == $machine, id > $leftId)
          then
              scoreCalculator.addToHardScore(1); // No insertLogical or accumulate of those ConstraintOccurence's needed
          undo-then
              scoreCalculator.substractFromHardScore(1);
      end
      

      And here's a more complex example where the weight isn't a static "1":

      rule "serviceLocationSpread"
          when
              $service : MrService($locationSpread : locationSpread)
              $spreadCount : Number(intValue < $locationSpread) from accumulate(
                      $location : MrLocation()
                      and exists MrProcessAssignment(service == $service, location == $location),
                  count($location)
              )
          then
              scoreCalculator.addToHardScore($locationSpread - $spreadCount.intValue());
          undo-then
              scoreCalculator.substractFromHardScore($locationSpread - $spreadCount.intValue());
              // $spreadCount should still be the same as it used to be
      end
      

      Attachments

        Activity

          Public project attachment banner

            context keys: [headless, issue, helper, isAsynchronousRequest, project, action, user]
            current Project key: JBRULES

            People

              mproctor@redhat.com Mark Proctor
              gdesmet@redhat.com Geoffrey De Smet
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: