net.sf.springlayout.web.security
Class PageAccessHolder

java.lang.Object
  extended by net.sf.springlayout.web.security.PageAccessHolder

public class PageAccessHolder
extends java.lang.Object

Maintains the page read /edit state for a request and potential for determining readonly fields and page function states at run time. This class is used extensively by the layout field tags to determine how to display a field on a page. PageAccessHolder should be accessed via the PageAccessManager

Author:
rob monie
See Also:
PageAccessManager

Constructor Summary
PageAccessHolder()
          Default constructor.
 
Method Summary
 void addReadOnlyField(java.lang.String fieldKey)
          Add a readonly field to the map by field key
 AccessLevel getAccessLevel()
          Gets the access level
 PageFunctionStateMap getPageFunctions()
          Gets the pageFunctionMap
 PageFunctionState getPageFunctionState(java.lang.String functionName)
          Looks up the pageFunction map from the threadLocal variable and queries it for the function name requested returning a page function state.
 boolean isEditMode()
          Gets the edit mode for the page or request
 boolean isFieldReadOnly(java.lang.String path)
           Determines whether a field is read only by queryiing the readonlyField map.
 boolean isNoAccess()
          gets the noAccess Property.
 boolean isReadMode()
          Gets the read mode for the page or request
 void removeReadOnlyField(java.lang.String fieldKey)
          Remove a readonly field from the map
 void setAccessLevel(AccessLevel accessLevel)
          Sets the access level
 void setEditMode()
          Sets the pageAccessHolder to edit mode
 void setNoAccess()
          sets the pageAccessHolder to no access
 void setPageFunctions(PageFunctionStateMap pageFunctions)
          Sets the pageFunctionMap
 void setPageFunctionState(java.lang.String functionName, PageFunctionState pageFunctionState)
          Sets the pageFunctionState in the pageAccessHolder
 void setReadMode()
          Sets the pageAccessHolder to read mode
 void setReadOnlyFields(java.util.Map readOnlyFields)
          Sets the read only field map for the page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageAccessHolder

public PageAccessHolder()
Default constructor. Sets editMode to false by default and initialises the readOnlyFields map.

Method Detail

getAccessLevel

public AccessLevel getAccessLevel()
Gets the access level

Returns:

setAccessLevel

public void setAccessLevel(AccessLevel accessLevel)
Sets the access level

Parameters:
accessLevel -

isEditMode

public boolean isEditMode()
Gets the edit mode for the page or request

Returns:

setEditMode

public void setEditMode()
Sets the pageAccessHolder to edit mode

Parameters:
editMode -

isReadMode

public boolean isReadMode()
Gets the read mode for the page or request

Returns:

setReadMode

public void setReadMode()
Sets the pageAccessHolder to read mode

Parameters:
editMode -

isNoAccess

public boolean isNoAccess()
gets the noAccess Property.

Returns:

setNoAccess

public void setNoAccess()
sets the pageAccessHolder to no access

Parameters:
noAccess -

setReadOnlyFields

public void setReadOnlyFields(java.util.Map readOnlyFields)
Sets the read only field map for the page. Fields found in this map will be treated as readonly if the page is in edit mode.

Parameters:
readOnlyFields -

addReadOnlyField

public void addReadOnlyField(java.lang.String fieldKey)
Add a readonly field to the map by field key

Parameters:
fieldKey -

removeReadOnlyField

public void removeReadOnlyField(java.lang.String fieldKey)
Remove a readonly field from the map

Parameters:
fieldKey -

isFieldReadOnly

public boolean isFieldReadOnly(java.lang.String path)

Determines whether a field is read only by queryiing the readonlyField map. At this stage indexed field paths will be stripped of indexes to perform a match so any indexed paths such as incident.vessels[2].vesselName would match against a path of index.vessels.vesselName in the readonlyFields map. For this reason all fields in the readonlyFields map must also be stripped of specific indexes. Future releases could support specific indexes if required.

If the page is not in edit mode then returns true for every field without checking.

Parameters:
path - the field path
Returns:
true if the field is readonly

setPageFunctionState

public void setPageFunctionState(java.lang.String functionName,
                                 PageFunctionState pageFunctionState)
Sets the pageFunctionState in the pageAccessHolder

Parameters:
functionName - name of the function to set
pageFunctionState - state of the function

getPageFunctionState

public PageFunctionState getPageFunctionState(java.lang.String functionName)
Looks up the pageFunction map from the threadLocal variable and queries it for the function name requested returning a page function state.

See Also:
net.sf.springlayout.web.security.PageAccessResolver#getPageFunctionState(javax.servlet.http.HttpServletRequest, java.lang.String)

getPageFunctions

public PageFunctionStateMap getPageFunctions()
Gets the pageFunctionMap

Returns:

setPageFunctions

public void setPageFunctions(PageFunctionStateMap pageFunctions)
Sets the pageFunctionMap

Parameters:
pageFunctions -


Copyright © 2005-2007 Spring Layout Team. All Rights Reserved.