...
Starting in HtmlFormEntry version 1.7.2, all tag handlers are required to implement a getAttributeDescriptors method. Attribute descriptors are used to define what attributes a tag supports to facilitate sharing tags via the metadata sharing module. When preparing a form for export, all metadata referenced by the form need to be included in the export package. For example, in the following tag, all the concepts referenced by id, uuid, or concept mapping need to be included in the export package:
Code Block |
---|
<obs conceptId="1000" answerConceptIds="1001,XYZ:HT,1002,32296060-03-102d-b0e3-001ec94a0cc7"/>
|
Attribute descriptors provide a means for a tag handler to define how to find all the metadata that may be referenced within the tag. For example, the DrugOrderTagHandler defines the following descriptors:
Code Block |
---|
protected List<AttributeDescriptor> createAttributeDescriptors() {
List<AttributeDescriptor> attributeDescriptors = new ArrayList<AttributeDescriptor>();
attributeDescriptors.add(new AttributeDescriptor("drugNames", Drug.class));
attributeDescriptors.add(new AttributeDescriptor("discontinuedReasonConceptId", Concept.class));
attributeDescriptors.add(new AttributeDescriptor("discontinueReasonConceptAnswers", Concept.class));
return Collections.unmodifiableList(attributeDescriptors);
}
|
The easiest way to add attribute descriptor support to a tag handler is for the tag handler to extend AbstractTagHandler, which provides a basic implementation getAttributeDescriptor that returns null. To define attribute attribute descriptors, override the AbstractTagHandler createAttributeDescriptors method as shown above for DrugOrderTagHandler. (Note that SubstitutionTagHandler now extends AbstractTagHandler, so any tag handler that currently extends SubstutitionTagHandler will have default attribute descriptor support built-in.
...