org.kuali.rice.krad.uif.service.impl
Class ViewServiceImpl

java.lang.Object
  extended by org.kuali.rice.krad.uif.service.impl.ViewServiceImpl
All Implemented Interfaces:
ViewService

public class ViewServiceImpl
extends Object
implements ViewService

Implementation of ViewService

Provides methods for retrieving View instances and carrying out the View lifecycle methods. Interacts with the configured ViewHelperService during the view lifecycle

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

Constructor Summary
ViewServiceImpl()
           
 
Method Summary
 void buildView(View view, Object model)
          Applies updates to the view based on the model data.
protected  DataDictionaryService getDataDictionaryService()
           
 View getView(String viewId, Map<String,String> parameters)
          Retrieves the view from the data dictionary and its corresponding ViewHelperService.
 View getViewById(String viewId)
          Returns the View entry identified by the given id
 View getViewByType(String viewType, Map<String,String> parameters)
          Retrieves the View instance that is of the given view type and matches the given parameters (that are applicable for that type).
protected  View getViewForType(String viewTypeName, Map<String,String> parameters)
          Retrieves the ViewTypeService for the given view type, then builds up the index based on the supported view type parameters and queries the dictionary service to retrieve the view based on its type and index
 ViewTypeService getViewTypeService(String viewType)
           
 List<ViewTypeService> getViewTypeServices()
           
protected  void performInitialization(View view, Map<String,String> parameters)
          Initializes a newly created View instance.
 View rebuildView(String viewId, Object model, Map<String,String> parameters)
          Returns the View entry identified by the given id and runs through the complete lifecycle.
 void setDataDictionaryService(DataDictionaryService dataDictionaryService)
           
 void setViewTypeServices(List<ViewTypeService> viewTypeServices)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewServiceImpl

public ViewServiceImpl()
Method Detail

getViewById

public View getViewById(String viewId)
Description copied from interface: ViewService
Returns the View entry identified by the given id

The id matches the id configured for the View through the dictionary. The view is initialized before being returned

Specified by:
getViewById in interface ViewService
Parameters:
viewId - - unique id for view configured on its definition
Returns:
View instance associated with the id or Null if id is not found
See Also:
ViewService.getViewById(java.lang.String)

getView

public View getView(String viewId,
                    Map<String,String> parameters)
Retrieves the view from the data dictionary and its corresponding ViewHelperService. The first phase of the view lifecycle Initialize is then performed

Specified by:
getView in interface ViewService
Parameters:
viewId - - unique id for view configured on its definition
parameters - - Map of key values pairs that provide configuration for the View, this is generally comes from the request and can be the request parameter Map itself. Any parameters not valid for the View will be filtered out
Returns:
View instance associated with the id or Null if id is not found
See Also:
ViewService.getView(java.lang.String, java.util.Map)

performInitialization

protected void performInitialization(View view,
                                     Map<String,String> parameters)
Initializes a newly created View instance. Each component of the tree is invoked to perform setup based on its configuration. In addition helper service methods are invoked to perform custom initialization

Parameters:
view - - view instance to initialize
parameters - - Map of key values pairs that provide configuration for the View, this is generally comes from the request and can be the request parameter Map itself. Any parameters not valid for the View will be filtered out

buildView

public void buildView(View view,
                      Object model)
Description copied from interface: ViewService
Applies updates to the view based on the model data. Should be called to finalize the view before rendering

Performs dynamic generation of fields (such as collection rows), conditional logic, and state updating (conditional hidden, read-only, required).

Specified by:
buildView in interface ViewService
Parameters:
view - - view instance to update
model - - Top level object containing the data (could be the form or a top level business object, dto)
See Also:
ViewService.buildView(org.kuali.rice.krad.uif.view.View, java.lang.Object)

rebuildView

public View rebuildView(String viewId,
                        Object model,
                        Map<String,String> parameters)
Description copied from interface: ViewService
Returns the View entry identified by the given id and runs through the complete lifecycle. Used to rebuild the view on a post before rendering or on a session timeout

Specified by:
rebuildView in interface ViewService
Parameters:
viewId - - unique id for view configured on its definition
model - - Form object containing the data for the view
parameters - - Map of key values pairs that provide parameters for the view. This comes from the initial request to set view properties that have the RequestParameter annotation
Returns:
View instance associated with the id or Null if id is not found
See Also:
ViewService.rebuildView(java.lang.String, java.lang.Object, java.util.Map)

getViewByType

public View getViewByType(String viewType,
                          Map<String,String> parameters)
Description copied from interface: ViewService
Retrieves the View instance that is of the given view type and matches the given parameters (that are applicable for that type). If more than one views exists for the type and parameters, the view type may choose a default or throw an exception

Specified by:
getViewByType in interface ViewService
Parameters:
viewType - - name that identifies the view type
parameters - - Map of parameter key/value pairs that are used to select the view, the parameters allowed depend on the view type
Returns:
View instance or Null if a matching view was not found
See Also:
ViewService.getViewByType(java.lang.String, java.util.Map)

getViewForType

protected View getViewForType(String viewTypeName,
                              Map<String,String> parameters)
Retrieves the ViewTypeService for the given view type, then builds up the index based on the supported view type parameters and queries the dictionary service to retrieve the view based on its type and index

Parameters:
viewTypeName - - name of the view type
parameters - - Map of parameters that were given on request
Returns:
View instance or Null if a matching view was not found

getViewTypeService

public ViewTypeService getViewTypeService(String viewType)
Specified by:
getViewTypeService in interface ViewService

getViewTypeServices

public List<ViewTypeService> getViewTypeServices()

setViewTypeServices

public void setViewTypeServices(List<ViewTypeService> viewTypeServices)

getDataDictionaryService

protected DataDictionaryService getDataDictionaryService()

setDataDictionaryService

public void setDataDictionaryService(DataDictionaryService dataDictionaryService)


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.