Class InvolvedUsersParser
java.lang.Object
com.bonitasoft.processbuilder.extension.InvolvedUsersParser
Utility class responsible for parsing JSON configuration related to
involved users, actors, and assignment logic within a Bonita process extension.
This class provides a static method to extract, validate, and structure data
from a JSON string into an immutable
InvolvedUsersData record in a single pass.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringextractNullableTextField(com.fasterxml.jackson.databind.JsonNode node, String fieldName) Helper method to extract a field that MUST BE PRESENT, but can have a null or empty value.static StringextractRequiredTextField(com.fasterxml.jackson.databind.JsonNode node, String fieldName) Helper method to extract a required text field from a JsonNode.static InvolvedUsersDataparseInvolvedUsersJson(String jsonString) Parses the 'involvedUsers' JSON string, expecting the string to contain actor configuration (stepManager, stepUser, memberShips).
-
Constructor Details
-
InvolvedUsersParser
public InvolvedUsersParser()
-
-
Method Details
-
extractRequiredTextField
public static String extractRequiredTextField(com.fasterxml.jackson.databind.JsonNode node, String fieldName) Helper method to extract a required text field from a JsonNode.- Parameters:
node- The parent JsonNode to search within.fieldName- The name of the required field.- Returns:
- The String value of the field.
- Throws:
IllegalArgumentException- if the field is missing, null, or not a valid text value.
-
extractNullableTextField
public static String extractNullableTextField(com.fasterxml.jackson.databind.JsonNode node, String fieldName) Helper method to extract a field that MUST BE PRESENT, but can have a null or empty value.- Parameters:
node- The parent JsonNode to search within.fieldName- The name of the required, but nullable/empty, field.- Returns:
- The String value of the field, or null if the value is JSON null, or an empty string if the content is empty.
- Throws:
IllegalArgumentException- if the field is completely missing from the JSON object.
-
parseInvolvedUsersJson
Parses the 'involvedUsers' JSON string, expecting the string to contain actor configuration (stepManager, stepUser, memberShips). This method combines validation and data extraction into a single, optimized process.- Parameters:
jsonString- The JSON string to parse. This string is expected to be the object containing required fields like 'stepManager', 'stepUser', and 'memberShips'.- Returns:
- An
InvolvedUsersDataobject containing the parsed actor references. - Throws:
IllegalArgumentException- if the JSON string is null, empty, or cannot be parsed, OR if any required field is missing or invalid (including empty strings for text fields).
-