Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Panel
titleColorwhite
titleBGColor#205081
titleInhalt

Table of Contents



Panel
titleColorwhite
titleBGColor#205081
titleVerweise


Status
colourRed
titleStatus

Filter regelbasiert

Given: Es gibt eine Menge von Werten.

When: Es wird ein Entity ausgewählt.

Then: Eine Submenge der Werte wird zurückgegeben.

Code Block
languagexml
firstline1
linenumberstrue
<?xml version="1.0" encoding="ISO-8859-1" ?>
<definition>
    <entities>
        <entity name="Country" class="de.neusta.ruleengine.Country" fields="id | name">
        </entity>
    </entities>

    <enums>
        <enum name="DeliveryOptions" valid="DHL | UPS | HERMES | DPD"/>
    </enums>

    <rules>
        <when type="Country" id="Germany" method="getDeliveryOptions" result="DHL | HERMES | DPD"/>
    </rules>
</definition>



API für Filter

Code Block
Country country = (Country) modelService.getEntity("Country", "Germany");
List<Result> resultArray = ruleService.getResult(country, "DeliveryOptions");
AssertThat(resultArray.size(), is(4);
AssertThat(resultArray.get(0), is("DHL");

List<DeliveryOption> deliveryOptions = new ArrayList<>(); 
DeliveryOptionConverter.convert(resultArray, deliveryOptions);