public class EnhancedBrowseConfigManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
EnhancedBrowseConfigManager.BrowseLayoutChangeRights
Possible states of "change browse layout" parameter.
|
Modifier and Type | Field and Description |
---|---|
private static EnhancedBrowseSaveTarget[] |
ADMIN_SAVE_TARGETS
Save targets for an admin user.
|
private java.util.Set<java.lang.String> |
adminAccounts
Set of accounts that can manage enhanced configurations applicable to all users (i.e.
|
private boolean |
applyLayout
true if browse layout saved in the directory is applied on start up. |
private EnhancedBrowseConfigManager.BrowseLayoutChangeRights |
changeLayout
Defines user groups that have the ability to change layout of a browse.
|
private static java.lang.String |
COLUMNS_NODE
Root node for column configurations.
|
private java.util.Map<EhBrowseConfigKey,EnhancedBrowseConfig> |
configs
Enhanced configurations.
|
private java.util.concurrent.locks.ReadWriteLock |
configsLock
Lock for reading and modifying configurations.
|
private static int |
DESKTOP
In this mode the (also known as compatibility mode) most or all FWD specific features are
disabled.
|
private static int |
EMBEDDED
In this mode the FWD specific features are usually available.
|
private boolean |
enableAll
true to enable all of enhanced browse functionality. |
private static java.lang.String |
ENHANCED_COL_CONFIG_CLASS
In-directory column configuration class.
|
private static java.lang.String |
ENHANCED_CONFIG_CLASS
In-directory browse configuration class.
|
private static java.lang.String |
ENHANCED_CONFIGURATIONS_NODE
Root node for enhanced configurations.
|
private boolean |
enhancedFiltering
true if enhanced filtering is enabled. |
private boolean |
enhancedSorting
true if enhanced sorting is enabled. |
private boolean |
exporting
true if exporting to PDF/CSV/XLS/XLSX from browse is enabled. |
private boolean |
hyperlinking
true if hyperlinks in browse columns are enabled. |
private static EnhancedBrowseConfigManager[] |
instances
Manager instances.
|
private static ContextLocal<java.lang.Boolean> |
isAdmin
Caches if the current user is an admin.
|
private static java.util.logging.Logger |
LOG
Logger
|
private int |
maxNodeId
Maximum existing directory node ID.
|
private static java.lang.String[] |
MODE_SUBTREE
The node name of subtree of each setting set for each mode.
|
private static EnhancedBrowseSaveTarget[] |
NON_ADMIN_SAVE_TARGETS
Save targets for non-admin user.
|
private static java.lang.String |
ROOT_PATTERN
Pattern of the root node for enhanced settings/configurations.
|
private java.lang.String |
rootNode
Root node for enhanced settings/configurations.
|
Modifier | Constructor and Description |
---|---|
private |
EnhancedBrowseConfigManager(int mode)
The private constructor initialize manager: read enhanced configurations from the directory
according to specified
compatibilityMode . |
Modifier and Type | Method and Description |
---|---|
private void |
cacheClientConfigs(BrowseKey configKey)
Get from the client side "target browse, current user" and "all browses, current user"
configurations, if they are not cached, and cache them.
|
boolean |
canChangeLayout()
Returns
true if ability to change layout of a browse is enabled. |
private boolean |
checkDirectoryAvailable()
Check if the configuration directory can be bound and user has enough permissions to write
an enhanced browse configuration into it.
|
private ColorRgb |
decodeColor(java.lang.String colorString)
Convert string representation of the color into the
ColorRgb object. |
private FontDetails |
decodeFont(java.lang.String fontString)
Convert string representation of the font into the
FontDetails object. |
private java.lang.String |
encodeColor(ColorRgb color)
Convert
ColorRgb object into its string representation. |
private java.lang.String |
encodeFont(FontDetails font)
Convert font into its string representation.
|
private boolean |
getBoolConfigParameter(DirectoryService ds,
java.lang.String name)
Get the value of the configuration parameter.
|
private Attribute[] |
getBrowseConfigNodeAttrs(DirectoryService ds,
EnhancedBrowseConfig config)
Get the enhanced browse configuration as an array of directory attributes.
|
private EnhancedBrowseConfig |
getCachedEnhancedConfig(java.lang.String userId,
BrowseKey configKey)
Get an enhanced configuration from the cache.
|
private Attribute[] |
getColumnConfigNodeAttrs(DirectoryService ds,
java.lang.String columnKey,
EnhancedColumnConfig columnConfig)
Get the enhanced column configuration as an array of directory attributes.
|
EnhancedBrowseSaveTarget[] |
getEnhancedBrowseResetTargets(BrowseKey configKey,
BrowseWidget browse)
Get enhanced browse configuration reset targets available for the target browse and the
current user.
|
EnhancedBrowseSaveTarget[] |
getEnhancedBrowseSaveTargets(BrowseWidget browse)
Get save targets for an enhanced browse configuration, which are available for the current
user and the given browse.
|
EnhancedBrowseConfig |
getEnhancedConfig(BrowseKey configKey,
boolean disableEhConfigEdit)
Get for the specified browse an enhanced configuration from the cache.
|
static EnhancedBrowseConfigManager |
getInstance()
Get instance of this manager appropriate to the compatibility mode the client is running.
|
private EnhancedBrowseConfigManager.BrowseLayoutChangeRights |
getRightsConfigParameter(DirectoryService ds,
java.lang.String name)
Get the value of the configuration parameter which is of
EnhancedBrowseConfigManager.BrowseLayoutChangeRights
type. |
private boolean |
isContainerNode(DirectoryService ds,
java.lang.String node)
Check is the given directory node is a container node.
|
boolean |
isEnhancedFiltering()
Returns
true if enhanced filtering is enabled. |
boolean |
isEnhancedSorting()
Returns
true if enhanced sorting is enabled. |
boolean |
isExporting()
Returns
true if exporting to PDF/CSV/XLS/XLSX from a browse is enabled. |
boolean |
isHyperlinking()
Returns
true if hyperlinks in browse columns are enabled. |
boolean |
isLayoutApplied()
Returns
true if browse layout saved in the directory is applied on start up. |
private boolean |
isUserAdmin()
Checks if the current user is an admin user (i.e.
|
private java.lang.String |
nullify(java.lang.String str)
If the source string is
null or empty, return null . |
private void |
prepareEnhancedConfig(EnhancedBrowseConfig config,
EnhancedBrowseSaveTarget saveTarget)
Prepare an enhanced configuration for saving by setting appropriate user name, browse name,
procedure name and removing column configurations if necessary.
|
private java.util.List<EnhancedBrowseConfig> |
readConfigs(DirectoryService ds)
Read the enhanced configurations from the directory.
|
EhBrowseConfigKey |
resetEnhancedConfig(BrowseKey configKey,
EnhancedBrowseSaveTarget resetTarget)
Reset (delete) an enhanced configuration at the certain level for the browse.
|
EnhancedBrowseConfig |
saveOrCacheEnhancedConfig(EnhancedBrowseConfig config,
EnhancedBrowseSaveTarget saveTarget)
Save the enhanced browse configuration using the specified save target.
|
private static final java.util.logging.Logger LOG
private static final java.lang.String ENHANCED_CONFIGURATIONS_NODE
private static final java.lang.String COLUMNS_NODE
private static final java.lang.String ENHANCED_CONFIG_CLASS
private static final java.lang.String ENHANCED_COL_CONFIG_CLASS
private static final EnhancedBrowseSaveTarget[] ADMIN_SAVE_TARGETS
private static final EnhancedBrowseSaveTarget[] NON_ADMIN_SAVE_TARGETS
private static final java.lang.String[] MODE_SUBTREE
private static final int DESKTOP
private static final int EMBEDDED
private static final EnhancedBrowseConfigManager[] instances
private boolean enhancedSorting
true
if enhanced sorting is enabled.private boolean enhancedFiltering
true
if enhanced filtering is enabled.private boolean exporting
true
if exporting to PDF/CSV/XLS/XLSX from browse is enabled.private boolean hyperlinking
true
if hyperlinks in browse columns are enabled.private EnhancedBrowseConfigManager.BrowseLayoutChangeRights changeLayout
private boolean applyLayout
true
if browse layout saved in the directory is applied on start up. Also,
you cannot change layout if this option is false
.private boolean enableAll
true
to enable all of enhanced browse functionality.private java.util.Set<java.lang.String> adminAccounts
EnhancedBrowseSaveTarget.GLOBAL_DEFAULT
and
EnhancedBrowseSaveTarget.BROWSE_SPECIFIC_DEFAULT
).private final java.util.Map<EhBrowseConfigKey,EnhancedBrowseConfig> configs
private final java.util.concurrent.locks.ReadWriteLock configsLock
private int maxNodeId
private static final java.lang.String ROOT_PATTERN
private java.lang.String rootNode
private static final ContextLocal<java.lang.Boolean> isAdmin
private EnhancedBrowseConfigManager(int mode)
compatibilityMode
.mode
- The compatibility mode for the new instance.public static EnhancedBrowseConfigManager getInstance()
public boolean canChangeLayout()
true
if ability to change layout of a browse is enabled.
Note: Do not cache this value in a static context because it depends on the compatibility mode of the client (desktop/embedded).
public boolean isLayoutApplied()
true
if browse layout saved in the directory is applied on start up.
Also, you cannot change layout if this option is false
.
Note: Do not cache this value in a static context because it depends on the compatibility mode of the client (desktop/embedded).
public boolean isExporting()
true
if exporting to PDF/CSV/XLS/XLSX from a browse is enabled.
Note: Do not cache this value in a static context because it depends on the compatibility mode of the client (desktop/embedded).
public boolean isEnhancedSorting()
true
if enhanced sorting is enabled.
Note: Do not cache this value in a static context because it depends on the compatibility mode of the client (desktop/embedded).
public boolean isEnhancedFiltering()
true
if enhanced filtering is enabled.
Note: Do not cache this value in a static context because it depends on the compatibility mode of the client (desktop/embedded).
public boolean isHyperlinking()
true
if hyperlinks in browse columns are enabled.
Note: Do not cache this value in a static context because it depends on the compatibility mode of the client (desktop/embedded).
public EnhancedBrowseSaveTarget[] getEnhancedBrowseSaveTargets(BrowseWidget browse)
browse
- Browse, for which save targets are returned.public EnhancedBrowseSaveTarget[] getEnhancedBrowseResetTargets(BrowseKey configKey, BrowseWidget browse)
configKey
- Defines the target browse.browse
- Browse, for which reset targets are returned.public EhBrowseConfigKey resetEnhancedConfig(BrowseKey configKey, EnhancedBrowseSaveTarget resetTarget)
configKey
- Key which defines the target browse.resetTarget
- Defines the level at which the configuration will be reset.null
if there is
no configuration at this level.public EnhancedBrowseConfig getEnhancedConfig(BrowseKey configKey, boolean disableEhConfigEdit)
configKey
- Key which specifies the target browse.disableEhConfigEdit
- true
> to disable searching among Browse-Specific User configurations and User
Default configurations.null
if a
configuration hasn't been found.public EnhancedBrowseConfig saveOrCacheEnhancedConfig(EnhancedBrowseConfig config, EnhancedBrowseSaveTarget saveTarget)
config
- Enhanced browse configuration to save.saveTarget
- Save target (if configuration is applied to "all browses" / "specific browse" and
"all users" / "current user").null
on error.private Attribute[] getBrowseConfigNodeAttrs(DirectoryService ds, EnhancedBrowseConfig config)
ds
- Bound directory service.config
- Browse configuration to be processed.private Attribute[] getColumnConfigNodeAttrs(DirectoryService ds, java.lang.String columnKey, EnhancedColumnConfig columnConfig)
ds
- Bound directory service.columnKey
- Column key (added to the resulting attributes).columnConfig
- Column configuration to be processed.private java.util.List<EnhancedBrowseConfig> readConfigs(DirectoryService ds)
ds
- Bound directory service.private ColorRgb decodeColor(java.lang.String colorString)
ColorRgb
object.colorString
- String representation of the color in the format "#rrggbb".ColorRgb
object.private java.lang.String encodeColor(ColorRgb color)
ColorRgb
object into its string representation.color
- Color to convert.private java.lang.String encodeFont(FontDetails font)
font
- Font to convert.private FontDetails decodeFont(java.lang.String fontString)
FontDetails
object.fontString
- String representation of the font in the format
"font name,size,bold,italic,underline" (e.g. "dejavu sans,12,false,true,false").FontDetails
object.private java.lang.String nullify(java.lang.String str)
null
or empty, return null
.
Otherwise, the source string is returned.str
- Source string.private boolean getBoolConfigParameter(DirectoryService ds, java.lang.String name)
ds
- Bound directory service.name
- Parameter name.false
if the value of the
parameter is not set.private EnhancedBrowseConfigManager.BrowseLayoutChangeRights getRightsConfigParameter(DirectoryService ds, java.lang.String name)
EnhancedBrowseConfigManager.BrowseLayoutChangeRights
type.ds
- Bound directory service.name
- Parameter name.ENABLED_ALL_USERS
if the
value of the parameter is not set.private boolean isContainerNode(DirectoryService ds, java.lang.String node)
ds
- Bound directory service.node
- Node to check.true
if the specified node exists and it is a container node.private boolean isUserAdmin()
true
if the current user is an admin user.private EnhancedBrowseConfig getCachedEnhancedConfig(java.lang.String userId, BrowseKey configKey)
userId
- Name of the user for whom this configuration is stored. null
to get
configuration applicable to all users.configKey
- Key which specifies the target browse.null
if a
configuration wasn't found.private void cacheClientConfigs(BrowseKey configKey)
configKey
- Key which defines the target browse.private void prepareEnhancedConfig(EnhancedBrowseConfig config, EnhancedBrowseSaveTarget saveTarget)
config
- Enhanced configuration to be prepared.saveTarget
- Save target (if configuration is applied to "all browses" / "specific browse" and
"all users" / "current user").private boolean checkDirectoryAvailable()
true
on success.