org.opencms.workplace.explorer.menu
Class CmsMenuRuleTranslator

java.lang.Object
  extended by org.opencms.workplace.explorer.menu.CmsMenuRuleTranslator

public class CmsMenuRuleTranslator
extends java.lang.Object

Provides methods to translate the legacy rule Strings for the context menu entries to the new menu rule set definitions.

Since:
6.5.6
Version:
$Revision: 1.6 $
Author:
Andreas Zahner

Constructor Summary
CmsMenuRuleTranslator()
          Empty constructor.
 
Method Summary
 CmsMenuRule createMenuRule(java.lang.String legacyRules)
          Creates a new menu rule set from the given legacy rule String.
 java.lang.String getMenuRuleName(java.lang.String legacyRules)
          Returns the name of the matching default rule set definition for the given legacy rule String.
protected  java.util.Map getRuleMappings()
          Returns the mappings of the legacy rule Strings to the default menu rule set names.
 boolean hasMenuRule(java.lang.String legacyRules)
          Returns if a matching default rule set definition is present for the given legacy rule String.
protected  java.lang.String substituteLegacyRules(java.lang.String legacyRules)
          Removes all whitespaces from the given legacy rule String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsMenuRuleTranslator

public CmsMenuRuleTranslator()
Empty constructor.

Method Detail

createMenuRule

public CmsMenuRule createMenuRule(java.lang.String legacyRules)
Creates a new menu rule set from the given legacy rule String.

Parameters:
legacyRules - the legacy rule String to parse
Returns:
a menu rule set from the given legacy rule String

getMenuRuleName

public java.lang.String getMenuRuleName(java.lang.String legacyRules)
Returns the name of the matching default rule set definition for the given legacy rule String.

If no matching rule set can be found, null is returned.

Parameters:
legacyRules - the legacy rule String
Returns:
the name of the matching default rule set definition for the given legacy rule String

hasMenuRule

public boolean hasMenuRule(java.lang.String legacyRules)
Returns if a matching default rule set definition is present for the given legacy rule String.

Parameters:
legacyRules - the legacy rule String
Returns:
true if a matching default rule set definition is present for the given legacy rule String, otherwise false

getRuleMappings

protected java.util.Map getRuleMappings()
Returns the mappings of the legacy rule Strings to the default menu rule set names.

Returns:
the mappings of the legacy rule Strings to the default menu rule set names

substituteLegacyRules

protected java.lang.String substituteLegacyRules(java.lang.String legacyRules)
Removes all whitespaces from the given legacy rule String.

Parameters:
legacyRules - the legacy rule String to substitute
Returns:
the legacy rule String without whitespaces