Class ViewPostMetadata

java.lang.Object
org.kuali.rice.krad.uif.lifecycle.ViewPostMetadata
All Implemented Interfaces:
Serializable

public class ViewPostMetadata extends Object implements Serializable
Holds data about the rendered view that might be needed to handle a post request.

When an action is requested on a view (for example add/delete line, field query, so on), it might be necessary to read configuration from the view that was rendered to cary out the action. However, the rendered view is not stored, and the new view is not rendered until after the controller completes. Therefore it is necessary to provide this mechanism.

The post metadata is retrieved in the controller though the UifFormBase instance

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
  • Constructor Details

    • ViewPostMetadata

      public ViewPostMetadata()
    • ViewPostMetadata

      public ViewPostMetadata(String id)
      Constructor that takes the view id.
      Parameters:
      id - id for the view
  • Method Details

    • cleanAfterLifecycle

      public void cleanAfterLifecycle()
      Invoked after the lifecycle is complete to perform an necessary cleaning.
    • getId

      public String getId()
      Id for the view the post metadata is associated with.
      Returns:
      view id
    • setId

      public void setId(String id)
      See Also:
    • getComponentPostMetadataMap

      public Map<String,ComponentPostMetadata> getComponentPostMetadataMap()
      Map containing post metadata for a component keyed by the component id.
      Returns:
      post metadata map, key is component id and value is post metadata
    • setComponentPostMetadataMap

      public void setComponentPostMetadataMap(Map<String,ComponentPostMetadata> componentPostMetadataMap)
      See Also:
    • getComponentPostMetadata

      public ComponentPostMetadata getComponentPostMetadata(String componentId)
      Gets the component post metadata for the given component id.
      Parameters:
      componentId - id for the component whose post metadata should be retrieved
      Returns:
      post metadata object
    • addComponentPostData

      public void addComponentPostData(Component component, String key, Object value)
      Adds post data for the given component (this is a convenience method for add component post metadata).
      Parameters:
      component - component instance the data should be added for
      key - key for the post data, this will be used to retrieve the value
      value - value for the post data
    • addComponentPostData

      public void addComponentPostData(String componentId, String key, Object value)
      Adds post data for the given component id (this is a convenience method for add component post metadata).
      Parameters:
      componentId - id for the component the data should be added for
      key - key for the post data, this will be used to retrieve the value
      value - value for the post data
    • getComponentPostData

      public Object getComponentPostData(String componentId, String key)
      Retrieves post data that has been stored for the given component id and key.
      Parameters:
      componentId - id for the component the data should be retrieved for
      key - key for the post data to retrieve
      Returns:
      value for the data, or null if the data does not exist
    • initializeComponentPostMetadata

      public ComponentPostMetadata initializeComponentPostMetadata(Component component)
      Initializes a component post metadata instance for the given component.
      Parameters:
      component - component instance to initialize post metadata for
      Returns:
      post metadata instance
    • initializeComponentPostMetadata

      public ComponentPostMetadata initializeComponentPostMetadata(String componentId)
      Initializes a component post metadata instance for the given component id.
      Parameters:
      componentId - id for the component to initialize post metadata for
      Returns:
      post metadata instance
    • getComponentPostMetadataForPath

      public ComponentPostMetadata getComponentPostMetadataForPath(String path)
      Iterates over the componentPostMetadataMap to find a componentPostMetadata which matches the path given.
      Parameters:
      path - the path of the component to find componentPostMetadata for
      Returns:
      returns the componentPostMetadata that matches the path, null if not found or metadata for path not found
    • getFieldPropertyEditors

      public Map<String,PropertyEditor> getFieldPropertyEditors()
      Maintains configuration of properties that have been configured for the view (if render was set to true) and there corresponding PropertyEdtior (if configured).

      Information is pulled out of the View during the lifecycle so it can be used when a form post is done from the View. Note if a field is secure, it will be placed in the getSecureFieldPropertyEditors() map instead

      Returns:
      map of property path (full) to PropertyEditor
    • addFieldPropertyEditor

      public void addFieldPropertyEditor(String propertyPath, PropertyEditor propertyEditor)
      Associates a property editor instance with the given property path.
      Parameters:
      propertyPath - path for the property the editor should be associated with
      propertyEditor - editor instance to use when binding data for the property
    • getSecureFieldPropertyEditors

      public Map<String,PropertyEditor> getSecureFieldPropertyEditors()
      Maintains configuration of secure properties that have been configured for the view (if render was set to true) and there corresponding PropertyEdtior (if configured).

      Information is pulled out of the View during the lifecycle so it can be used when a form post is done from the View. Note if a field is non-secure, it will be placed in the getFieldPropertyEditors() map instead

      Returns:
      map of property path (full) to PropertyEditor
    • addSecureFieldPropertyEditor

      public void addSecureFieldPropertyEditor(String propertyPath, PropertyEditor propertyEditor)
      Associates a secure property editor instance with the given property path.
      Parameters:
      propertyPath - path for the property the editor should be associated with
      propertyEditor - secure editor instance to use when binding data for the property
    • getInputFieldIds

      public Set<String> getInputFieldIds()
      Set of ids for all input fields rendered with the view.
      Returns:
      set of id strings
    • setInputFieldIds

      public void setInputFieldIds(Set<String> inputFieldIds)
      See Also:
    • getAllRenderedPropertyPaths

      public Set<String> getAllRenderedPropertyPaths()
      Set of property paths that have been rendered as part of the lifecycle.

      Note this will include all property paths (of data fields) that were rendered as part of the last full lifecycle and any component refreshes since then. It will not contain all paths of a view (which would include all pages)

      Returns:
      set of property paths as strings
    • setAllRenderedPropertyPaths

      public void setAllRenderedPropertyPaths(Set<String> allRenderedPropertyPaths)
      See Also:
    • addRenderedPropertyPath

      public void addRenderedPropertyPath(String propertyPath)
      Adds a property path to the list of rendered property paths.
      Parameters:
      propertyPath - property path to add
      See Also:
    • getAddedCollectionObjects

      public Map<String,List<Object>> getAddedCollectionObjects()
      The collection objects that were added during the current controller call, these will be emptied after the lifecycle process is run.

      Note: If a list is empty this means that a collection had an addLine call occur and a new line must be initialized for the collection.

      Returns:
      the collection objects that were added during the current controller call if added through a process other than the collection's own addLine call
      See Also:
    • setAddedCollectionObjects

      public void setAddedCollectionObjects(Map<String,List<Object>> addedCollectionObjects)
      See Also:
    • getLookupCriteria

      public Map<String,Map<String,Object>> getLookupCriteria()
      Set the metadata of the lookup criteria.

      The lookup criteria property name is the key of the map. The value is a map of criteria attributes as specified by UifConstants.LookupCriteriaPostMetadata. Not all criteria attribute types need to be specified. A missing boolean attribute equals to false.

    • setLookupCriteria

      public void setLookupCriteria(Map<String,Map<String,Object>> lookupCriteria)
      See Also:
    • getAccessibleBindingPaths

      public Set<String> getAccessibleBindingPaths()
      Set of property paths from the view that will allow binding to (by default).

      Used by the UIF web infrastructure to provide security during the binding process. By default, binding will only occur for properties within the view configuration (for properties that allow updating).

      Returns:
      Set of property paths
    • setAccessibleBindingPaths

      public void setAccessibleBindingPaths(Set<String> accessibleBindingPaths)
      See Also:
    • addAccessibleBindingPath

      public void addAccessibleBindingPath(String accessibleBindingPath)
      Adds a path to the set of accessible binding paths.
      Parameters:
      accessibleBindingPath - path to add as accessible
      See Also:
    • getAccessibleMethodToCalls

      public Set<String> getAccessibleMethodToCalls()
      Set of method to calls configured within the view that access should be allowed for.

      Used by the UIF web infrastructure to provide security for invoking controller methods. By default, only methods within the view configuration can be called.

      Returns:
      Set of method names
    • setAccessibleMethodToCalls

      public void setAccessibleMethodToCalls(Set<String> accessibleMethodToCalls)
      See Also:
    • addAccessibleMethodToCall

      public void addAccessibleMethodToCall(String methodToCall)
      Adds a method to the set of accessible controller methods.
      Parameters:
      methodToCall - method to add as accessible
      See Also:
    • getAvailableMethodToCalls

      public Set<String> getAvailableMethodToCalls()
      Set of available methods to call.

      If a methodToCall belongs to the set of available methods to call, then binding will be allowed only if the methodToCall, either, has the @MethodAccessible notation, or, is listed as one of the accessible methods to call on the view.

      Returns:
      Set of method names
    • setAvailableMethodToCalls

      public void setAvailableMethodToCalls(Set<String> availableMethodToCalls)
      See Also:
    • addAvailableMethodToCall

      public void addAvailableMethodToCall(String methodToCall)
      Adds a method to the set of available controller methods.
      Parameters:
      methodToCall - method to add as accessible
      See Also:
    • getFieldEditor

      public PropertyEditor getFieldEditor(String propertyName)
      Look up a field editor.
      Parameters:
      propertyName - name of the property to find field and editor for