Class LookupView

All Implemented Interfaces:
Serializable, Cloneable, Copyable, DictionaryBean, UifDictionaryBean, Component, Ordered, ScriptEventSupport, Container, LifecycleElement, Helpable, org.springframework.core.Ordered

public class LookupView extends FormView
View type for lookups.

Supports doing a search against a data object class or performing a more advanced query. The view type is primarily made up of two groups, the search (or criteria) group and the results group. Many options are supported on the view to enable/disable certain features, like what actions are available on the search results.

Works in conjunction with Lookupable which customizes the view and carries out the business functionality

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

    • LookupView

      public LookupView()
  • Method Details

    • performInitialization

      public void performInitialization(Object model)
      Initializes Lookupable with data object class and sets the abstractTypeClasses map for the lookup object path. The following initialization is performed:
      • If a single paged view, set items in page group and put the page in the items list
      • If ViewSessionPolicy.enableTimeoutWarning is enabled add the session timeout dialogs to the views list of dialog groups
      The following initialization is performed:
      • Sorts the containers list of components
      • Initializes the instructional field if necessary
      • Initializes LayoutManager
      The following updates are done here:
      • Invoke performInitialize on component modifiers
      Initializes the component

      Where components can set defaults and setup other necessary state. The initialize method should only be called once per component lifecycle and is invoked within the initialize phase of the view lifecylce.

      Specified by:
      performInitialization in interface LifecycleElement
      Overrides:
      performInitialization in class View
      Parameters:
      model - - object instance containing the view data
      See Also:
    • performApplyModel

      public void performApplyModel(Object model, LifecycleElement parent)
      Reads the convenience render flags and sets the corresponding component property, processing the criteria fields for any adjustments, and invokes the lookup authorizer to determine whether maintenance links should be shown. The following updates are done here:
      • Invoke expression evaluation on view theme
      • Invoke theme to configure defaults
      Specified by:
      performApplyModel in interface LifecycleElement
      Overrides:
      performApplyModel in class View
      Parameters:
      model - - Top level object containing the data (could be the form or a top level business object, dto)
      parent - parent lifecycle element
    • performFinalize

      public void performFinalize(Object model, LifecycleElement parent)
      Forces session persistence on the criteria fields so the search criteria can be validated on post. The following is performed:
      • Adds to its document ready script the setupValidator js function for setting up the validator for this view
      The following is performed:
      • Adds to its document ready script the setupValidator js function for setting up the validator for this view
      The following finalization is performed:
      • Sets the headerText of the header Group if it is blank
      • Set the messageText of the summary Message if it is blank
      • Finalizes LayoutManager
      The following finalization is done here:
      • progressiveRender and conditionalRefresh variables are processed if set
      • If any of the style properties were given, sets the style string on the style property
      • Set the skipInTabOrder flag for nested components
      The last phase before the view is rendered

      Here final preparations can be made based on the updated view state.

      Specified by:
      performFinalize in interface LifecycleElement
      Overrides:
      performFinalize in class FormView
      Parameters:
      model - - top level object containing the data
      parent - - parent component
    • addActiveCriteriaIfNecessary

      protected void addActiveCriteriaIfNecessary()
      Adds the 'active' property criteria to the criteria fields if the BO is inactivatable and their is not already a lookup field for the active property.
    • initializeGroups

      protected void initializeGroups()
      Adds the list of criteria and result fields to their group prototypes, then adds the criteria and result groups to the items for the view.
    • convertLookupCriteriaFields

      protected void convertLookupCriteriaFields(Group lookupGroup)
      Performs conversions of the lookup criteria fields within the given group's items.

      Max lengths are removed on text controls so wildcards can be added. Ranged date fields are converted to field groups with the from/to date fields

    • createDateRangeFieldGroup

      protected FieldGroup createDateRangeFieldGroup(LookupInputField toDate)
      Creates a FieldGroup instance to replace the given lookup input field as a date criteria range.

      The field group is created by copying rangeFieldGroupPrototype. This can be used to configure how the field group will appear. In addition, the two lookup fields are separated with a message that can be configured with rangedToMessage

      Parameters:
      toDate - lookup input field that field group should be build for
      Returns:
      field group that contains a from and to lookup input field for searching a date range
      See Also:
      • rangeFieldGroupPrototype
      • rangedToMessage
    • getDataObjectClass

      public Class<?> getDataObjectClass()
      Class for the data object the lookup applies to.

      The object class name is used to pick up a dictionary entry which will feed the attribute field definitions and other configuration. In addition it is to configure the Lookupable which will carry out the search action

      Returns:
      lookup data object class
    • setDataObjectClass

      public void setDataObjectClass(Class<?> dataObjectClass)
      See Also:
    • setDataObjectClassName

      public void setDataObjectClassName(String dataObjectClassName)
      Convenience setter to configure the lookup data object class by class name.
      Parameters:
      dataObjectClassName - full class name for the lookup data object
    • isRenderReturnLink

      public Boolean isRenderReturnLink()
      Indicates whether a return value link should be rendered for each result row.

      When the lookup is called from a view (using a QuickFinder the return link can be returned to allow the user to return a value(s) for a selected row. Note, if this is not manually set the framework will determine when the lookup is called from a quickfinder and turn this flag on

      Returns:
      boolean true if the return link should be rendered for each result row, false if not
    • setRenderReturnLink

      public void setRenderReturnLink(Boolean renderReturnLink)
      See Also:
    • isRenderResultActions

      public boolean isRenderResultActions()
      Indicates whether the actions column for the search results collection group should be rendered (default is true).

      Note this is a convenience property for setting the render property on the result collection group

      Returns:
      boolean true if the result actions column should be rendered, false if not
    • setRenderResultActions

      public void setRenderResultActions(boolean renderResultActions)
      See Also:
    • isRenderMaintenanceLinks

      public Boolean isRenderMaintenanceLinks()
      Indicates whether links for maintenance actions (new, edit, copy, delete) should be rendered.

      When this property is not manually set it will be enabled by the framework when a lookup is not invoked from a quickfinder (for example a standard link from a menu). Regardless if the flag is manually enabled or enabled by the framework, an additional authorization check will be performed to determine if the user has initiate permission for the maintenance document associated with the lookup data object class. If not, this flag will be disabled

      Returns:
      boolean true if maintenance links should be rendered, false if not
    • setRenderMaintenanceLinks

      public void setRenderMaintenanceLinks(Boolean renderMaintenanceLinks)
      See Also:
    • isMultipleValuesSelect

      public boolean isMultipleValuesSelect()
      Indicates whether multiple values select should be enabled for the lookup.

      When set to true, the select field is enabled for the lookup results group that allows the user to select one or more rows for returning. The framework will also set the isRenderReturnLink() and isRenderMaintenanceLinks() properties to false (unless manually overridden)

      Returns:
      true if multiple values select should be enabled, false otherwise
    • setMultipleValuesSelect

      public void setMultipleValuesSelect(boolean multipleValuesSelect)
      See Also:
    • getCriteriaFields

      @ViewLifecycleRestriction public List<Component> getCriteriaFields()
      List of fields that will be rendered for the lookup criteria.

      This is a convenience property for setting the items in getCriteriaGroup(), which is the group the criteria for the lookup is rendered in. This property can be bypassed and the items set directly in the criteria group (for more flexibility)

      Returns:
      List of components to render as the lookup criteria
    • setCriteriaFields

      public void setCriteriaFields(List<Component> criteriaFields)
      See Also:
    • getCriteriaGroup

      @ViewLifecycleRestriction public Group getCriteriaGroup()
      Component Group instance to render as search criteria.

      Fields that make up the criteria for the lookup will be rendered in this group. This can be used in a few different ways:

      • Set the group to have the desired layout, style, and other general group properties. Note this is done in the base lookup view. The actual criteria fields can then be configured using getCriteriaFields()
      • Configure the criteria group entirely (ignoring criteria fields). This would allow you to do things like have multiple groups for the criteria.

      Note the footer for the criteria group can contain actions (such as search, clear, custom actions)

      Returns:
      group instance that will hold the search criteria fields
    • setCriteriaGroup

      public void setCriteriaGroup(Group criteriaGroup)
      See Also:
    • isHideCriteriaOnSearch

      public boolean isHideCriteriaOnSearch()
    • setHideCriteriaOnSearch

      public void setHideCriteriaOnSearch(boolean hideCriteriaOnSearch)
    • getResultFields

      @ViewLifecycleRestriction public List<Component> getResultFields()
      List of fields that will be rendered for the result collection group, each field will be a column (assuming table layout is used).

      This is a convenience property for setting the items in getResultsGroup(), which is the collection group the results for the lookup is rendered in. This property can be bypassed and the items set directly in the results group (for more flexibility)

      Returns:
      List of components to render in the results group
    • setResultFields

      public void setResultFields(List<Component> resultFields)
      See Also:
    • getResultsGroup

      @ViewLifecycleRestriction public CollectionGroup getResultsGroup()
      Component CollectionGroup instance to render for the lookup results.

      After a search is performed, the resulting data objects will be rendered in this collection group. This collection group can be used in two ways:

      • Set the desired layout, style, and other general collection group properties. Note this is done in the base lookup view. Then the actual fields that are rendered in the collection group can be configured using getResultFields()
      • Configure the results group entirely (ignoring result fields)

      Note actions that are presented for the results can be configured using the CollectionGroup.getLineActions() property

      Returns:
      collection group instance to render for the lookup results
    • setResultsGroup

      public void setResultsGroup(CollectionGroup resultsGroup)
      See Also:
    • getDefaultSortAttributeNames

      public List<String> getDefaultSortAttributeNames()
      List of property names on the configured data object class that will be used to perform the initial sorting of the search results.
      Returns:
      list of property names valid for the configured data object class
      See Also:
    • setDefaultSortAttributeNames

      public void setDefaultSortAttributeNames(List<String> defaultSortAttributeNames)
      See Also:
    • isDefaultSortAscending

      public boolean isDefaultSortAscending()
      Indicates whether the initial sort performed using getDefaultSortAttributeNames() is done based on ascending or descending order (default is true, ascending).
      Returns:
      boolean true if ascending sort should be performed, false if descending sort should be performed
    • setDefaultSortAscending

      public void setDefaultSortAscending(boolean defaultSortAscending)
      See Also:
    • getResultSetLimit

      public Integer getResultSetLimit()
      Retrieves the maximum number of records that will be listed as a result of the lookup search.
      Returns:
      Integer result set limit
    • setResultSetLimit

      public void setResultSetLimit(Integer resultSetLimit)
      See Also:
    • getMultipleValuesSelectResultSetLimit

      public Integer getMultipleValuesSelectResultSetLimit()
      Retrieves the maximum number of records that will be listed as a result of the multiple values select lookup search.
      Returns:
      multiple values select result set limit
    • setMultipleValuesSelectResultSetLimit

      public void setMultipleValuesSelectResultSetLimit(Integer multipleValuesSelectResultSetLimit)
      See Also:
    • getMaintenanceUrlMapping

      public String getMaintenanceUrlMapping()
      String that maps to the maintenance controller for the maintenance document (if any) associated with the lookup data object class.

      Mapping will be used to build the maintenance action links (such as edit, copy, and new). If not given, the default maintenance mapping will be used

      Returns:
      mapping string
    • setMaintenanceUrlMapping

      public void setMaintenanceUrlMapping(String maintenanceUrlMapping)
      See Also:
    • isRenderCriteriaActions

      public boolean isRenderCriteriaActions()
      Indicates whether the action buttons like search in the criteria group footer should be rendered, defaults to true.
      Returns:
      boolean true if the criteria actions should be rendered, false if not
    • setRenderCriteriaActions

      public void setRenderCriteriaActions(boolean renderCriteriaActions)
      See Also:
    • isRenderLookupCriteria

      public boolean isRenderLookupCriteria()
      Indicates whether the lookup criteria group should be rendered, default to true.

      Hiding the criteria group can be useful in cases where the criteria is passed in through the request and also the search is executed on the initial request

      Returns:
      boolean true if criteria group should be rendered, false if not
    • setRenderLookupCriteria

      public void setRenderLookupCriteria(boolean renderLookupCriteria)
      See Also:
    • getRangeFieldGroupPrototype

      @ViewLifecycleRestriction("INITIALIZE") public FieldGroup getRangeFieldGroupPrototype()
      Field group prototype that will be copied to create any date range field groups.
      Returns:
      field group instance to use for creating range field groups
    • setRangeFieldGroupPrototype

      public void setRangeFieldGroupPrototype(FieldGroup rangeFieldGroupPrototype)
      See Also:
    • getRangedToMessage

      @ViewLifecycleRestriction("INITIALIZE") public Message getRangedToMessage()
      Component Message instance to render between the range criteria fields within a range field group.
      Returns:
      message instance for range field group
    • setRangedToMessage

      public void setRangedToMessage(Message rangedToMessage)
      See Also:
    • isAutoAddActiveCriteria

      public boolean isAutoAddActiveCriteria()
      Indicates whether the 'active' criteria field must be added automatically for Inactivatable business objects.
      Returns:
      boolean true if active criteria should be added
    • setAutoAddActiveCriteria

      public void setAutoAddActiveCriteria(boolean autoAddActiveCriteria)
      See Also:
    • getAdditionalSecurePropertyNames

      public List<String> getAdditionalSecurePropertyNames()
      List of secure property names that are in addition to the ComponentSecurity or AttributeSecurity attributes.
      Returns:
      list of secure property names
    • setAdditionalSecurePropertyNames

      public void setAdditionalSecurePropertyNames(List<String> additionalSecurePropertyNames)
      See Also: