Dynamic Utilities Overview
Essential knowledge
Intended Audience:
Technical User
Author:
Kirill Gaiduk
Changed on:
11 Nov 2025
Overview
The`util-dynamic` library is a collection of utility functions that allow you to generate GraphQL queries and mutations at runtime. This enables the creation of highly configurable and reusable rules that can adapt to different needs without requiring code changes.PrerequisitesThese articles assumes you're familiar with:- Java
- Maven
- JUnit
Key points
- Dynamic Queries: Fetch any field from an entity at runtime by providing a POJO class that defines the desired data structure, eliminating the need for pre-compiled queries.
- Dynamic Mutations: Update any field on an entity by passing a simple
`Map`of key-value pairs, allowing for the creation of generic "field setter" rules. - Dynamic Connections: Easily query and iterate over paginated one-to-many relationships (like
`order.items`), as the utility handles all the pagination logic for you. - Advanced JSON Path: A powerful
`getJsonPath`method that can retrieve data from either the event or the entity itself, automatically determining the correct source. - Enhanced JSON Utilities: This bundle includes a more advanced
`JsonUtils`with powerful methods for navigating and transforming complex JSON structures.
Value Proposition
The primary value of the Dynamic Utilities is flexibility.- Configurable Rules: Workflow designers can change what data a Rule fetches or updates by modifying Rule properties, without needing a developer to write and deploy new code.
- Reusable Logic: You can create a single, generic rule (e.g., "SetEntityField") that can be used across many different entity types and scenarios, reducing code duplication.
- Adaptive Workflows: Build workflows that can adapt to different conditions at runtime by dynamically querying or updating the data that matters most in a given context.
Apollo Android Context
The Fluent Rules SDK relies on Apollo Android to execute GraphQL queries. Apollo's method of pre-compiling queries into Java classes:- Enhances type safety
- And boosts performance
- Pre-compiled queries restrict Workflow designers from dynamically accessing or updating data, as they require new queries to be developed and compiled each time.
- Additionally, the pre-compilation process limits the ability to create universal Rules that apply similar logic across different entity types.
