Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BAH-4033 | Refactor. Throw validation exception when a concept cannot be matched for a given task_type #65

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

mohan-13
Copy link
Member

This PR enhances the TaskMapper implementation to throw a ValidationException which in turn will lead to 400 Bad Request error when a taskType is passed and a corresponding concept matching the given name cannot be identified.

This is enhancement is done to allow implementers configure their implementation specific task types and get a proper error when a concept cannot be matched.

JIRA Epic: https://bahmni.atlassian.net/browse/BAH-4032

log.warn("Task type is not passed. Setting as null");
return null;
}
Concept conceptForTaskType = Context.getConceptService().getConceptByName(taskType);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This conceptService method will consider userLocale first.

If you expect the taskType to be provided as "user input" then the above is good.

Alternatively, if it is to be specified by implementation locale, this might be a better option. conceptService.getConceptsByName(name, locale, false)
where you get the LocalUtility.getDefaultLocale()

If this method is called by both human and non-human user inputs - then

conceptService.getConcepts(conceptName, localeList, false, null, null, null, null, null, 0, null)

Might be better.

@mohan-13 mohan-13 requested a review from angshu July 22, 2024 17:50
@mohan-13 mohan-13 merged commit 6b5efd9 into main Jul 23, 2024
2 checks passed
@mohan-13 mohan-13 deleted the BAH-4033 branch July 23, 2024 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants