public class MenuOption
extends java.lang.Object
Constructor and Description |
---|
MenuOption()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
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><!
|
public MenuOption getSubOption(int nIndex) throws java.lang.ArrayIndexOutOfBoundsException
nIndex
- int Suboption index [0..countSubOptions()-1)java.lang.ArrayIndexOutOfBoundsException
- if n<0 or n>=countSubOptions()public MenuOption getSubOption(java.lang.String sName) throws java.lang.ArrayIndexOutOfBoundsException
sname
- String Suboption namejava.lang.ArrayIndexOutOfBoundsException
- if no option with such name was foundpublic int countSubOptions()
public java.lang.String getName()
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"java.lang.NumberFormatException
- If mask value is neither "admin" nor "owner" and it is
not an integer value.public int getBitMask()
Get permissions mask encoded as a 32bit integer
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 |
iAppMask
- int Application maskbAdmin
- boolean true if user has administrator rolebOwner
- boolean true if user is owner of his WorkAreapublic java.lang.String getTitle()
public java.lang.String getHRef()
public java.lang.String getForbid()
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()public void setAccess(boolean bHasAcess)
Set if a user must see this menu option
boolean
- public boolean getSelected()
public void setSelected(boolean bIsSelected)
public void selectSubOption(int nSubOption)
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>