String[] ids = matcher.group(1).split(",");
for (String id : ids) {
// if this id matches a uuid pattern, try to fetch the object by uuid
if (HtmlFormEntryUtil.isValidUuidFormat(id) && OpenmrsObject.class.isAssignableFrom(attributeDescriptor.getClazz())) {
OpenmrsObject object = Context.getService(HtmlFormEntryService.class).getItemByUuid(
(Class<? extends OpenmrsObject>) attributeDescriptor.getClazz(), id);
if (object != null) {
//special handling of Form -- if passed a Form, see if it can be passed along as HtmlForm
if (Form.class.equals(attributeDescriptor.getClazz())) {
Form form = (Form) object;
HtmlForm htmlForm = Context.getService(HtmlFormEntryService.class).getHtmlFormByForm(form);
if (htmlForm != null){
dependencies.add(htmlForm);
continue;
}
}
dependencies.add(object);
continue;
}
}
// if we haven't found anything by uuid, try by name
if (OpenmrsMetadata.class.isAssignableFrom(attributeDescriptor.getClazz())) {
OpenmrsObject object = Context.getService(HtmlFormEntryService.class).getItemByName(
(Class<? extends OpenmrsMetadata>) attributeDescriptor.getClazz(), id);
if (object != null) {
dependencies.add(object);
continue;
}