biz.hammurapi.web.menu
Class Menu

java.lang.Object
  extended bybiz.hammurapi.sql.DatabaseObject
      extended bybiz.hammurapi.web.menu.sql.XmenuImpl
          extended bybiz.hammurapi.web.menu.Menu
All Implemented Interfaces:
biz.hammurapi.util.Attributable, biz.hammurapi.config.ChainedContext, java.lang.Cloneable, biz.hammurapi.sql.columns.ColumnChangeListener, biz.hammurapi.config.Context, biz.hammurapi.config.ContextConfigurable, biz.hammurapi.sql.DataAccessObject, biz.hammurapi.config.DomConfigurable, biz.hammurapi.xml.dom.DomSerializable, biz.hammurapi.sql.IDatabaseObject, biz.hammurapi.util.Observable, RequestMatcher, java.io.Serializable, biz.hammurapi.util.Versioned, biz.hammurapi.web.menu.sql.Xmenu

public class Menu
extends biz.hammurapi.web.menu.sql.XmenuImpl
implements biz.hammurapi.sql.DataAccessObject, RequestMatcher, biz.hammurapi.config.ChainedContext

See Also:
Serialized Form

Field Summary
static java.lang.String MT_FORM_HANDLER
           
static java.lang.String MT_RESOURCE
           
static java.lang.String MT_ROOT
           
 
Fields inherited from class biz.hammurapi.web.menu.sql.XmenuImpl
Content, ContentType, Description, EngineClass, EngineConfig, FormHandlerCode, FormHandlerType, FormHandlerUri, Guard, Guid, HidePath, IconUrl, Id, IsDisabled, ItemPosition, Keywords, LastModified, MatchHandler, MatchQueryString, Name, Parent, Port, Protocol, QueryTemplate, Scope, Server, Target, Title, Type, Uri, Weight, Xid
 
Fields inherited from class biz.hammurapi.sql.DatabaseObject
columns, objectVersion, originalVersion
 
Constructor Summary
Menu()
           
Menu(boolean force)
           
Menu(org.w3c.dom.Element holder, boolean force)
           
Menu(org.w3c.dom.Element holder, java.util.Properties nameMap, org.apache.xpath.CachedXPathAPI cxpa, boolean force)
           
Menu(java.sql.ResultSet rs)
           
 
Method Summary
 boolean enabled()
           
static java.lang.String escapeHtml(java.lang.String txt)
           
 void evalGuard(javax.servlet.http.HttpServletRequest request)
           
 Menu findByGuid(java.lang.String id)
           
 Menu findById(int id)
           
 Menu findByXid(java.lang.String xid)
           
 Help findHelp(java.lang.String id, biz.hammurapi.config.Context context)
           
 Menu findItem(java.lang.String path)
          Finds menu item by path, XID or GUID.
 Menu findItemById(java.lang.String id)
           
 java.lang.Object get(java.lang.String key)
           
 java.lang.Object get(java.lang.String key, biz.hammurapi.config.Context chain)
          Chained get
 java.lang.Object get(java.lang.String key, java.lang.String[] parameters, biz.hammurapi.config.Context chain)
          Get with parameters for MenuNavigator to expand ${...|...|...|...} templates.
 Menu getAction(java.lang.String name)
           
 java.lang.Object getAttribute(java.lang.Object key)
          Walks up the hierarchy until finds the needed attribute.
 biz.hammurapi.cache.Cache getCache()
           
 Menu getChild(java.lang.String name)
           
 java.util.Collection getChildren()
           
 java.lang.Object getEngine()
           
 biz.hammurapi.sql.metadata.GenerationPolicy getGenerationPolicy()
           
 Help getHelp(biz.hammurapi.config.Context context)
           
 biz.hammurapi.web.menu.sql.MenuHelpTopics getHelpTopic(java.lang.String name, biz.hammurapi.config.Context context)
           
protected  biz.hammurapi.codegen.InjectingClassLoader getInjectingClassLoader()
           
 int getInteractionOffset()
          Id's for menu items for interactions shall be formed as interaction id + interaction offset + ref offset.
protected  biz.hammurapi.codegen.InterfacePool getInterfacePool()
           
 int getLastMatch()
           
 java.lang.String getMatchParameter(java.lang.String name)
           
 java.lang.String[] getMatchParameters(java.lang.String name)
           
 Menu getParentMenu()
           
 Menu[] getPath()
           
 Menu getRoot()
           
 java.lang.Object getRuntimeEngine()
           
 java.lang.Object getRuntimeEngine(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 java.util.Collection getTemplateNames()
           
 boolean hasHelp()
           
 java.lang.Object instantiateTemplate(java.lang.String templateName, java.util.Map context)
          Instantiates template with given context.
static boolean isBlank(java.lang.String str)
           
 boolean isMatchQueryString()
           
 java.util.List match(javax.servlet.http.HttpServletRequest request)
          Matches request
 int nextVirtualId()
           
protected  void setLastMatch(int match)
          Sets match number in self and parents.
 void setSQLProcessor(biz.hammurapi.sql.SQLProcessor processor)
          Loads dependent objects.
 boolean start(biz.hammurapi.authorization.AuthorizationProvider authorizationProvider, biz.hammurapi.config.Context context)
          Starts root menu.
 void stop()
           
 void toDom(org.w3c.dom.Element holder, javax.servlet.http.HttpServletRequest request)
          Renders menu to DOM
 
Methods inherited from class biz.hammurapi.web.menu.sql.XmenuImpl
clone, getContent, getContentType, getDescription, getEngineClass, getEngineConfig, getFormHandlerCode, getFormHandlerType, getFormHandlerUri, getGuard, getGuid, getHidePath, getIconUrl, getId, getIsDisabled, getItemPosition, getKeywords, getLastModified, getMatchHandler, getMatchQueryString, getName, getParent, getPort, getProtocol, getQueryTemplate, getScope, getServer, getTarget, getTitle, getType, getUri, getWeight, getXid, project, project, setContent, setContentType, setDescription, setEngineClass, setEngineConfig, setFormHandlerCode, setFormHandlerType, setFormHandlerUri, setGuard, setGuid, setHidePath, setIconUrl, setId, setIsDisabled, setItemPosition, setKeywords, setLastModified, setMatchHandler, setMatchQueryString, setName, setParent, setPort, setProtocol, setQueryTemplate, setScope, setServer, setTarget, setTitle, setType, setUri, setWeight, setXid
 
Methods inherited from class biz.hammurapi.sql.DatabaseObject
addColumn, addObserver, addRelationship, clear, configure, configure, copy, delete, equals, fromDom, fromDom, getColumn, getColumnAttribute, getObjectVersion, getRelationship, getSqlType, hashCode, insert, isDeleted, isModified, loadRelationships, onChange, removeAttribute, removeColumnAttribute, removeObserver, setAttribute, setColumnAttribute, setOriginal, toDom, toDom, toString, update
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface biz.hammurapi.web.menu.matchers.RequestMatcher
getWeight
 
Methods inherited from interface biz.hammurapi.xml.dom.DomSerializable
toDom
 

Field Detail

MT_ROOT

public static final java.lang.String MT_ROOT
See Also:
Constant Field Values

MT_FORM_HANDLER

public static final java.lang.String MT_FORM_HANDLER
See Also:
Constant Field Values

MT_RESOURCE

public static final java.lang.String MT_RESOURCE
See Also:
Constant Field Values
Constructor Detail

Menu

public Menu()

Menu

public Menu(boolean force)

Menu

public Menu(org.w3c.dom.Element holder,
            boolean force)
     throws biz.hammurapi.config.ConfigurationException

Menu

public Menu(org.w3c.dom.Element holder,
            java.util.Properties nameMap,
            org.apache.xpath.CachedXPathAPI cxpa,
            boolean force)
     throws biz.hammurapi.config.ConfigurationException

Menu

public Menu(java.sql.ResultSet rs)
     throws java.sql.SQLException
Method Detail

getHelp

public Help getHelp(biz.hammurapi.config.Context context)
Returns:
Root help descriptor for this item.

getHelpTopic

public biz.hammurapi.web.menu.sql.MenuHelpTopics getHelpTopic(java.lang.String name,
                                                              biz.hammurapi.config.Context context)

setSQLProcessor

public void setSQLProcessor(biz.hammurapi.sql.SQLProcessor processor)
                     throws java.sql.SQLException
Loads dependent objects.

Specified by:
setSQLProcessor in interface biz.hammurapi.sql.DataAccessObject
Throws:
java.sql.SQLException

getAttribute

public java.lang.Object getAttribute(java.lang.Object key)
Walks up the hierarchy until finds the needed attribute.

Specified by:
getAttribute in interface biz.hammurapi.util.Attributable

getEngine

public java.lang.Object getEngine()

getRuntimeEngine

public java.lang.Object getRuntimeEngine()
Returns:
Generated engine instance, which combines methods from engine class and functions.

getRuntimeEngine

public java.lang.Object getRuntimeEngine(javax.servlet.http.HttpServletRequest request,
                                         javax.servlet.http.HttpServletResponse response)
Parameters:
request -
response -
Returns:
Runtime engine, which is aware of its invocation context.

start

public boolean start(biz.hammurapi.authorization.AuthorizationProvider authorizationProvider,
                     biz.hammurapi.config.Context context)
              throws HammurapiWebException
Starts root menu.

Throws:
HammurapiWebException

stop

public void stop()
          throws biz.hammurapi.config.ConfigurationException
Throws:
biz.hammurapi.config.ConfigurationException

toDom

public void toDom(org.w3c.dom.Element holder,
                  javax.servlet.http.HttpServletRequest request)
Renders menu to DOM

Parameters:
request -
holder -

findItemById

public Menu findItemById(java.lang.String id)

match

public java.util.List match(javax.servlet.http.HttpServletRequest request)
Description copied from interface: RequestMatcher
Matches request

Specified by:
match in interface RequestMatcher
Parameters:
request -
Returns:
Collection of matched matchers. Returns empty collection if didn't match.

getMatchParameter

public java.lang.String getMatchParameter(java.lang.String name)
Parameters:
name -
Returns:
First value of given parameter at the time when item was matched. Parent matched parameters are inherited.

getMatchParameters

public java.lang.String[] getMatchParameters(java.lang.String name)
Parameters:
name -
Returns:
Values of given parameter at the time when item was matched. Parent matched parameters are inherited.

setLastMatch

protected void setLastMatch(int match)
Sets match number in self and parents.

Parameters:
match -

getLastMatch

public int getLastMatch()
Returns:
max of last match of this item and parent item(s)

isMatchQueryString

public boolean isMatchQueryString()
Specified by:
isMatchQueryString in interface RequestMatcher
Returns:
true if this matcher takes query string in consideration

getPath

public Menu[] getPath()
Returns:
path to this item.

getParentMenu

public Menu getParentMenu()

getRoot

public Menu getRoot()
Returns:
Root menu

getAction

public Menu getAction(java.lang.String name)

getChild

public Menu getChild(java.lang.String name)

findByXid

public Menu findByXid(java.lang.String xid)

findById

public Menu findById(int id)

isBlank

public static boolean isBlank(java.lang.String str)

escapeHtml

public static java.lang.String escapeHtml(java.lang.String txt)

getInjectingClassLoader

protected biz.hammurapi.codegen.InjectingClassLoader getInjectingClassLoader()

getInterfacePool

protected biz.hammurapi.codegen.InterfacePool getInterfacePool()

getCache

public biz.hammurapi.cache.Cache getCache()

getGenerationPolicy

public biz.hammurapi.sql.metadata.GenerationPolicy getGenerationPolicy()

findByGuid

public Menu findByGuid(java.lang.String id)

getTemplateNames

public java.util.Collection getTemplateNames()

get

public java.lang.Object get(java.lang.String key)
Specified by:
get in interface biz.hammurapi.config.Context

hasHelp

public boolean hasHelp()
Returns:
true if there are help topics associated with the menu item.

getChildren

public java.util.Collection getChildren()
Returns:
true if this item has sub-items

get

public java.lang.Object get(java.lang.String key,
                            biz.hammurapi.config.Context chain)
Chained get

Specified by:
get in interface biz.hammurapi.config.ChainedContext

instantiateTemplate

public java.lang.Object instantiateTemplate(java.lang.String templateName,
                                            java.util.Map context)
Instantiates template with given context. The context must contain "menuContext" entry.

Parameters:
templateName -
context -
Returns:

get

public java.lang.Object get(java.lang.String key,
                            java.lang.String[] parameters,
                            biz.hammurapi.config.Context chain)
Get with parameters for MenuNavigator to expand ${...|...|...|...} templates.

Parameters:
key - Context key
parameters - Parameters , addressed by number, e.g. parameter 0 is addressed as ${0}
chain - Chain context
Returns:
key value

findHelp

public Help findHelp(java.lang.String id,
                     biz.hammurapi.config.Context context)

findItem

public Menu findItem(java.lang.String path)
Finds menu item by path, XID or GUID.

Parameters:
path -
Returns:

getInteractionOffset

public int getInteractionOffset()
Id's for menu items for interactions shall be formed as interaction id + interaction offset + ref offset.

Returns:
Interaction offset

nextVirtualId

public int nextVirtualId()
Returns:
Next virtual id number for menu.

enabled

public boolean enabled()
Returns:
true if there is no guard or if the guard evaluated to not false for the given thread.

evalGuard

public void evalGuard(javax.servlet.http.HttpServletRequest request)


Copyright © 2006 Hammurapi Group. All Rights Reserved.