Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: moved out of archive, fixed link to wikipedia Java annotations article

See also: Annotations@w Java Annotations article

Custom OpenMRS annotations available to core and modules:

@Authorize

This is used on API interface methods to restrict access to the current user (Context.getAuthenticatedUser()) if they don't have a certain privilege.

Parameters

value (default) - An array of Strings

...

Panel

If true, will require that the user have each privilege defined in the "value" attribute
example: @Authorized(value={OpenmrsConstants.PRIV_VIEW_CONCEPTS, OpenmrsConstants.PRIV_VIEW_CONCEPTS}, requireAll=true) will allow the user to run that method if they have both privilege

@Logging

All methods in the OpenMRS API will log to "info" with their parameter values. (errors go to log.error, and execution time to log.trace).

Use this annotation in order to prevent sensitive parameter values from being logged (UserService.saveUser(user, password)).

Parameters

ignoreAllArgumentValues - boolean, defaults to false

...

Panel

The argument value index to not print. (0-based array)
example: @Logging(ignoredArgumentIndexes={1}) will not print the value of the second argument.

@Handler

This annotation serves as a general mechanism for providing metadata about a class that serves as a 'Handler' for another class or classes.

Spring automatically finds all handlers for a given class and groups them. This way programmers can request them easily and act on them.

See API Save Handlers

Parameters

supports - An array of classes

...