Class UifServletRequestDataBinder
- All Implemented Interfaces:
org.springframework.beans.PropertyEditorRegistry,org.springframework.beans.TypeConverter
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Field Summary
FieldsFields inherited from class org.springframework.web.bind.WebDataBinder
DEFAULT_FIELD_DEFAULT_PREFIX, DEFAULT_FIELD_MARKER_PREFIXFields inherited from class org.springframework.validation.DataBinder
DEFAULT_AUTO_GROW_COLLECTION_LIMIT, DEFAULT_OBJECT_NAME, logger -
Constructor Summary
ConstructorsConstructorDescriptionUifServletRequestDataBinder(Object target) UifServletRequestDataBinder(Object target, String name) -
Method Summary
Modifier and TypeMethodDescriptionassembleAutoLinkingPaths(String path, org.kuali.rice.krad.data.util.Link autoLink) A helper method which simply assembles a set of property paths for the givenLinkannotation which should be auto linked.voidbind(javax.servlet.ServletRequest request) CallsUifFormBase.preBind(HttpServletRequest), Performs data binding from servlet request parameters to the form, initializes view object, then callsUifFormBase.postBind(javax.servlet.http.HttpServletRequest)determineRootAutoLinkingPaths(Class<?> rootObjectType, String path, Set<Class<?>> scanned) Determines the root property paths relative to the given root object type against which to perform automatic linking.protected voidexecuteAutomaticLinking(javax.servlet.ServletRequest request, UifFormBase form) Performs automatic reference linking of the given form based on the properties on the form for which linking is enabled.protected List<org.kuali.rice.krad.web.bind.UifServletRequestDataBinder.AutoLinkTarget> extractAutoLinkListTargets(String autoLinkingPath, List<?> targetList) For the list object indicated for linking, iterates through the modified paths and finds paths that match entries in the list, and if found adds an auto link target.protected List<org.kuali.rice.krad.web.bind.UifServletRequestDataBinder.AutoLinkTarget> extractAutoLinkMapTargets(String autoLinkingPath, Map<?, ?> targetMap) For the map object indicated for linking, iterates through the modified paths and finds paths that match entries in the map, and if found adds an auto link target.protected List<org.kuali.rice.krad.web.bind.UifServletRequestDataBinder.AutoLinkTarget> extractAutoLinkTargets(Set<String> autoLinkingPaths) Uses the binding result on this data binder to determine the targets on the form that automatic linking should be performed against.org.kuali.rice.krad.data.DataObjectServiceprotected org.springframework.validation.AbstractPropertyBindingResultAllows for the setting attributes to use to find the data dictionary data from Kualiprotected ViewgetViewByType(javax.servlet.ServletRequest request, UifFormBase form) Attempts to get a view instance by looking for a view type name in the request or the form and querying that view type with the request parametersprotected ViewAttempts to get a view instance based on the view id stored on the form (which might not be populated from the request but remaining from session)voidAllows for a custom binding result class.voidDisallows direct field access for KualibooleanbooleanvoidsetAutoLinking(boolean autoLinking) voidsetDataObjectService(org.kuali.rice.krad.data.DataObjectService dataObjectService) Methods inherited from class org.springframework.web.bind.ServletRequestDataBinder
addBindValues, closeNoCatchMethods inherited from class org.springframework.web.bind.WebDataBinder
adaptEmptyArrayIndices, bindMultipart, checkFieldDefaults, checkFieldMarkers, doBind, getEmptyValue, getEmptyValue, getFieldDefaultPrefix, getFieldMarkerPrefix, isBindEmptyMultipartFiles, setBindEmptyMultipartFiles, setFieldDefaultPrefix, setFieldMarkerPrefixMethods inherited from class org.springframework.validation.DataBinder
addCustomFormatter, addCustomFormatter, addCustomFormatter, addValidators, applyPropertyValues, bind, checkAllowedFields, checkRequiredFields, close, convertIfNecessary, convertIfNecessary, convertIfNecessary, convertIfNecessary, createBeanPropertyBindingResult, createDirectFieldBindingResult, findCustomEditor, getAllowedFields, getAutoGrowCollectionLimit, getBindingErrorProcessor, getBindingResult, getConversionService, getDisallowedFields, getObjectName, getPropertyAccessor, getPropertyEditorRegistry, getRequiredFields, getSimpleTypeConverter, getTarget, getTypeConverter, getValidator, getValidators, isAllowed, isAutoGrowNestedPaths, isIgnoreInvalidFields, isIgnoreUnknownFields, registerCustomEditor, registerCustomEditor, replaceValidators, setAllowedFields, setAutoGrowCollectionLimit, setAutoGrowNestedPaths, setBindingErrorProcessor, setConversionService, setDisallowedFields, setIgnoreInvalidFields, setIgnoreUnknownFields, setMessageCodesResolver, setRequiredFields, setValidator, validate, validate
-
Field Details
-
LOG
protected static final org.apache.logging.log4j.Logger LOG
-
-
Constructor Details
-
UifServletRequestDataBinder
-
UifServletRequestDataBinder
-
-
Method Details
-
initBeanPropertyAccess
public void initBeanPropertyAccess()Allows for a custom binding result class.- Overrides:
initBeanPropertyAccessin classorg.springframework.validation.DataBinder- See Also:
-
getInternalBindingResult
protected org.springframework.validation.AbstractPropertyBindingResult getInternalBindingResult()Allows for the setting attributes to use to find the data dictionary data from Kuali- Overrides:
getInternalBindingResultin classorg.springframework.validation.DataBinder- See Also:
-
initDirectFieldAccess
public void initDirectFieldAccess()Disallows direct field access for Kuali- Overrides:
initDirectFieldAccessin classorg.springframework.validation.DataBinder- See Also:
-
bind
public void bind(javax.servlet.ServletRequest request) CallsUifFormBase.preBind(HttpServletRequest), Performs data binding from servlet request parameters to the form, initializes view object, then callsUifFormBase.postBind(javax.servlet.http.HttpServletRequest)The view is initialized by first looking for the
viewIdparameter in the request. If found, the view is retrieved based on this id. If the id is not present, then an attempt is made to find a view by type. In order to retrieve a view based on type, the view request parameterviewTypeNamemust be present. If all else fails and the viewId is populated on the form (could be populated from a previous request), this is used to retrieve the view.- Overrides:
bindin classorg.springframework.web.bind.ServletRequestDataBinder- Parameters:
request- - HTTP Servlet Request instance
-
executeAutomaticLinking
Performs automatic reference linking of the given form based on the properties on the form for which linking is enabled.Linking will only be performed if change tracking and auto linking are enabled on this data binder.
- Parameters:
request- request instanceform- form instance against which to perform automatic linking
-
determineRootAutoLinkingPaths
protected Set<String> determineRootAutoLinkingPaths(Class<?> rootObjectType, String path, Set<Class<?>> scanned) Determines the root property paths relative to the given root object type against which to perform automatic linking.This will be determined based on the presence of
Linkannotations on the given root object type. This method is invoked recursively as it walks the class structure looking for Link annotations. It uses the path and scanned arguments to keep track of how deep into the structure the scanning is and to prevent infinite recursion.- Parameters:
rootObjectType- the root object type from which to perform the scan for auto-linking pathspath- the current property path relative to the original root object type at which the scan began, if null then we are scanning from the root-most object type. Each recursive call of this method will append a new property to this pathscanned- used to track classes that have already been scanned and prevent infinite recursion- Returns:
- a set of property paths that should be auto linked
-
assembleAutoLinkingPaths
protected Set<String> assembleAutoLinkingPaths(String path, org.kuali.rice.krad.data.util.Link autoLink) A helper method which simply assembles a set of property paths for the givenLinkannotation which should be auto linked.- Parameters:
path- the property path from the top-most root class to where the Link annotation was found during the scanautoLink- the Link annotation which is being processed- Returns:
- a Set of auto linking paths based on the given path parameter, plus the path(s) defined on the
Linkannotation
-
extractAutoLinkTargets
protected List<org.kuali.rice.krad.web.bind.UifServletRequestDataBinder.AutoLinkTarget> extractAutoLinkTargets(Set<String> autoLinkingPaths) Uses the binding result on this data binder to determine the targets on the form that automatic linking should be performed against.Only those property paths for which auto linking is enabled and which were actually modified during the execution of this data binding will be returned from this method.
- Parameters:
autoLinkingPaths- a set of paths relative to the form class for which auto-linking has been enabled- Returns:
- a list of
UifServletRequestDataBinder.AutoLinkTargetobjects which contain an object to be linked and which properties on that object were modified during this data binding execution
-
extractAutoLinkMapTargets
protected List<org.kuali.rice.krad.web.bind.UifServletRequestDataBinder.AutoLinkTarget> extractAutoLinkMapTargets(String autoLinkingPath, Map<?, ?> targetMap) For the map object indicated for linking, iterates through the modified paths and finds paths that match entries in the map, and if found adds an auto link target.- Parameters:
autoLinkingPath- path configured for auto linkingtargetMap- map object for the linking path- Returns:
- List of auto linking targets to process
-
extractAutoLinkListTargets
protected List<org.kuali.rice.krad.web.bind.UifServletRequestDataBinder.AutoLinkTarget> extractAutoLinkListTargets(String autoLinkingPath, List<?> targetList) For the list object indicated for linking, iterates through the modified paths and finds paths that match entries in the list, and if found adds an auto link target.- Parameters:
autoLinkingPath- path configured for auto linkingtargetList- list object for the linking path- Returns:
- List of auto linking targets to process
-
getViewByType
Attempts to get a view instance by looking for a view type name in the request or the form and querying that view type with the request parameters- Parameters:
request- request instance to pull parameters fromform- form instance to pull values from- Returns:
- View instance if found or null
-
getViewFromPreviousModel
Attempts to get a view instance based on the view id stored on the form (which might not be populated from the request but remaining from session)- Parameters:
form- form instance to pull view id from- Returns:
- View instance associated with form's view id or null if id or view not found
-
isChangeTracking
public boolean isChangeTracking() -
isAutoLinking
public boolean isAutoLinking() -
setAutoLinking
public void setAutoLinking(boolean autoLinking) -
getViewService
-
getDataObjectService
public org.kuali.rice.krad.data.DataObjectService getDataObjectService() -
setDataObjectService
public void setDataObjectService(org.kuali.rice.krad.data.DataObjectService dataObjectService)
-