Author:
Kirill Gaiduk
Changed on:
25 Sept 2025
Author:
Kirill Gaiduk
Changed on:
2 Oct 2025
`locationDistance`, `locationDistanceBanded`, `locationDistanceExclusion``inventoryAvailability`, `inventoryAvailabilityBanded`, `inventoryAvailabilityExclusion``networkPriority`, `locationTypeExclusion`, `locationNetworkExclusion``locationDailyCapacity``SourcingCriterion` GraphQL type.It refers to an individual, concrete instance of a Sourcing Criterion that is configured as part of a Sourcing Strategy.| Field | Type | Description | Notes |
`name` | `String` | Name of the Sourcing Criterion | The `name` serves as a unique identifier for Sourcing CriteriaReference Sourcing Criteria schema (specified in the `fc.rubix.order.sourcing.criteria` Setting) can be overridden by using the same `name` and alternative configuration in the `fc.rubix.order.sourcing.criteria.custom` Setting |
`type` | `String` | Type of the Sourcing Criterion | The `type` is mapped to a specific function in the `util-sourcing` library (Criterion Utilities) |
`params` | `Json` | Parameters of the Sourcing Criterion | The Parameters configure Sourcing Criteria to support specific customer sourcing logicAvailable configuration options are defined with the `fc.rubix.order.sourcing.criteria` and `fc.rubix.order.sourcing.criteria.custom` Settings |
`fc.rubix.order.sourcing.criteria` stores reference (`GLOBAL`) Sourcing Criteria schema`fc.rubix.order.sourcing.criteria.custom` can be created for customer-specific (`ACCOUNT` / `RETAILER`) Sourcing Criteria schema`BaseSourcingCriterion``LocationDistanceCriterion` – calculates distance between destination and Location`InventoryAvailabilityCriterion` – evaluates available stock coverage`NetworkPriorityCriterion` – prioritizes Locations based on Network membership`normalize()` to adjust rating scales (e.g., smaller distance = higher score)`@SourcingCriterionInfo` - defines metadata such as `name`, `type`, `tags`, and `label``@SourcingCriterionParam` - specifies configurable parameters, UI component type, and options`SourcingCriteriaUtils`)`CriteriaArray` - stacks multiple Criteria for sequential evaluation and tie-breaking`normalize()` - scales ratings across all candidate Locations into a [0..1] range`getFloats`, `getStrings`, `getDistanceUnits`) - parse parameter values from JSON configs`getCriteria(...)` - merges default and Strategy-specific Criteria into a single evaluation stack`SourcingCriteriaTypeRegistry`)Author:
Kirill Gaiduk
Changed on:
26 Sept 2025

Author:
Kirill Gaiduk
Changed on:
16 Apr 2026
`type` (for example, `fc.sourcing.criterion.locationDistance`) and applies its `apply()` method to every candidate Location.`BaseSourcingCriterion` and Criterion Utilities:`apply()` calls pre-logic, executes business rules, and post-logic`normalize()` adjusts raw scores to a [0–1] range where applicable`parseParams()` reads JSON params defined in the `fc.rubix.order.sourcing.criteria` Setting`getFloats`, `getStrings`, `getDistanceUnits`) ensure correct types and default handling| Class(Criterion Utilities) | Type(Sourcing Criteria Schema) | Description(UI) | Notes |
`LocationDistanceCriterion` | `fc.sourcing.criterion.locationDistance` | Prioritises locations that are geographically closer to the delivery address |
|
`LocationDistanceBandedCriterion` | `fc.sourcing.criterion.locationDistanceBanded` | Ranks locations by distance bands {{value}}, prioritising bands that are closer |
|
`LocationDistanceExclusionCriterion` | `fc.sourcing.criterion.locationDistanceExclusion` | Excludes locations that are farther than {{value}}{{value}} | Excludes (-1) Locations beyond a specified maximum distance threshold (in km or miles) |
`LocationDailyCapacityCriterion` | `fc.sourcing.criterion.locationDailyCapacity` | Prioritises locations with the highest available daily fulfillment capacity | Rates Locations based on their `DAILY_MAX_ORDER_CAPACITY` attribute value (higher capacity = higher rating) |
`NetworkPriorityCriterion` | `fc.sourcing.criterion.networkPriority` | Prioritises locations by the specified network ranking {{value}} |
|
`InventoryAvailabilityCriterion` | `fc.sourcing.criterion.inventoryAvailability` | Prioritises locations based on total units of inventory requested in the order that can be fulfilled |
|
`InventoryAvailabilityBandedCriterion` | `fc.sourcing.criterion.inventoryAvailabilityBanded` | Ranks locations by fulfillment percentage bands {{value}}, prioritising bands with higher availability |
|
`InventoryAvailabilityExclusionCriterion` | `fc.sourcing.criterion.inventoryAvailabilityExclusion` | Excludes locations where inventory availability for a given order, is less than {{value}}% | Excludes (-1) Locations that do not meet the configured minimum fulfillment threshold (in %) |
`LocationTypeExclusionCriterion` | `fc.sourcing.criterion.locationTypeExclusion` | Excludes locations of type {{value}} | Excludes (-1) Locations whose type matches a configured value(s) (e.g., store vs. warehouse) |
`LocationNetworkExclusionCriterion` | `fc.sourcing.criterion.locationNetworkExclusion` | Excludes locations that are members of one of the following networks {{value}} |
|
`OrderValueCriterion` | `fc.sourcing.criterion.orderValue` | Prioritises locations that fulfill a higher monetary portion of the order |
`InventoryAvailabilityCriterion`, surplus Inventory does not increase the score above 1 because the calculation caps the fulfilled value at the requested quantity of each Item |
| Class | Type | Notes |
`RejectedLocationExclusionCriterion` | `fc.sourcing.criterion.locationExclusion` | Automatically excludes Locations that previously rejected Items in the same Sourcing Request (applied by default, not shown in UI) |
`fc.rubix.order.sourcing.criteria` Setting to ensure valid configuration:`value`: Numeric thresholds or band breakpoints. An input like [10, 25, 50] defines 4 bands:`valueUnit`: Selects unit of measure where applicable (kilometres, miles)`component`: UI input type such as `fc.field.multistring`, `integer`, or `select``mandatory` / `exactSearch`: Validation flags controlling whether the field must be provided and if exact match applies`fc.rubix.order.sourcing.criteria` Setting defines templates for all reference Sourcing Criteria. Each template specifies the required UI components and their validation rules to ensure that Criteria parameters are entered consistently and correctly.For account/retailer-specific adjustments, override Criteria in `fc.rubix.order.sourcing.criteria.custom`. When a Criterion with the same `name` exists in both schemas, the custom schema takes precedence, allowing organizations to tailor global definitions to their own business needs without breaking the baseline.`fc.rubix.order.sourcing.criteria.custom` when tailoring Criteria for specific Accounts / Retailers`util-sourcing` at runtime so it can initialize its own local sourcing registries.You can include it in your project by:`pom.xml``SourcingCriterion` (or extend `BaseSourcingCriterion`).`BaseSourcingCriterion`) Put computation in `execute(CriterionContext ctx)`.`parseParams(JsonNode params)`.`normalize(min, max, rating)` when your metric is “lower is better” (e.g., distance).1@SourcingCriterionInfo(
2 name = "CustomSourcingCriterion",
3 type = "company.sourcing.criterion.custom",
4 tags = { "ATS-agnostic" } // or "ATS-dependent", "Exclusion"
5)
6public class CustomSourcingCriterion extends BaseSourcingCriterion {
7
8 @SourcingCriterionParam(name = "value", component = "integer")
9 private Integer threshold;
10
11 @Override
12 public void parseParams(final JsonNode params) {
13 // parse threshold, lists, units, and etc.
14 }
15
16 @Override
17 protected float execute(final SourcingCriteriaUtils.CriterionContext ctx) {
18 // Return:
19 // -1f to exclude a location,
20 // 0..1f (or any float) to score/rank a location, higher score is better.
21 return 0.75f;
22 }
23
24 // Override normalize(...) only if the default doesn’t fit your scale.
25}`CreateFulfilmentWithSourcingProfile``CreatePartialFulfilmentWithSourcingProfile``CreateRejectedFulfilment` (if applicable)1@RuleInfo(
2 name = "CustomCreateFulfilmentWithSourcingProfile",
3 description = "Applies Sourcing Profile {" + "profileRef" + "} to a sourcing request (Order, Fulfilment Option, etc.) and produces Fulfillment(s)",
4 accepts = {@EventInfo(entityType = "ORDER"),
5 @EventInfo(entityType = "FULFILMENT_CHOICE")}
6)
7@ParamString(name = "profileRef", description = "Profile reference to apply.")
8@Slf4j
9public class CustomCreateFulfilmentWithSourcingProfile implements Rule {
10
11 static {
12 // register custom sourcing criterion
13 SourcingCriteriaTypeRegistry.register("company.sourcing.criterion.custom", CustomSourcingCriterion.class);
14 // register custom sourcing condition
15 SourcingConditionTypeRegistry.register("company.sourcing.condition.custom", CustomSourcingCondition.class);
16 }
17
18 @Override
19 public void run(Context context) {
20 SourcingProfile sourcingProfile = loadSourcingProfile(context);
21 if (sourcingProfile.getSourcingStrategies() != null) {
22 SourcingContext sourcingContext = loadSourcingContext(context, SourcingUtils::getUnfulfilledItems);
23 SourcingUtils.SourcingPlan plan = findPlanBasedOnStrategies(context, sourcingContext, sourcingProfile,
24 ImmutableList.of("ACTIVE", "AT_RISK"), null);
25 if (plan.getFulfilments() != null) {
26 fillFulfilmentType(sourcingContext, plan.getFulfilments());
27 createFulfilments(context, sourcingContext, plan.getFulfilments());
28 }
29 }
30 }
31}`fc.rubix.order.sourcing.criteria.custom` with your new Criterion schema.1mutation createSetting ($input: CreateSettingInput) {
2 createSetting (input: $input) {
3 id
4 name
5 valueType
6 lobValue
7 value
8 context
9 contextId
10 }
11}1{
2 "input": {
3 "name": "fc.rubix.order.sourcing.criteria.custom",
4 "valueType": "JSON",
5 "lobValue": [
6 {
7 "name": "CustomSourcingCriterion",
8 "type": "company.sourcing.criterion.custom",
9 "tags": [
10 "Lorem ipsum"
11 ],
12 "params": [
13 {
14 "name": "parameter1",
15 "value": "Lorem ipsum"
16 },
17 {
18 "name": "parameterN",
19 "value": "Lorem ipsum"
20 }
21 ]
22 }
23 ],
24 "value": "",
25 "context": "RETAILER",
26 "contextId": 1
27 }
28}1{
2 "data": {
3 "createSetting": {
4 "id": "13142",
5 "name": "fc.rubix.order.sourcing.criteria.custom",
6 "valueType": "JSON",
7 "lobValue": [
8 {
9 "name": "CustomSourcingCriterion",
10 "type": "company.sourcing.criterion.custom",
11 "tags": [
12 "Lorem ipsum"
13 ],
14 "params": [
15 {
16 "name": "parameter1",
17 "value": "Lorem ipsum"
18 },
19 {
20 "name": "parameterN",
21 "value": "Lorem ipsum"
22 }
23 ]
24 }
25 ],
26 "value": "",
27 "context": "RETAILER",
28 "contextId": 1
29 }
30 }
31}