UIFrameworkService

public interface UIFrameworkService

Service responsible for managing the user interface. Provides methods for registering/un-registering modules. All modules are represented by ModuleRegistrationData objects, either registered directly through this service or automatically by exposing it in their spring context. This service also allows manipulation of module state, by marking given modules as requiring attention on the UI.

Methods

getModuleData

ModuleRegistrationData getModuleData(String moduleName)

Gets registration data for the module with the given name.

Parameters:
  • moduleName – the name of the module for which the registration data should be retrieved
Returns:

the registration data for the given module, or null if such a module is not registered

getModuleDataByAngular

ModuleRegistrationData getModuleDataByAngular(String angularModule)

Retrieves module registration data which registers the given AngularJS module.

Parameters:
  • angularModule – the name of the Angular module
Returns:

the registration for the module that registers the Angular module

getModuleDataByBundle

ModuleRegistrationData getModuleDataByBundle(Bundle bundle)

Retrieves the module registration data for a given bundle. Since org.motechproject.osgi.web.ModuleRegistrationData held by the service contain references to the bundles registering them, this will match relying on Bundle.equals().

Parameters:
  • bundle – the bundle for which the registration data should be retrieved
Returns:

the registration data for the given bundle (module)

getRegisteredModules

ModuleRegistrations getRegisteredModules()

Returns information about all modules registered with the UI system. The modules are grouped into module with their own submenus (links to menus in the top menu), those without their submenus (they are all placed in the modules section) and those without UI altogether (messages from them will be loaded though, for usage in tasks and possibly other places).

Returns:all modules registered with the system

isModuleRegistered

boolean isModuleRegistered(String moduleName)

Checks whether the module with a given name is registered in the UI system.

Parameters:
  • moduleName – the name of the module
Returns:

true if the module is registered, false otherwise

moduleBackToNormal

void moduleBackToNormal(String moduleName)

Marks the module as no longer requiring attention, undoing the moduleNeedsAttention(String,String) call. The red marker will disappear from the link of that module.

Parameters:
  • moduleName – the name of the module that is back to normal

moduleBackToNormal

void moduleBackToNormal(String moduleName, String submenu)

Marks the module and submenu as no longer requiring attention, undoing the moduleNeedsAttention(String,String,String) call. The red marker will disappear from the link of that module and submenu.

Parameters:
  • moduleName – the name of the module that is back to normal
  • submenu – the name of the submenu that is back to normal

moduleNeedsAttention

void moduleNeedsAttention(String moduleName, String message)

Marks a module as requiring attention, by setting the org.motechproject.osgi.web.ModuleRegistrationData.setNeedsAttention(boolean) flag and the critical message for the module using org.motechproject.osgi.web.ModuleRegistrationData.setCriticalMessage(String). This will mark the module as needing attention on the UI by display a red warning sign next to its link and displaying the message.

Parameters:
  • moduleName – the name of the module to mark as requiring attention
  • message – the message explaining the reason for this alert

moduleNeedsAttention

void moduleNeedsAttention(String moduleName, String submenu, String message)

Does the same as moduleNeedsAttention(String,String), with the difference that an entire submenu (the top level menu) will be marked as requiring attention.

Parameters:
  • moduleName – the name of the module to mark as requiring attention
  • submenu – the name of the submenu to be marked as requiring attention
  • message – the message explaining the reason for this alert

registerModule

void registerModule(ModuleRegistrationData module)

Registers a module in the UI system.

Parameters:

unregisterModule

void unregisterModule(String moduleName)

Unregisters module from the UI system.

Parameters:
  • moduleName – the name of the module to unregister