I think @ssmusoke would like to see 2 things happen, i.e to be able to retrieve any persistent openmrs object by a uuid, and also in this particular case he wants to be able to get a person attribute when he calls Person.getAttribute(String arg)
where the argument value is a person attribute type uuid , currently this only supports attribute type name.
I personally would love to see our API services evolve and become more generic to minimize code duplication, we have a BaseOpenmrsService that is inherited by all services, we could add to it methods like below:
<T extends BaseOpenmrsObject> T getById(Class<T> clazz, Long id) {
return genericDAO.getById(clazz, id);
}
<T extends BaseOpenmrsObject> T getByUuid(Class<T> clazz, String uuid) {
return genericDAO.getByUuid(clazz, uuid);
}
Alternatively we could introduce a ServiceUtil class that contains the methods above along with more like:
<T extends BaseOpenmrsMetadata> T getByName(Class<T> clazz, String name) {
return genericDAO.getByName(clazz, name);
}