This guide walks you through the end-to-end process of introducing a new field (e.g., landmark) in the CCRS service module, starting from backend model changes to data persistence and validations.
Adding a new field typically involves changes across multiple layers:
Java models (domain classes)
Validation and enrichment logic
Row mapping from DB
Persister and indexer configurations
This ensures the field is:
Captured in incoming requests
Validated or enriched if needed
Persisted to the database
Indexed for search
Returned in query results
Steps to Add a New Field
1
Add field in the Model
In Service.java (or the appropriate domain class):
privateString landmark;
2
Add validation (optional)
In the validateCreate() method inside the Validator class:
if (request.getLandmark() ==null) {thrownewCustomException("PGR.LANDMARK_REQUIRED","Landmark is required");}
3
Enrich the Request (optional)
In enrichCreateRequest() method:
if (request.getLandmark() ==null) {request.setLandmark("Default");}
4
Map DB Result (RowMapper)
In PGRRowMapper.java:
service.setLandmark(rs.getString("landmark"));
5
Update Persister Configuration
In persister.yml, under save-pgr-request and update-pgr-request topics: