Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

This document will demonstrate how to use the OpenMRS app framework version 2.0. The app framework provides a way to define a set of apps and extensions in configuration which can then be accessed using an API. For details on its design, look here.

Apps/Extensions can be defined in the system by using a JSON configuration. This JSON data structure provides the configuration for a particular app/extension. This JSON configuration is placed in a folder with a naming style defined by convention.

...

The following are the list of APIs that can be used to access the app framework

    /*

     * Fetches all apps that have been defined or are available in the system across modules

     *

     * @return - List of all App Descriptors

     */

    List<AppDescriptor> getAllApps();

    /*

     * Fetches all extensions that have been defined or are available in the system across modules for a particular

     * app at an extension point.

     *

     * @param appId - id of the app

     * @param extensionPointId - id of the extension point.

     * @return - List of all extensions.

     */

    List<Extension> getAllExtensions(String appId, String extensionPointId);

    /*

     * Fetch only the apps that are enabled (or ignore the apps that are disabled)

     *

     * @return - List of enabled app descriptors

     */

    List<AppDescriptor> getAllEnabledApps();

    /*

     * Fetch all enabled extensions (or ignore disabled extensions) for a particular app at an extension point.

     *

     * @param appId - id of the app

     * @param extensionPointId - id of the extension point

     * @return - List of all enabled extensions

     */

    List<Extension> getAllEnabledExtensions(String appId, String extensionPointId);

    /*

     * Enables an app.

     *

     * @param appId - id of the app

     */

    void enableApp(String appId);

    /*

     * Disables an app.

     *

     * @param appId - id of the app

     */

    void disableApp(String appId);

    /*

     * Enables an extension.

     *

     * @param extensionId - id of the extension

     */

    void enableExtension(String extensionId);

    /*

     * Enables an extension.

     *

     * @param extensionId - id of the extension

     */

...

Code Block
languagejava
   /**
    * Fetches all apps that have been defined or are available in the system across modules
    *
    * @return - List of all App Descriptors
    **/
    List<AppDescriptor> getAllApps();

    /**
     * Fetches all extensions that have been defined or are available in the system across modules for a particular
     * app at an extension point.
     *
     * @param appId - id of the app
     * @param extensionPointId - id of the extension point.
     * @return - List of all extensions.
     **/
     List<Extension> getAllExtensions(String appId, String extensionPointId);

    /**
     * Fetch only the apps that are enabled (or ignore the apps that are disabled)
     *
     * @return - List of enabled app descriptors
     **/
    List<AppDescriptor> getAllEnabledApps();

    /**
     * Fetch all enabled extensions (or ignore disabled extensions) for a particular app at an extension point.
     *
     * @param appId - id of the app
     * @param extensionPointId - id of the extension point
     * @return - List of all enabled extensions
     **/
    List<Extension> getAllEnabledExtensions(String appId, String extensionPointId);

    /**
     * Enables an app.
     *
     * @param appId - id of the app
     **/
    void enableApp(String appId);

    /**
     * Disables an app.
     *
     * @param appId - id of the app
     **/
    void disableApp(String appId);

    /**
     * Enables an extension.
     *
     * @param extensionId - id of the extension
     **/
    void enableExtension(String extensionId);

    /**
     * Enables an extension.
     *
     * @param extensionId - id of the extension
     **/
    void disableExtension(String extensionId);