Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • MainResorceController handles the request, determines which resource the request is for (PatientResource), and calls that resource's retrieve() function.

  • DelegatingCrudResource (which is the superclass of most *Resource.java files) provides the retrieve function, which calls asRepresentation() to that reads the <rep> parameter

  • asRepresentation() attempts to convert the <rep> to a list of Patient properties (fields) to be retrieved using a combination of different strategies:

    • PatientResource.getRepresentationDescription() is first called. This function (usually) lists out the properties that should be retrieved for the "standard" representations commons to most resources (defaultfull and ref).

    • if the above function returns null, the findAnnotatedMethodForRepresentation function is called to find the method in the *Resource.java class that is annotated with @RepHandler to handle the specified <rep>.

    • If the above fails, it assumes that the <rep> is a customer representation (ex: custom:(uuid)), and calls getCustomRepresentationDescription to retrieve the list of properties.

  • The The BaseDelegatingConverter.'s convertDelegateToRepresentation() function gets called to loop through each property name and converts it to actual values by calling DelegatingResourceDescription.Property.evaluate()

  • The evaluate() function tries a combination strategy of reflection and annotated methods to retrieve the value of the property. This process can be recursive as the property can itself be another Resource.

  • The evaluated object gets returned by MainResourceController.retrieve() to be serialized into the appropriate data format (xml or json)

...