OBEROn SDK

com.oberon.ooql.sdk
Class Menu

java.lang.Object
  extended by com.oberon.ooql.sdk.OBBase
      extended by com.oberon.ooql.sdk.AdminBase
          extended by com.oberon.ooql.sdk.Menu
All Implemented Interfaces:
java.io.Serializable

public class Menu
extends AdminBase
implements java.io.Serializable

Menu Admin Object: defines menu structures for web/client applications

Version:
5.0
See Also:
Serialized Form

Field Summary
static int APPLICATION_OPTION
          The Application flag index inside the Option Set
static int PORTFOLIO_OPTION
          The Portfolio flag index inside the Option Set
 
Fields inherited from class com.oberon.ooql.sdk.AdminBase
bsOptions, HIDDEN_OPTION
 
Constructor Summary
Menu()
           
Menu(java.lang.String name)
           
 
Method Summary
 void addCommand(java.lang.String commandName)
          Add(append) a Command
 void addCommandAfter(java.lang.String commandName, java.lang.String refChild)
          Add a Command after a reference sub-Menu or command
 void addCommandBefore(java.lang.String commandName, java.lang.String refChild)
          Add a Command before a reference sub-Menu or command
 void addSubMenu(java.lang.String menuName)
          Add(append) a sub-Menu
 void addSubMenuAfter(java.lang.String menuName, java.lang.String refChild)
          Add a sub-Menu after a reference sub-Menu or Command
 void addSubMenuBefore(java.lang.String menuName, java.lang.String refChild)
          Add a sub-Menu before a reference sub-Menu or Command
 java.lang.String compareUpdate(Menu refMenu, boolean checkImage, boolean overwrite, boolean force, Framework framework)
          Return/apply the OOQL command to update this Menu object and let it become equals to another reference object.
 void create(boolean force, Framework framework)
          Create a new Menu object on the database
 void create(Framework framework)
          Create a new Menu object on the database
 void destroy(Framework framework)
          Remove the Menu object from the database.
 void fromXML(org.jdom.Element rootElement)
          Load the Menu object from XML element tree
 java.util.Vector<java.lang.String> getActionNames(java.util.Vector<java.lang.Object> filterArgs, Framework framework)
          Get the available MenuItems according to framework user rights
 java.util.Vector<MenuItem> getActions(java.util.Vector<java.lang.Object> filterArgs, Framework framework)
          Get the available MenuItems according to framework user rights
 java.lang.String getAlt()
          Get the Menu tip (html alt).
static java.util.Vector<java.lang.String> getApplications(Framework framework)
          Get all application Menus
 java.util.Vector<java.lang.String> getCommands(Framework framework)
          Get all sub-Commands
 java.lang.String getCommandsAsString(java.lang.String delim, Framework framework)
          Get all sub-Command names as string
 java.lang.String getCreateCommand(boolean force)
          Return the OOQL command to create this Menu object with the settled properties
 java.lang.String getHRef()
          Get the web page link
 java.lang.String getLabel()
          Get the Menu label.
 java.util.Vector<java.lang.String> getOwnChilds()
          Get own Childs.
 java.lang.String getOwnChildsAsString(java.lang.String delim)
          Get own child (sub-Menu and Command) names as string.
 java.util.Vector<java.lang.String> getOwnCommands()
          Get own sub Commands
 java.lang.String getOwnCommandsAsString(java.lang.String delim)
          Get own Command names as string
 java.util.Vector<java.lang.String> getOwnSubMenus()
          Get own sub-Menus
 java.lang.String getOwnSubMenusAsString(java.lang.String delim)
          Get own sub-Menu names as string
 java.lang.String getProperty(java.lang.String propertyName, java.util.Vector<java.lang.Object> filterArgs, java.lang.String token, Framework framework)
          Get a property for this Menu object by its OOQL identifier
 java.lang.String getSaveCommand(boolean force)
          Return the OOQL command to update this Menu object with the modified properties.
 java.util.Vector<java.lang.String> getSubMenus(Framework framework)
          Get all sub Menus
 java.lang.String getSubMenusAsString(java.lang.String delim, Framework framework)
          Get all sub-Menu names as string
 java.util.Vector<java.lang.String> getSuperMenus(Framework framework)
          Get all parent Menus
 java.lang.String getSuperMenusAsString(java.lang.String delim, Framework framework)
          Get all parent Menus as string
 java.util.Vector<?> getTargetNames(java.lang.String composedName, java.util.Vector<java.lang.Object> filterArgs, Framework framework)
          Return a Vector of administrative object names extracted by using an OOQL selector
 boolean isApplication()
          Check if the Menu is an application.
 boolean isPortfolio()
          Check if the Menu is a portfolio (set of applications)
 void link(Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Open the Menu object: connect the memory instance with the database instance
 void moveCommand(java.lang.String commandName, boolean after)
          Move a Command
 void moveSubMenu(java.lang.String menuName, boolean after)
          Move a sub-Menu
static Menu open(java.lang.String name, Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Open an administrative object and read properties from the database or retrieve them from memory
 void removeCommand(java.lang.String commandName)
          Remove a Command
 void removeSubMenu(java.lang.String menuName)
          Remove a sub-Menu
 void setAlt(java.lang.String altTip)
          Set the Menu tip (html alt).
 void setApplication(boolean applicationFlag)
          Set the application flag for this Menu.
 void setHRef(java.lang.String url)
          Set the web page link for this Menu.
 void setLabel(java.lang.String label)
          Set the Menu label.
 void setPortfolio(boolean portfolioFlag)
          Set the portfolio flag for this Menu.
 java.lang.String toString()
          Return the Menu object basic properties as a single String
 java.lang.String toString(Framework framework)
          Return the Menu object extended properties as a single String
 org.jdom.Element toXML(boolean getImage, boolean fullDump, Framework framework)
          Return the Menu object properties as XML element tree
 org.jdom.Element toXML(Framework framework)
          Return the Menu object properties as XML element tree
 void unlink(Framework framework)
          Close the object: disconnect the memory instance from the database instance
 void updateChilds(java.util.Vector<java.lang.String> childs)
          Update the submenus / commands on the basis of a given list
 void write(boolean force, Framework framework)
          Update the Menu object to the database
 void write(Framework framework)
          Update the Menu object to the database
 
Methods inherited from class com.oberon.ooql.sdk.AdminBase
addFeature, changedApplication, checkChangeName, checkCounters, checkCounters, getAdminType, getApplication, getCommonProperty, getCommonTargetNames, getCounters, getCreateBasicCommand, getCreateCommand, getCrtDate, getDescription, getEditBasicCommand, getFeature, getFeatures, getFeaturesAsString, getImage, getImage, getImage, getImageData, getImageFile, getModDate, getModUser, getName, getOldName, getPlainFeatures, getSaveCommand, getSVNRevision, getXMLFeatureList, hasImage, isHidden, setApplication, setCounters, setCrtDate, setDescription, setHidden, setImage, setImageData, setImageFile, setModDate, setModUser, setName, setSVNRevision, show, show, toCommonXML, toXML
 
Methods inherited from class com.oberon.ooql.sdk.OBBase
addChange, addUniqueChange, ChangesFromXML, ChangesToXML, getChanges, getChangesAsString, getId, isLinked, removeChange, resetChanges, setId, setLinked
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

APPLICATION_OPTION

public static final int APPLICATION_OPTION
The Application flag index inside the Option Set

See Also:
Constant Field Values

PORTFOLIO_OPTION

public static final int PORTFOLIO_OPTION
The Portfolio flag index inside the Option Set

See Also:
Constant Field Values
Constructor Detail

Menu

public Menu()

Menu

public Menu(java.lang.String name)
     throws OberonException
Parameters:
name - the name of the administrative object
Throws:
OberonException - if the name contains invalid characters
Method Detail

open

public static Menu open(java.lang.String name,
                        Framework framework,
                        java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
                 throws OberonException
Open an administrative object and read properties from the database or retrieve them from memory

Parameters:
name - the object name
framework - the current framework
counters - administrative object synch counters (if null read them from database)
Throws:
OberonException - usually due to DB SQL exceptions

link

public void link(Framework framework,
                 java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          throws OberonException
Open the Menu object: connect the memory instance with the database instance

Specified by:
link in class AdminBase
Parameters:
framework - the current framework
counters - administrative object synch counters (if null read them from database)
Throws:
OberonException - usually due to DB SQL exceptions

create

public void create(Framework framework)
            throws OberonException
Create a new Menu object on the database

Specified by:
create in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

create

public void create(boolean force,
                   Framework framework)
            throws OberonException
Create a new Menu object on the database

Parameters:
force - if true ignores optional features
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights
Since:
1.6

write

public void write(Framework framework)
           throws OberonException
Update the Menu object to the database

Specified by:
write in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

write

public void write(boolean force,
                  Framework framework)
           throws OberonException
Update the Menu object to the database

Parameters:
force - if true ignores optional features
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights
Since:
1.6

unlink

public void unlink(Framework framework)
            throws OberonException
Close the object: disconnect the memory instance from the database instance

Specified by:
unlink in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

destroy

public void destroy(Framework framework)
             throws OberonException
Remove the Menu object from the database.

Specified by:
destroy in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

setApplication

public void setApplication(boolean applicationFlag)
Set the application flag for this Menu.

Parameters:
applicationFlag - true to define the Menu as application
Since:
1.5 (build 0048)

isApplication

public boolean isApplication()
Check if the Menu is an application.

Returns:
the application flag
Since:
1.5 (build 0048)

setPortfolio

public void setPortfolio(boolean portfolioFlag)
Set the portfolio flag for this Menu.

Parameters:
portfolioFlag - true to define the Menu as portfolio (set of applications)
Since:
4.1

isPortfolio

public boolean isPortfolio()
Check if the Menu is a portfolio (set of applications)

Returns:
the portfolio flag
Since:
4.1

setHRef

public void setHRef(java.lang.String url)
Set the web page link for this Menu. HTTP parameters can be added as Menu Features

Parameters:
url - the http url (example: /myfolder/mypage.jsp)

getHRef

public java.lang.String getHRef()
Get the web page link

Returns:
the page link

setAlt

public void setAlt(java.lang.String altTip)
Set the Menu tip (html alt).

Parameters:
altTip - the alt tip

getAlt

public java.lang.String getAlt()
Get the Menu tip (html alt).

Returns:
the alt tip

setLabel

public void setLabel(java.lang.String label)
Set the Menu label.

Parameters:
label - the label value

getLabel

public java.lang.String getLabel()
Get the Menu label.

Returns:
the label value

getSubMenus

public java.util.Vector<java.lang.String> getSubMenus(Framework framework)
Get all sub Menus

Returns:
Vector of Menu elements

getSubMenusAsString

public java.lang.String getSubMenusAsString(java.lang.String delim,
                                            Framework framework)
Get all sub-Menu names as string

Parameters:
delim - the name separator
framework - the current framework

addSubMenu

public void addSubMenu(java.lang.String menuName)
Add(append) a sub-Menu

Parameters:
menuName - the sub-Menu name

addSubMenuBefore

public void addSubMenuBefore(java.lang.String menuName,
                             java.lang.String refChild)
                      throws OberonException
Add a sub-Menu before a reference sub-Menu or Command

Parameters:
menuName - the sub-Menu name
refChild - the reference sub-Menu or Command name
Throws:
OberonException - when the reference sub-Menu or Command is not found

addSubMenuAfter

public void addSubMenuAfter(java.lang.String menuName,
                            java.lang.String refChild)
                     throws OberonException
Add a sub-Menu after a reference sub-Menu or Command

Parameters:
menuName - the sub-Menu name
refChild - the reference sub-Menu or Command name
Throws:
OberonException - when the reference sub-Menu or Command is not found

moveSubMenu

public void moveSubMenu(java.lang.String menuName,
                        boolean after)
Move a sub-Menu

Parameters:
menuName - the sub-Menu name
after - if true move the sub-Menu after else move it before the current position

removeSubMenu

public void removeSubMenu(java.lang.String menuName)
Remove a sub-Menu


getOwnSubMenus

public java.util.Vector<java.lang.String> getOwnSubMenus()
Get own sub-Menus

Returns:
Vector of Menu names

getOwnSubMenusAsString

public java.lang.String getOwnSubMenusAsString(java.lang.String delim)
Get own sub-Menu names as string

Parameters:
delim - the name separator

getCommands

public java.util.Vector<java.lang.String> getCommands(Framework framework)
Get all sub-Commands

Returns:
Vector of Command elements

getCommandsAsString

public java.lang.String getCommandsAsString(java.lang.String delim,
                                            Framework framework)
Get all sub-Command names as string

Parameters:
delim - the name separator
framework - the current framework

addCommand

public void addCommand(java.lang.String commandName)
Add(append) a Command

Parameters:
commandName - the Command name

addCommandBefore

public void addCommandBefore(java.lang.String commandName,
                             java.lang.String refChild)
                      throws OberonException
Add a Command before a reference sub-Menu or command

Parameters:
commandName - the Command name
refChild - the reference sub-Menu or Command name
Throws:
OberonException - when the reference sub-Menu or Command is not found

addCommandAfter

public void addCommandAfter(java.lang.String commandName,
                            java.lang.String refChild)
                     throws OberonException
Add a Command after a reference sub-Menu or command

Parameters:
commandName - the Command name
refChild - the reference sub-Menu or Command name
Throws:
OberonException - when the reference sub-Menu or Command is not found

moveCommand

public void moveCommand(java.lang.String commandName,
                        boolean after)
Move a Command

Parameters:
commandName - the Command name
after - if true move the Command after else move it before the current position

removeCommand

public void removeCommand(java.lang.String commandName)
Remove a Command


getOwnCommands

public java.util.Vector<java.lang.String> getOwnCommands()
Get own sub Commands

Returns:
Vector of Command names

getOwnCommandsAsString

public java.lang.String getOwnCommandsAsString(java.lang.String delim)
Get own Command names as string

Parameters:
delim - the name separator

updateChilds

public void updateChilds(java.util.Vector<java.lang.String> childs)
Update the submenus / commands on the basis of a given list

Parameters:
childs - list of Menu/Command's names (menu names start with "+")
Since:
4.0

getOwnChilds

public java.util.Vector<java.lang.String> getOwnChilds()
Get own Childs.

Returns:
Vector of Command names (the sub-Menu names start with "+" character)

getOwnChildsAsString

public java.lang.String getOwnChildsAsString(java.lang.String delim)
Get own child (sub-Menu and Command) names as string. The sub-Menu names start with "+" character

Parameters:
delim - the name separator

getActions

public java.util.Vector<MenuItem> getActions(java.util.Vector<java.lang.Object> filterArgs,
                                             Framework framework)
                                      throws OberonException
Get the available MenuItems according to framework user rights

Parameters:
filterArgs - extra arguments used to compute the available actions
framework - the current framework
Returns:
vector of MenuItem elements
Throws:
OberonException
Since:
4.0.3

getActionNames

public java.util.Vector<java.lang.String> getActionNames(java.util.Vector<java.lang.Object> filterArgs,
                                                         Framework framework)
                                                  throws OberonException
Get the available MenuItems according to framework user rights

Parameters:
filterArgs - extra arguments used to compute the available actions
framework - the current framework
Returns:
vector of MenuItem names - prefixed with level number
Throws:
OberonException
Since:
4.0.3

getSuperMenus

public java.util.Vector<java.lang.String> getSuperMenus(Framework framework)
Get all parent Menus

Returns:
Vector of Menu names

getSuperMenusAsString

public java.lang.String getSuperMenusAsString(java.lang.String delim,
                                              Framework framework)
Get all parent Menus as string

Parameters:
delim - the Menu name separator

getApplications

public static java.util.Vector<java.lang.String> getApplications(Framework framework)
Get all application Menus

Returns:
Vector of Menu elements

getProperty

public java.lang.String getProperty(java.lang.String propertyName,
                                    java.util.Vector<java.lang.Object> filterArgs,
                                    java.lang.String token,
                                    Framework framework)
Get a property for this Menu object by its OOQL identifier

Specified by:
getProperty in class OBBase
Parameters:
propertyName - OOQL property identifier/name (example: href , command ...)
filterArgs - extra arguments used to compute properties
token - separator token for complex properties
framework - the current framework
Returns:
the property value

getTargetNames

public java.util.Vector<?> getTargetNames(java.lang.String composedName,
                                          java.util.Vector<java.lang.Object> filterArgs,
                                          Framework framework)
Return a Vector of administrative object names extracted by using an OOQL selector

Specified by:
getTargetNames in class OBBase
Parameters:
composedName - OOQL property identifier/name (example: command, ownsubmenu, .. )
filterArgs - extra arguments used to compute properties
framework - the current framework
Returns:
a Vector of target names, used to extract their (sub)properties values

toString

public java.lang.String toString()
Return the Menu object basic properties as a single String

Overrides:
toString in class AdminBase

toString

public java.lang.String toString(Framework framework)
Return the Menu object extended properties as a single String

Overrides:
toString in class AdminBase
Parameters:
framework - the current framework

toXML

public org.jdom.Element toXML(Framework framework)
Return the Menu object properties as XML element tree

Specified by:
toXML in class AdminBase
Parameters:
framework - the current framework

toXML

public org.jdom.Element toXML(boolean getImage,
                              boolean fullDump,
                              Framework framework)
Return the Menu object properties as XML element tree

Specified by:
toXML in class AdminBase
Parameters:
getImage - true to include "imagedata" element with the base64 encoded image data
fullDump - true to include detailed information
framework - the current framework

fromXML

public void fromXML(org.jdom.Element rootElement)
Load the Menu object from XML element tree

Overrides:
fromXML in class AdminBase

getCreateCommand

public java.lang.String getCreateCommand(boolean force)
Return the OOQL command to create this Menu object with the settled properties

Specified by:
getCreateCommand in class AdminBase
Parameters:
force - if true append the "force" options at the end

getSaveCommand

public java.lang.String getSaveCommand(boolean force)
Return the OOQL command to update this Menu object with the modified properties.
If the object is new, it returns the create command.

Specified by:
getSaveCommand in class AdminBase
Parameters:
force - if true append the "force" options at the end

compareUpdate

public java.lang.String compareUpdate(Menu refMenu,
                                      boolean checkImage,
                                      boolean overwrite,
                                      boolean force,
                                      Framework framework)
                               throws OberonException
Return/apply the OOQL command to update this Menu object and let it become equals to another reference object.
This method is useful to import objects from an XML file.

Parameters:
refMenu - the reference Menu object
checkImage - if true compare also the image icon
overwrite - if true update the database object instance
force - if true ignores optional properties
framework - the current framework
Throws:
OberonException
See Also:
fromXML(Element)

OBEROn SDK

Copyright © 2008-2014 Mirko Solazzi. All Rights Reserved.