Class ViewLifecycleUtils

java.lang.Object
org.kuali.rice.krad.uif.lifecycle.ViewLifecycleUtils

public final class ViewLifecycleUtils extends Object
Utilities for working with LifecycleElement instances.
Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Method Details

    • getLifecycleRestrictedProperties

      public static Set<String> getLifecycleRestrictedProperties(LifecycleElement element, String viewPhase)
      Gets property names of all bean properties on the lifecycle element restricted for the indicated view phase.
      Parameters:
      element - The lifecycle element.
      viewPhase - The view phase to retrieve restrictions for.
      Returns:
      set of property names
    • getNextLifecyclePhase

      public static String getNextLifecyclePhase(LifecycleElement element)
      Gets the next lifecycle phase to be executed on the provided element.
      CREATED
      CACHED
      INITIALIZE
      INITIALIZED
      APPLY_MODEL
      MODEL_APPLIED
      FINALIZE
      FINAL
      RENDER

      If the view status is null, invalid, or RENDERED, then UifConstants.ViewPhases.INITIALIZE will be returned and a warning logged.

      Parameters:
      element - The lifecycle element.
      Returns:
      The next phase in the element's lifecycle based on view status
      See Also:
    • getElementsForLifecycle

      public static Map<String,LifecycleElement> getElementsForLifecycle(LifecycleElement element)
      Gets sub-elements for lifecycle processing.
      Parameters:
      element - The element to scan.
      Returns:
      map of lifecycle elements
    • getElementsForLifecycle

      public static Map<String,LifecycleElement> getElementsForLifecycle(LifecycleElement element, String viewPhase)
      Gets subcomponents for lifecycle processing.
      Parameters:
      element - The component to scan.
      viewPhase - The view phase to return subcomponents for.
      Returns:
      lifecycle components
    • recycleElementMap

      public static void recycleElementMap(Map<?,?> elementMap)
      Parameters:
      elementMap - map to recycle
    • getElementsOfTypeDeep

      public static <T extends LifecycleElement> List<T> getElementsOfTypeDeep(Collection<? extends LifecycleElement> items, Class<T> elementType)
      Return the lifecycle elements of the specified type from the given list

      Elements that match, implement or are extended from the specified elementType are returned in the result. If an element is a parent to other elements then these child elements are searched for matching types as well.

      Type Parameters:
      T - the type of the elements that are returned
      Parameters:
      items - list of elements from which to search
      elementType - the class or interface of the element type to return
      Returns:
      List of matching elements
    • getElementsOfTypeDeep

      public static <T extends LifecycleElement> List<T> getElementsOfTypeDeep(LifecycleElement element, Class<T> elementType)
      Returns the lifecycle elements of the specified type from the given list.

      Elements that match, implement or are extended from the specified elementType are returned in the result. If an element is a parent to other elements then these child components are searched for matching component types as well.

      Type Parameters:
      T - the type of the elements that are returned
      Parameters:
      element - The elements to search
      elementType - the class or interface of the elements type to return
      Returns:
      List of matching elements
    • getElementsOfTypeShallow

      public static <T extends LifecycleElement> List<T> getElementsOfTypeShallow(LifecycleElement element, Class<T> elementType)
      Returns elements of the given type that are direct children of the given element including itself, or a child of a non-component child of the given element.

      Deep search is only performed on non-component nested elements.

      Type Parameters:
      T - type of component that will be returned
      Parameters:
      element - instance to get children for
      elementType - type for component to return
      Returns:
      list of child components with the given type
    • getNestedElementsOfTypeShallow

      public static <T extends LifecycleElement> List<T> getNestedElementsOfTypeShallow(LifecycleElement element, Class<T> elementType)
      Get nested elements of the type specified one layer deep; this defers from getElementsOfTypeShallow because it does NOT include itself as a match if it also matches the type being requested.
      Type Parameters:
      T - type of element that will be returned
      Parameters:
      element - instance to get children for
      elementType - type for element to return
      Returns:
      list of child elements with the given type
    • isExcluded

      public static boolean isExcluded(Component component)
      Determines if a component should be excluded from the current lifecycle.
      Parameters:
      component - The component.