ModuleRegistrationData

public class ModuleRegistrationData

Object used to registered a module withing the Motech UI system. Represents a module and is used for building the common user interface. All modules that wish to register within the UI system must either expose this class as a spring bean in their application context or manually register it through the UIFrameworkService OSGi service.

See also: UIFrameworkService

Constructors

ModuleRegistrationData

public ModuleRegistrationData()

ModuleRegistrationData

public ModuleRegistrationData(String moduleName, String url)
Parameters:
  • moduleName – the name of the module
  • url – the url under which this module can be accessed

ModuleRegistrationData

public ModuleRegistrationData(String moduleName, Map<String, String> i18n)

Constructor for modules that just want to register i18n files (i.e. for tasks).

Parameters:
  • moduleName – the name of the module
  • i18n – a map, where the keys are the names of the i18n files and values are their locations (HTTP locations)

ModuleRegistrationData

public ModuleRegistrationData(String moduleName, String url, List<String> angularModules, Map<String, String> i18n)

Constructor for modules that want to register their own panels in the UI.

Parameters:
  • moduleName – the name of the module
  • url – the url under which this module can be accessed
  • angularModules – the list of angular modules that should be loaded on the UI for this module
  • i18n – a map, where the keys are the names of the i18n files and values are their locations (HTTP locations)

Methods

addAngularModule

public void addAngularModule(String moduleName)

Adds an AngularJS module that should be loaded with this module.

Parameters:
  • moduleName – the name of the angular module that should be loaded for this module on the UI

addI18N

public void addI18N(String fileName, String fileLocation)

Adds i18n messages file entry for this module. Messages from this file will be loaded on the UI.

Parameters:
  • fileName – the name of the file
  • fileLocation – the location of the file (HTTP location, ../mymodule/messages for example)

addSubMenu

public void addSubMenu(String url, String label)

Adds a submenu to this module. Submenu is a link on the left side of the UI.

Parameters:
  • url – the url to which the link will redirect to
  • label – the label that will be displayed on the UI

addSubMenu

public void addSubMenu(String url, String label, String roleForAccess)

Adds a submenu to this module. Submenu is a link on the left side of the UI.

Parameters:
  • url – the url to which the link will redirect to
  • label – the label that will be displayed on the UI
  • roleForAccess – the permission required to view this sub menu (will be hidden if the user doesn’t have the permission)

equals

public boolean equals(Object o)

getAngularModules

public List<String> getAngularModules()
Returns:the list of angular modules that should be loaded on the UI for this module

getAngularModulesStr

public String getAngularModulesStr()

Returns the list of angular modules that should be loaded for this module in a format that can be used in Javascript.

Returns:the list of Angular modules in javascript format

getBundle

public Bundle getBundle()
Returns:the underlying OSGi bundle for this module

getCriticalMessage

public String getCriticalMessage()

Returns a critical message for this module. That message should be displayed on the UI if the module needs attention.

Returns:the critical message that should be communicated to the user

getDefaultURL

public String getDefaultURL()
Returns:the default url for this module. Usually points to one of its sub-views.

getDocumentationUrl

public String getDocumentationUrl()

Returns the documentation url for this module. A small link at the bottom of the screen will point to this specific documentation, the admin module will also link to it. The link can be external.

Returns:the url of the documentation

getI18n

public Map<String, String> getI18n()

Returns the list of i18n message files for this module.

Returns:a map, where the keys are the names of the i18n files and values are their locations (HTTP locations)

getModuleName

public String getModuleName()
Returns:the name of the module represented by this object

getResourcePath

public String getResourcePath()
Returns:the path of the module’s static resources

getRestDocsPath

public String getRestDocsPath()

Returns the path to the REST API specification for this module. This file will be used for generating a Swagger UI for the API.

Returns:the path to REST API specification for this module

getRoleForAccess

public List<String> getRoleForAccess()

Returns the permission names required to access this module - used to hide its menus on the UI. This module should be exposed only if the user has at least one of these permissions.

Returns:the permissions required for accessing the module

getSettingsURL

public String getSettingsURL()

Returns the settings url for this module. This is used for linking to the custom settings page for a module in the admin UI instead of generating a UI for the settings.

Returns:the path to the custom setting page for this module

getSubMenu

public Map<String, SubmenuInfo> getSubMenu()

Returns the list of sub-menus for this module.

Returns:a map where the keys are the names of the sub-menus and values are their representations

getTabAccessMap

public Map<String, List<String>> getTabAccessMap()

Returns the map of available tabs for specified permissions for this module.

Returns:a map, where the keys are tabs names and values are lists of permissions for which the tab is available

getUrl

public String getUrl()
Returns:the url for accessing this module

hashCode

public int hashCode()

isNeedsAttention

public boolean isNeedsAttention()

Checks whether this module needs attention - meaning it requires a UI notification pointing to it.

Returns:true if the module needs attention, false otherwise

removeAngularModule

public void removeAngularModule(String moduleName)

Removes an AngularJS module from the list of modules should be loaded with this module.

Parameters:
  • moduleName – the name of the angular module that should no longer be loaded for this module on the UI

setBundle

public void setBundle(Bundle bundle)
Parameters:
  • bundle – the underlying OSGi bundle for this module

setCriticalMessage

public void setCriticalMessage(String criticalMessage)

Sets a critical message for this module. That message should be displayed on the UI if the module needs attention.

Parameters:
  • criticalMessage – the critical message that should be communicated to the user

setDefaultURL

public void setDefaultURL(String defaultURL)
Parameters:
  • defaultURL – the default url for this module. Usually points to one of its sub-views.

setModuleName

public void setModuleName(String moduleName)
Parameters:
  • moduleName – the name of the module represented by this object

setNeedsAttention

public void setNeedsAttention(boolean needsAttention)

Sets whether this module needs attention - meaning it requires a UI notification pointing to it.

Parameters:
  • needsAttention – true if the module needs attention, false otherwise

setResourcePath

public void setResourcePath(String resourcePath)
Parameters:
  • resourcePath – the path of the module’s static resources

setRestDocsPath

public void setRestDocsPath(String restDocsPath)

Sets the path to the REST API specification for this module. This file will be used for generating a Swagger UI for the API.

Parameters:
  • restDocsPath – the path to REST API specification for this module

setRoleForAccess

public void setRoleForAccess(String role)

Sets a permission name required to access this module - used to hide its menus on the UI. This module should be exposed only if the user has this permissions.

Parameters:
  • role – the permission required for accessing the module

setRoleForAccess

public void setRoleForAccess(List<String> roles)

Sets the permission names required to access this module - used to hide its menus on the UI. This module should be exposed only if the user has at least one of these permissions.

Parameters:
  • roles – the permissions required for accessing the module

setSettingsURL

public void setSettingsURL(String settingsURL)

Sets the settings url for this module. This is used for linking to the custom settings page for a module in the admin UI instead of generating a UI for the settings.

Parameters:
  • settingsURL – the path to the custom setting page for this module

setSubMenu

public void setSubMenu(Map<String, SubmenuInfo> subMenu)

Sets the list of sub-menus for this module.

Parameters:
  • subMenu – a map where the keys are the names of the sub-menus and values are their representations

setTabAccessMap

public void setTabAccessMap(Map<String, List<String>> tabAccessMap)

Sets the map available tabs for specified permissions for this module.

Parameters:
  • tabAccessMap – a map, where the keys are tabs names and values are lists of permissions for which the tab is available

setUrl

public void setUrl(String url)
Parameters:
  • url – the url for accessing this module