Class ConfigurableMenuService
- java.lang.Object
-
- com.netgrif.application.engine.workflow.service.ConfigurableMenuService
-
- All Implemented Interfaces:
IConfigurableMenuService
@Service public class ConfigurableMenuService extends java.lang.Object implements IConfigurableMenuService
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
GLOBAL_ROLE
-
Constructor Summary
Constructors Constructor Description ConfigurableMenuService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,I18nString>
addSelectedRoles(MultichoiceMapField addedRoles, EnumerationMapField processField, MultichoiceMapField rolesAvailable)
Constructs a map that can be used as a value for anyMapOptionsField
.java.util.Map<java.lang.String,I18nString>
getAvailableRolesFromNet(EnumerationMapField processField, MultichoiceMapField permittedRoles, MultichoiceMapField bannedRoles)
Constructs a map that can be used as a value for anyMapOptionsField
.java.util.Map<java.lang.String,I18nString>
getNetsByAuthorAsMapOptions(IUser author, java.util.Locale locale)
Constructs a map that can be used as a value for anyMapOptionsField
.java.util.Map<java.lang.String,I18nString>
removeSelectedRoles(MultichoiceMapField mapField)
Constructs a map that can be used as a value for anyMapOptionsField
.
-
-
-
Field Detail
-
GLOBAL_ROLE
protected final java.lang.String GLOBAL_ROLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getNetsByAuthorAsMapOptions
public java.util.Map<java.lang.String,I18nString> getNetsByAuthorAsMapOptions(IUser author, java.util.Locale locale)
Constructs a map that can be used as a value for anyMapOptionsField
. The map will contain strings related to process nets authored by the provided user. A key of the map is a string of the form "<net identifier>:<net version>". The version portion of the string uses the dash (-) character to separate the major, minor a patch version numbers instead of the traditional dot character. A value of the map is anI18nString
with no translations of the form "<net identifier> : <net version>". The default value of the net title is used.- Specified by:
getNetsByAuthorAsMapOptions
in interfaceIConfigurableMenuService
- Parameters:
author
- currently logged user- Returns:
- an options map containing the identifiers and version of nets authored by the provided user as keys and their titles and versions as values
-
getAvailableRolesFromNet
public java.util.Map<java.lang.String,I18nString> getAvailableRolesFromNet(EnumerationMapField processField, MultichoiceMapField permittedRoles, MultichoiceMapField bannedRoles)
Constructs a map that can be used as a value for anyMapOptionsField
.The map will contain roles from the net selected in the provided field, that are not present in either of the provided multichoice fields.
A key of the map is a string of the form "<role identifier>:<net identifier>"
A value of the map is the role title.
- Specified by:
getAvailableRolesFromNet
in interfaceIConfigurableMenuService
- Parameters:
processField
- the value of the field determines the process whose roles are put into the result. The options key must match the format generated by thegetNetsByAuthorAsMapOptions(IUser, Locale)
methodpermittedRoles
- the roles selected in this multichoice will not be present in the result. The option keys of this multichoice must match the format returned by this methodbannedRoles
- the roles selected in this multichoice will not be present in the result. The option keys of this multichoice must match the format returned by this method- Returns:
- an options map containing the role and net identifiers as keys and the role titles as values
-
removeSelectedRoles
public java.util.Map<java.lang.String,I18nString> removeSelectedRoles(MultichoiceMapField mapField)
Constructs a map that can be used as a value for anyMapOptionsField
. The map will contain all the options from the input field except for those that are selected in the input field.- Specified by:
removeSelectedRoles
in interfaceIConfigurableMenuService
- Parameters:
mapField
- a map field whose value complement we want to get- Returns:
- a map containing all the deselected options of the provided field
-
addSelectedRoles
public java.util.Map<java.lang.String,I18nString> addSelectedRoles(MultichoiceMapField addedRoles, EnumerationMapField processField, MultichoiceMapField rolesAvailable)
Constructs a map that can be used as a value for anyMapOptionsField
. The map will contain a union of the options that are already present in theaddedRoles
field with the options selected in therolesAvailable
field. The keys remain unchanged. The values of the map are a combination of the options from theaddedRoles
field (they remain unchanged) and new values corresponding to the new keys from therolesAvailable
field. The new values are of the form "<original value> (<net title>)"- Specified by:
addSelectedRoles
in interfaceIConfigurableMenuService
- Parameters:
addedRoles
- a field containing the preexisting options. The options of this field are assumed to be generated by this method.processField
- a field containing the information about the selected process. The options of this field are assumed to be generated by thegetNetsByAuthorAsMapOptions(IUser, Locale)
methodrolesAvailable
- a field containing the selection of the new roles. The options of this field are assumed to be generated by thegetAvailableRolesFromNet(EnumerationMapField, MultichoiceMapField, MultichoiceMapField)
method- Returns:
- a map containing a quasi-union of the options from the
addedRoles
androlesAvailable
fields
-
-