ValidateCategoriesExist
Changed on:
28 Nov 2023
Overview
Validates the incoming category event for the existence of the parent and child categories
Plugin Name | Inventory Reference Module |
---|---|
Namespace | [[account.id]].globalinventory |
The Inventory Reference Module is the foundation for inventory related implementations. It provides reference Workflows for inventory ingestion and processing. Extensible by design, use this Module as a base to build a solution to the needs of your customers.
The Inventory Module includes the following areas:
- Product Catalogue workflow
- Inventory Catalogue workflow
- Control Group workflow
- Virtual Catalogue workflow
UI Description
Validates the incoming category event for the existence of the parent and child categories
Accepts
- PRODUCT_CATALOGUE
Actions
- This rule does not produce any output actions. It validates the incoming child categories and the parent category if they exist. Otherwise, an IllegalArgumentException will be thrown with the missing categories
Rule parameters
There are no Input Parameters for this rule.
Event attributes
Parameter | Description | Data Type | Required? |
childCategories | A list of child categories of the category being created/updated. Each child category is a string and the value of this field is a list of strings | [String] | Optional |
parentCategory | The category reference if the current category being created/updated has a parent category | String | Optional |
Exceptions
- If there is a parent category provided in the incoming event and if it does not exist, an IllegalArgumentException will be thrown.
- If there are one or more child categories provided in the incoming event and if at least one of them does not exist, an IllegalArgumentException will be thrown
Configuration example
1{
2 "name": "{{accountId}}.globalinventory.ValidateCategoriesExist"
3}
Language: json
Detailed Technical Description
The below snippet shows the corresponding Java class definition of the incoming event's event attributes
1public class Category {
2
3 @NonNull
4 private String ref;
5
6 private String type;
7
8 private List<Attribute> attributes;
9
10 private String name;
11
12 private String summary;
13
14 private String parentCategory;
15
16 private List<String> childCategories;
17}
Language: java
Name: Category Java Class Definition
Description:
[Warning: empty required content area]This rule parses/deserialises all the event attributes into a Category object outlined above. If child categories are present in the event attributes, it will perform a validation on them. The rule will throw an exception with all the missing categories if the provided child category/categories do not exist. Likewise, the rule performs the same validation on the parent category if such value is present in the event attributes and throws an exception if the parent category does not exist. Otherwise, the rule does not have any output/output action. Note that a parent category ref with an empty string or series of empty spaces is considered a valid parent category.
Version History
v2.0.0
refers to plugin