For the 2nd week the first task was to solve the blocker from last time. I was finally able to solve it by switching to an XML based configuration. With this the module was finally setup., and my Mentor reviewed my code.
I spent the first few days of this week reading up on hibernate search with lucene. I had a call with my mentor to discuss the way forward, and he advised that we should first focus on the application logic. After a long discussion we narrowed down the tasks for 2nd week.
The 2nd week tasks included working on the tagging API, which involved the following :-
->Adding methods to the service layer, –
Tag getTagByUuid(String uuid)
Tag saveTag(Tag tag)
void purgeTag(Tag tag)
Tag getTagById(int id)
List getTagByName(String tag)
The above methods are all general methods.
void addTag(OpenmrsObject openmrsObject, String tag)
For the above method several checks have to be placed, such as a warning needs to be logged if someone wants to place a duplicate tag on the same object.
List getTags(OpenmrsObject openmrsObject)
List getTags(List types, List tags, boolean matchAllTags);
The above method is if someone wants to make a query like :- “get all tags of object_type “X” or “Y” which have “tag1” and “tag2″ (if matchAllTags = true)”, or “get all tags of object_type “X” or “Y” which have “tag1” or “tag2” (if matchAllTags=false)
My task ensues writing all relevant method implementations and their database interactions along with adding unit tests for testing purpose.
->Adding Validation Logic, by adding a class tag validator. It checks whether the tag being added passes the following checks:-
tag name should not be empty.
object should have a uuid, and it should exist in the openmrs database. This can be checked by the following method:-
boolean objectExits(String object_uuid, String object_type)
->Adding a Privilege “Manage Tags”.
->Making changes to the database. Adding 2 new columns, and creating indexes on “tag” and “object_type”.
REPO: – https://github.com/jtatia/openmrs-module-tag