org.kuali.rice.krad.uif.service
Interface ViewHelperService

All Known Subinterfaces:
Lookupable, Maintainable, Maintainable
All Known Implementing Classes:
AgendaEditorMaintainable, AgendaInquiryHelperServiceImpl, AgendaLookupableHelperServiceImpl, AuthorMaintainable, BookMaintainable, CampusMaintainableImpl, CampusTypeMaintainableImpl, ComponentInquirableImpl, ComponentViewHelperServiceImpl, ContextMaintainable, CountryMaintainableImpl, CountyMaintainableImpl, DocumentTypeMaintainable, DocumentViewHelperServiceImpl, GenericPermissionMaintainable, GroupInquirableImpl, GroupLookupableImpl, InquirableImpl, KimInquirableImpl, KimTypeInquirableImpl, KualiGlobalMaintainableImpl, KualiInquirableImpl, KualiMaintainableImpl, LabsInquiryCustomLinkInquirable, LabsInquiryDynamicSectionsInquirable, LookupableImpl, LookupableTravelImpl, MaintainableImpl, NamespaceMaintainableImpl, ParameterMaintainableImpl, PeopleFlowInquirableImpl, PeopleFlowMaintainableImpl, PermissionInquirableImpl, PersonInquirableImpl, PersonLookupableImpl, PostalCodeMaintainableImpl, PropositionLookupableHelperServiceImpl, ResponsibilityInquirableImpl, ReviewResponsibilityMaintainable, RoleInquirableImpl, RoleMemberInquirableImpl, RoutingRuleDelegationMaintainable, RoutingRuleMaintainable, RuleBaseValuesInquirableImpl, RuleDelegationInquirableImpl, RuleStudentInquiryViewHelperServiceImpl, StateMaintainableImpl, TermMaintainable, TermSpecificationInquiryHelperServiceImpl, TermSpecificationMaintainable, TravelCompanyCategoryInquirable, TravelLookupableImpl, UIfComponentsViewHelperServiceImpl, UIfComponentsViewHelperServiceImpl, UifGeneratedTestViewHelperServiceImpl, UIRoleMemberLookupableImpl, ViewHelperServiceImpl

public interface ViewHelperService

Provides methods for implementing the various phases of a View

Author:
Kuali Rice Team (rice.collab@kuali.org)

Method Summary
 void addCustomContainerComponents(ViewModel model, Container container)
          Hook for creating new components with code and adding them to a container
 void applyDefaultValues(Component component)
          Iterates through the view components picking up data fields and applying an default value configured
 void applyDefaultValuesForCollectionLine(CollectionGroup collectionGroup, Object line)
          Populate default values the model backing a line in a collection group.
 String buildGrowlScript()
          Builds JS script that will invoke the show growl method to display a growl message when the page is rendered
 void buildInquiryLink(Object dataObject, String propertyName, Inquiry inquiry)
          Invoked by the Inquiry widget to build the inquiry link
 Object getDefaultValueForField(Object object, DataField dataField)
          Retrieves the default value that is configured for the given data field
 ExpressionEvaluatorFactory getExpressionEvaluatorFactory()
          Gets an expression evaluator factory for use with the current view.
 void performCustomApplyModel(LifecycleElement component, Object model)
          Hook for service overrides to perform custom apply model logic on the component
 void performCustomFinalize(LifecycleElement component, Object model, LifecycleElement parent)
          Hook for service overrides to perform custom component finalization
 void performCustomInitialization(LifecycleElement component)
          Hook for service overrides to perform custom initialization on the component
 void performCustomViewFinalize(Object model)
          Hook for service overrides to perform view component finalization
 void performCustomViewInitialization(Object model)
          Hook for service overrides to perform custom initialization prior to view initialization.
 void populateDefaultValueForField(Object object, DataField dataField, String bindingPath)
          Applies the default value configured for the given field (if any) to the line given object property that is determined by the given binding path
 void populateViewFromRequestParameters(Map<String,String> parameters)
          Uses reflection to find all fields defined on the View instance that have the RequestParameter annotation (which indicates the field may be populated by the request).
 void processAfterAddLine(ViewModel model, Object addLine, String collectionId, String collectionPath, boolean isValidLine)
          Hook for service overrides to process the new collection line after it has been added to the collection
 void processAfterDeleteLine(ViewModel model, String collectionId, String collectionPath, int lineIndex)
          Hook for service overrides to process the collection line after it has been deleted
 void processAfterSaveLine(ViewModel model, Object lineObject, String collectionId, String collectionPath)
          Hook for service overrides to process the save collection line after it has been validated
 void processBeforeAddLine(ViewModel model, Object addLine, String collectionId, String collectionPath)
          Hook for service overrides to process the new collection line before it is added to the collection
 void processBeforeSaveLine(ViewModel model, Object lineObject, String collectionId, String collectionPath)
          Hook for service overrides to process the save collection line before it is validated
 void processCollectionAddBlankLine(ViewModel model, String collectionId, String collectionPath)
          Adds a blank line to the collection
 void processCollectionAddLine(ViewModel model, String collectionId, String collectionPath)
          Invoked when the add line action is chosen for a collection.
 void processCollectionDeleteLine(ViewModel model, String collectionId, String collectionPath, int lineIndex)
          Invoked when the delete line action is chosen for a collection.
 void processCollectionSaveLine(ViewModel model, String collectionId, String collectionPath, int selectedLineIndex)
          Invoked when the save line action is chosen for a collection.
 void processMultipleValueLookupResults(ViewModel model, String collectionId, String collectionPath, String multiValueReturnFields, String lookupResultValues)
          Process the results returned from a multi-value lookup populating the lines for the collection given by the path
 void refreshReference(Object parentObject, String referenceObjectName)
          Perform a database or data dictionary based refresh of a specific property object
 void refreshReferences(String referencesToRefresh)
          Update the reference objects listed in referencesToRefresh of the model
 void retrieveEditModesAndActionFlags()
          Invokes the configured PresentationController and Authorizer for the view to get the exported action flags and edit modes that can be used in conditional logic
 void setViewContext()
          Sets up the view context which will be available to other components through their context for conditional logic evaluation.
 

Method Detail

performCustomViewInitialization

void performCustomViewInitialization(Object model)
Hook for service overrides to perform custom initialization prior to view initialization.

Parameters:
model - The model.

performCustomInitialization

void performCustomInitialization(LifecycleElement component)
Hook for service overrides to perform custom initialization on the component

Parameters:
component - component instance to initialize

performCustomApplyModel

void performCustomApplyModel(LifecycleElement component,
                             Object model)
Hook for service overrides to perform custom apply model logic on the component

Parameters:
component - component instance to apply model to
model - Top level object containing the data (could be the model or a top level business object, dto)

performCustomFinalize

void performCustomFinalize(LifecycleElement component,
                           Object model,
                           LifecycleElement parent)
Hook for service overrides to perform custom component finalization

Parameters:
component - component instance to update
model - Top level object containing the data
parent - Parent component for the component being finalized

performCustomViewFinalize

void performCustomViewFinalize(Object model)
Hook for service overrides to perform view component finalization

Parameters:
model - Top level object containing the data

processBeforeAddLine

void processBeforeAddLine(ViewModel model,
                          Object addLine,
                          String collectionId,
                          String collectionPath)
Hook for service overrides to process the new collection line before it is added to the collection

Parameters:
model - object instance that contain's the view's data
addLine - the new line instance to be processed
collectionId - the id of the collection being added to
collectionPath - the path to the collection being modified

processAfterAddLine

void processAfterAddLine(ViewModel model,
                         Object addLine,
                         String collectionId,
                         String collectionPath,
                         boolean isValidLine)
Hook for service overrides to process the new collection line after it has been added to the collection

Parameters:
model - object instance that contain's the views data
addLine - the new line that was added
collectionId - the id of the collection being added to
collectionPath - the path to the collection being modified
isValidLine - indicates if the line is valid

processBeforeSaveLine

void processBeforeSaveLine(ViewModel model,
                           Object lineObject,
                           String collectionId,
                           String collectionPath)
Hook for service overrides to process the save collection line before it is validated

Parameters:
model - object instance that contain's the views data
lineObject - the line instance to be processed
collectionId - the id of the collection being added to
collectionPath - the path to the collection being modified

processAfterSaveLine

void processAfterSaveLine(ViewModel model,
                          Object lineObject,
                          String collectionId,
                          String collectionPath)
Hook for service overrides to process the save collection line after it has been validated

Parameters:
model - object instance that contains the views data
lineObject - the line instance to be processed
collectionId - the id of the collection being added to
collectionPath - the path to the collection being modified

processAfterDeleteLine

void processAfterDeleteLine(ViewModel model,
                            String collectionId,
                            String collectionPath,
                            int lineIndex)
Hook for service overrides to process the collection line after it has been deleted

Parameters:
model - object instance that contains the views data
collectionId - the id of the collection being added to
collectionPath - the path to the collection being modified
lineIndex - index of the line that was deleted

addCustomContainerComponents

void addCustomContainerComponents(ViewModel model,
                                  Container container)
Hook for creating new components with code and adding them to a container

Subclasses can override this method to check for one or more containers by id and then adding components created in code. This is invoked before the initialize method on the container component, so the full lifecycle will be run on the components returned.

New components instances can be retrieved using ComponentFactory

Parameters:
model - object containing the view data
container - container instance to add components to

processCollectionAddLine

void processCollectionAddLine(ViewModel model,
                              String collectionId,
                              String collectionPath)
Invoked when the add line action is chosen for a collection. The collection path gives the full path to the collection that action was selected for. Here validation can be performed on the line as well as further processing on the line such as defaults. If the action is valid the line should be added to the collection, otherwise errors should be added to the global MessageMap

Parameters:
model - Top level object containing the view data including the collection and new line
collectionId - the id of the collection being added to
collectionPath - the path to the collection being modified

processCollectionAddBlankLine

void processCollectionAddBlankLine(ViewModel model,
                                   String collectionId,
                                   String collectionPath)
Adds a blank line to the collection

Adds a new collection item to the collection and applies any default values.

Parameters:
model - Top level object containing the view data including the collection and new line
collectionId - the id of the collection being added to
collectionPath - the path to the collection being modified

processCollectionSaveLine

void processCollectionSaveLine(ViewModel model,
                               String collectionId,
                               String collectionPath,
                               int selectedLineIndex)
Invoked when the save line action is chosen for a collection. This method only does server side validation by default but creates hook for client applications to add additional logic like persisting data.

Parameters:
model - Top level object containing the view data including the collection and new line
collectionId - the id of the collection being added to
collectionPath - the path to the collection being modified
selectedLineIndex - The index within the collection of the line to save.

processCollectionDeleteLine

void processCollectionDeleteLine(ViewModel model,
                                 String collectionId,
                                 String collectionPath,
                                 int lineIndex)
Invoked when the delete line action is chosen for a collection. The collection path gives the full path to the collection that action was selected for. Here validation can be performed to make sure the action is allowed. If the action is valid the line should be deleted from the collection, otherwise errors should be added to the global MessageMap

Parameters:
model - Top level object containing the view data including the collection
collectionId - the id of the collection being added to
collectionPath - the path to the collection being modified
lineIndex - index of the collection line that was selected for removal

processMultipleValueLookupResults

void processMultipleValueLookupResults(ViewModel model,
                                       String collectionId,
                                       String collectionPath,
                                       String multiValueReturnFields,
                                       String lookupResultValues)
Process the results returned from a multi-value lookup populating the lines for the collection given by the path

Parameters:
model - object containing the view data
collectionId - the id of the collection being added to
collectionPath - the path to the collection being modified
multiValueReturnFields - String containing the selected line field names
lookupResultValues - String containing the selected line values

buildInquiryLink

void buildInquiryLink(Object dataObject,
                      String propertyName,
                      Inquiry inquiry)
Invoked by the Inquiry widget to build the inquiry link

Note this is used primarily for custom Inquirable implementations to customize the inquiry class or parameters for an inquiry. Instead of building the full inquiry link, implementations can make a callback to org.kuali.rice.krad.uif.widget.Inquiry.buildInquiryLink(Object, String, Class, Map) given an inquiry class and parameters to build the link field.

Parameters:
dataObject - parent object for the inquiry property
propertyName - name of the property the inquiry is being built for
inquiry - instance of the inquiry widget being built for the property

setViewContext

void setViewContext()
Sets up the view context which will be available to other components through their context for conditional logic evaluation.


retrieveEditModesAndActionFlags

void retrieveEditModesAndActionFlags()
Invokes the configured PresentationController and Authorizer for the view to get the exported action flags and edit modes that can be used in conditional logic


refreshReference

void refreshReference(Object parentObject,
                      String referenceObjectName)
Perform a database or data dictionary based refresh of a specific property object

The object needs to be of type PersistableBusinessObject.

Parameters:
parentObject - parent object that references the object to be refreshed
referenceObjectName - property name of the parent object to be refreshed

refreshReferences

void refreshReferences(String referencesToRefresh)
Update the reference objects listed in referencesToRefresh of the model

The the individual references in the referencesToRefresh string are separated by KRADConstants.REFERENCES_TO_REFRESH_SEPARATOR).

Parameters:
referencesToRefresh - list of references to refresh (

getDefaultValueForField

Object getDefaultValueForField(Object object,
                               DataField dataField)
Retrieves the default value that is configured for the given data field

The field's default value is determined in the following order:

  1. If default value on field is non-blank
  2. If expression is found for default value
  3. If default value finder class is configured for field
  4. If an expression is found for default values
  5. If default values on field is not null

Parameters:
object - object that should be populated
dataField - field to retrieve default value for
Returns:
Object default value for field or null if value was not found

populateDefaultValueForField

void populateDefaultValueForField(Object object,
                                  DataField dataField,
                                  String bindingPath)
Applies the default value configured for the given field (if any) to the line given object property that is determined by the given binding path

Parameters:
object - object that should be populated
dataField - field to check for configured default value
bindingPath - path to the property on the object that should be populated

buildGrowlScript

String buildGrowlScript()
Builds JS script that will invoke the show growl method to display a growl message when the page is rendered

A growl call will be created for any explicit growl messages added to the message map.

Growls are only generated if @{link org.kuali.rice.krad.uif.view.View#isGrowlMessagingEnabled()} is enabled. If not, the growl messages are set as info messages for the page

Returns:
JS script string for generated growl messages

applyDefaultValues

void applyDefaultValues(Component component)
Iterates through the view components picking up data fields and applying an default value configured

Parameters:
component - component that should be checked for default values

applyDefaultValuesForCollectionLine

void applyDefaultValuesForCollectionLine(CollectionGroup collectionGroup,
                                         Object line)
Populate default values the model backing a line in a collection group.

Parameters:
collectionGroup - The collection group.
line - The model object backing the line.

populateViewFromRequestParameters

void populateViewFromRequestParameters(Map<String,String> parameters)
Uses reflection to find all fields defined on the View instance that have the RequestParameter annotation (which indicates the field may be populated by the request).

The View instance is inspected for fields that have the RequestParameter annotation and if corresponding parameters are found in the request parameter map, the request value is used to set the view property. The Map of parameter name/values that match are placed in the view so they can be later retrieved to rebuild the view. Custom ViewServiceHelper implementations can add additional parameter key/value pairs to the returned map if necessary.

For each field found, if there is a corresponding key/value pair in the request parameters, the value is used to populate the field. In addition, any conditional properties of PropertyReplacers configured for the field are cleared so that the request parameter value does not get overridden by the dictionary conditional logic

Parameters:
parameters - The request parameters that apply to the view.
See Also:
RequestParameter

getExpressionEvaluatorFactory

ExpressionEvaluatorFactory getExpressionEvaluatorFactory()
Gets an expression evaluator factory for use with the current view.

Returns:
expression evaluator factory


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.