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

UnMatch Listener for Compensation Actions

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    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

          People

            mproctor@redhat.com Mark Proctor
            gdesmet@redhat.com Geoffrey De Smet (Inactive)
            Archiver:
            rhn-support-ceverson Clark Everson

            Dates

              Created:
              Updated:
              Resolved:
              Archived:

              PagerDuty