Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.knowgate.hipergate
Class MenuOption

    java.lang.Object
      com.knowgate.hipergate.MenuOption

    public class MenuOption

extends java.lang.Object

hipergate menu option JiBX handler

Constructor Summary
`MenuOption()` Default constructor

Method Summary
`int` | `countSubOptions()` Get count of suboptions
`boolean` | `getAccess()` Get if a user must see this menu option Access is an externaly set flag to signal whether or not a user can see this menu option, access is not set at the XML configuration file, but usually set by calling hasAccess()
`int` | `getBitMask()` Get permissions mask encoded as a 32bit integer
`java.lang.String` | `getForbid()` Get menu option alternative href used when a user has not enought permissions to access standard href.
`java.lang.String` | `getHRef()` Get menu option href
`java.lang.Object` | `getMask()` Get this option permissions mask The mask is an Integer value between 0 and 31 or an ArrayList of Integer values or a String either "admin" or "owner"
`java.lang.String` | `getName()` Get this option name
`boolean` | `getSelected()`
`MenuOption` | `getSubOption(int nIndex)` Get suboption
`MenuOption` | `getSubOption(java.lang.String sName)` Get suboption by name
`java.lang.String` | `getTitle()` Get menu option title
`boolean` | `hasAccess(int iAppMask, boolean bAdmin, boolean bOwner)` Determine access to this menu option for an application mask Get whether or not a user with the given application mask and roles can access this menu option.
`void` | `selectSubOption(int nSubOption)`
`void` | `setAccess(boolean bHasAcess)` Set if a user must see this menu option
`void` | `setSelected(boolean bIsSelected)`
`java.lang.String` | `toXML()` Get XML for menu option The returned XML is like <option name="hipermail" access="false" selected="false"><mask/><title><!

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MenuOption

    public MenuOption()

  Default constructor

Method Detail

### getSubOption

    public MenuOption getSubOption(int nIndex)
                            throws java.lang.ArrayIndexOutOfBoundsException

  Get suboption

  Parameters:
    `nIndex` - int Suboption index [0..countSubOptions()-1)
  Returns:
    MenuOption
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if n<0 or n>=countSubOptions()

### getSubOption

    public MenuOption getSubOption(java.lang.String sName)
                            throws java.lang.ArrayIndexOutOfBoundsException

  Get suboption by name

  Parameters:
    `sname` - String Suboption name
  Returns:
    MenuOption
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if no option with such name was found

### countSubOptions

    public int countSubOptions()

  Get count of suboptions

  Returns:
    int

### getName

    public java.lang.String getName()

  Get this option name

  Returns:
    String

### getMask

    public java.lang.Object getMask()
                             throws java.lang.NumberFormatException

  Get this option permissions mask

  The mask is an Integer value between 0 and 31 or an ArrayList of Integer values or a String either "admin" or "owner"

  Returns:
    Object May be a String (either "admin" or "owner") or an Integer or null
  Throws:
    `java.lang.NumberFormatException` - If mask value is neither "admin" nor "owner" and it is not an integer value.

### getBitMask

    public int getBitMask()

  Get permissions mask encoded as a 32bit integer

  Returns:
    int If mask is empty string or null Then return value is zero, If mask is "admin" or "owner" Then return value is -1 Else the return value is 1<

  ### hasAccess

      public boolean hasAccess(int iAppMask,
                               boolean bAdmin,
                               boolean bOwner)

    Determine access to this menu option for an application mask

    Get whether or not a user with the given application mask and roles can access this menu option. Application Masks are 32 bit integers with one bit flags per application.

    Standard application masks
    Application | Bit Position | Int Mask
    Bug Tracker | 10 | 1024
    Duty Manager | 11 | 1024
    Project Manager | 12 | 4096
    Mailwire | 13 | 8192
    Web Builder | 14 | 16384
    Virtual Disk | 15 | 32768
    Sales | 16 | 65536
    Collaborative Tools | 17 | 131072
    Marketing Tools | 18 | 262144
    Directory | 19 | 524288
    Shop | 20 | 1048576
    Hipermail | 21 | 2097152
    Training | 22 | 4194304
    Surveys | 23 | 8388608
    Configuration | 30 | 1073741824

    Parameters:
      `iAppMask` - int Application mask
      `bAdmin` - boolean true if user has administrator role
      `bOwner` - boolean true if user is owner of his WorkArea
    Returns:
      boolean true if user is administrator or owner and mask is "admin" or "owner" respectively. Or true if getBitMask() bitwise-and iAppMask is not zero (getBitMask()&iAppMask!=0).

  ### getTitle

      public java.lang.String getTitle()

    Get menu option title

    Returns:
      String <title> tag value or empty string if title is not set

  ### getHRef

      public java.lang.String getHRef()

    Get menu option href

    Returns:
      String <href> tag value or empty string if href is not set

  ### getForbid

      public java.lang.String getForbid()

    Get menu option alternative href used when a user has not enought permissions to access standard href. Whether to use href or forbid must be determined by the caller program at runtime.

    Returns:
      String <forbid> tag value or empty string if forbid is not set

  ### getAccess

      public boolean getAccess()

    Get if a user must see this menu option

    Access is an externaly set flag to signal whether or not a user can see this menu option, access is not set at the XML configuration file, but usually set by calling hasAccess()

    Returns:
      boolean
    Since:
      4.0

  ### setAccess

      public void setAccess(boolean bHasAcess)

    Set if a user must see this menu option

    Parameters:
      `boolean` -
    Since:
      4.0

  ### getSelected

      public boolean getSelected()

  ### setSelected

      public void setSelected(boolean bIsSelected)

  ### selectSubOption

      public void selectSubOption(int nSubOption)

  ### toXML

      public java.lang.String toXML()

    Get XML for menu option

    The returned XML is like <option name="hipermail" access="false" selected="false"><mask/><title><![CDATA[e-mail]]></title><href>../hipermail/mail_top_f.htm?selected=1&subselected=0</href><forbid><![CDATA[javascript:alert('e-mail is disabled, please edit hipergate.cnf for activating it')]]></forbid><suboptions/></option>

    Returns:
      String
    Since:
      4.0

  Overview | Package | Class | Tree | Deprecated | Index | Help
  PREV CLASS NEXT CLASS | FRAMES NO FRAMES
  SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD