Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Some changes made

Sub Class Handler provides you to the facility to add different child classes of single resource with while handling all the complex works behind by just providing you with annotation to handle @SubClassHandler. Like work behind. You only need to provide annotation @SubClassHandler. For example, Order class has two child classes DrugOrder and TestOrder. But , but there is only one single  @Resource  class of OrderResource. The child classes have their @subclasshandler classes for this not Resource class. OpenMRS Rest Module resolves all the complex task behind it. Developer just have to add few things to resolve this problem without worrying to muchinstead of separate resource.

In Order model, Rest Module has only used single @Resource for parent only. The child classes have only  

Wiki Markup
/**
 * Resource for {@link Order} and all of its subclasses
 */
@Resource(name = RestConstants.VERSION_1 + "/order", supportedClass = Order.class, supportedOpenmrsVersions = { "1.8.*",
        "1.9.*" }, order = 1)
public class OrderResource1_8 extends DataDelegatingCrudResource<Order> {

}

...

The Child classes of Order have annotated @subClassHandler @SubClassHandler , extends BaseDelegatingSubclassHandler<parent, child> and implements DelegatingSubclassHandler<parent,child> .

...