JIRA -> BAH-4339
Currently, the EncounterServiceSaveAdvice class has a hardcoded check that only publishes atomfeed events for encounters with type "INVESTIGATION":
if (ENCOUNTER_TYPE_INVESTIGATION.equals(encounterType)) {
// publish event
}
This implementation is restrictive and prevents deployments from configuring which encounter types should trigger event publication without modifying the source code.
Impact
- Deployments requiring event publication for other encounter types (e.g., "CONSULTATION", "LAB_RESULT", "ADMISSION") are skipped
- Inconsistent with other advice classes in the module that use global properties for configuration
- Reduces flexibility and increases maintenance burden
Proposed Solution
Replace the hardcoded encounter type check with a configurable global property that supports multiple encounter types:
- Add a new global property: atomfeed.publish.encounterTypes (comma-separated list) - Example value: "INVESTIGATION,CONSULTATION,LAB_RESULT"
- If the property is empty or not set, maintain backward compatibility by defaulting to "INVESTIGATION"
- Update the logic to check if the encounter type exists in the configured list
- Follow the existing pattern used in PersonRelationshipAdvice.java:60-62 and PatientProgramAdvice.java:82-87
Acceptance Criteria
- Global property atomfeed.publish.encounterTypes is supported
- Multiple encounter types can be configured (comma-separated)
- Backward compatibility: defaults to "INVESTIGATION" when property is not set
- Whitespace handling in the comma-separated list
- Unit tests cover multiple encounter types and edge cases
- Documentation updated with the new configuration option
Technical Notes
- File location: openmrs-atomfeed-api/src/main/java/org/openmrs/module/atomfeed/advice/EncounterServiceSaveAdvice.java:49
- Reference implementation: PersonRelationshipAdvice.java for global property pattern
- Consider using StringUtils.split() or similar for parsing comma-separated values
JIRA -> BAH-4339
Currently, the EncounterServiceSaveAdvice class has a hardcoded check that only publishes atomfeed events for encounters with type "INVESTIGATION":
This implementation is restrictive and prevents deployments from configuring which encounter types should trigger event publication without modifying the source code.
Impact
Proposed Solution
Replace the hardcoded encounter type check with a configurable global property that supports multiple encounter types:
Acceptance Criteria
Technical Notes