public class ViewHelperServiceImpl extends Object implements ViewHelperService, Serializable
ViewHelperService| Constructor and Description |
|---|
ViewHelperServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCustomContainerComponents(ViewModel model,
Container container)
Hook for creating new components with code and adding them to a container
|
protected int |
addLine(Collection<Object> collection,
Object addLine,
boolean insertFirst)
Add addLine to collection while giving derived classes an opportunity to override for things
like sorting.
|
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)
Finds the
Inquirable configured for the given data object class and delegates to
it for building the inquiry URL
Invoked by the Inquiry widget to build the inquiry link |
protected boolean |
containsDuplicateLine(Object addLine,
Collection<Object> collectionItems,
List<String> duplicateLinePropertyNames)
Determines whether the new line matches one of the entries in the existing collection, based on the
duplicateLinePropertyNames. |
protected Object |
extractNewValuesAndAssign(String collectionPath,
int selectedLineIndex,
Map<String,String[]> parameters,
List<Object> collection)
Gets the current object from the collection and assigns the new values to it.
|
protected String |
extractSingleValue(String[] data)
Extract a single value form an array of strings
|
protected Map<String,String> |
filterByReturnedFieldConversions(String multiValueReturnFields,
Map<String,String> fieldConversions)
Filters the field conversions by the multi value return fields
|
protected ConfigurationService |
getConfigurationService()
Gets the configuration service
|
protected DataDictionaryService |
getDataDictionaryService()
Gets the data dictionary service
|
protected DataObjectService |
getDataObjectService() |
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.
|
protected LegacyDataAdapter |
getLegacyDataAdapter()
Get the legacy data adapter.
|
protected ViewDictionaryService |
getViewDictionaryService()
Gets the view dictionary service
|
protected boolean |
isDuplicateLine(Object addLine,
Object collectionItem,
List<String> duplicateLinePropertyNames)
Determines whether the new
addLine is a duplicate of collectionItem, based on the
duplicateLinePropertyNames. |
protected boolean |
linkAddedLine(Object model,
String collectionPath,
int addedIndex)
Set the parent for bi-directional relationships when adding a line to a collection.
|
protected void |
logAndThrowRuntime(String message)
Log an error message using log4j, then throw a runtime exception with the provided message.
|
protected boolean |
performAddLineValidation(ViewModel viewModel,
Object newLine,
String collectionId,
String collectionPath)
Performs validation on the new collection line before it is added to the corresponding collection.
|
void |
performCustomApplyModel(LifecycleElement element,
Object model)
Hook for service overrides to perform custom apply model logic on the component
|
void |
performCustomFinalize(LifecycleElement element,
Object model,
LifecycleElement parent)
Hook for service overrides to perform custom component finalization
|
void |
performCustomInitialization(LifecycleElement element)
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.
|
protected boolean |
performDeleteLineValidation(ViewModel model,
String collectionId,
String collectionPath,
Object deleteLine)
Performs validation on the collection line before it is removed from the corresponding collection.
|
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 lineObject,
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 |
processAfterEditLine(ViewModel model,
Object lineObject,
String collectionId,
String collectionPath)
Hook for service overrides to process the edit collection line after it has been validated
|
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 |
processAndAddLineObject(ViewModel viewModel,
Object newLine,
String collectionId,
String collectionPath)
Do all processing related to adding a line: calls processBeforeAddLine, performAddLineValidation, addLine,
processAfterAddLine
|
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 |
processBeforeEditLine(ViewModel model,
Object lineObject,
String collectionId,
String collectionPath)
Hook for service overrides to process the edit collection line before it is validated
|
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 |
processCollectionCloseEditLineDialog(ViewModel model,
String collectionId,
String collectionPath,
int selectedLineIndex)
Invoked when the close edit line dialog 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 |
processCollectionEditLine(ViewModel model,
CollectionControllerServiceImpl.CollectionActionParameters parameterData)
Invoked when the edit line action is chosen for a collection.
|
void |
processCollectionRetrieveEditLineDialog(ViewModel model,
String collectionId,
String collectionPath,
int selectedLineIndex)
Invoked when the retrieve edit line dialog action is chosen for a collection.
|
void |
processCollectionSaveLine(ViewModel model,
CollectionControllerServiceImpl.CollectionActionParameters parameterData)
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 |
setConfigurationService(ConfigurationService configurationService)
Sets the configuration service
|
void |
setDataDictionaryService(DataDictionaryService dataDictionaryService)
Sets the data dictionary service
|
protected void |
setDataObjectService(DataObjectService dataObjectService) |
void |
setElementContext(LifecycleElement element,
LifecycleElement parent)
Invoked to set up the context for an element.
|
void |
setExpressionEvaluatorFactory(ExpressionEvaluatorFactory expressionEvaluatorFactory)
Setter for
getExpressionEvaluatorFactory(). |
void |
setLegacyDataAdapter(LegacyDataAdapter legacyDataAdapter)
Set the legacy data adapter.
|
void |
setViewContext()
Sets up the view context which will be available to other components through their context
for conditional logic evaluation.
|
void |
setViewDictionaryService(ViewDictionaryService viewDictionaryService)
Sets the view dictionary service
|
public ViewHelperServiceImpl()
public void addCustomContainerComponents(ViewModel model, Container 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
addCustomContainerComponents in interface ViewHelperServicemodel - object containing the view datacontainer - container instance to add components topublic void buildInquiryLink(Object dataObject, String propertyName, Inquiry inquiry)
Inquirable configured for the given data object class and delegates to
it for building the inquiry URL
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
buildInquiryLink in interface ViewHelperServicedataObject - parent object for the inquiry propertypropertyName - name of the property the inquiry is being built forinquiry - instance of the inquiry widget being built for the propertypublic void performCustomApplyModel(LifecycleElement element, Object model)
performCustomApplyModel in interface ViewHelperServiceelement - component instance to apply model tomodel - Top level object containing the data (could be the model or a top level business
object, dto)public void performCustomFinalize(LifecycleElement element, Object model, LifecycleElement parent)
performCustomFinalize in interface ViewHelperServiceelement - component instance to updatemodel - Top level object containing the dataparent - Parent component for the component being finalizedpublic void performCustomInitialization(LifecycleElement element)
performCustomInitialization in interface ViewHelperServiceelement - component instance to initializepublic void performCustomViewFinalize(Object model)
performCustomViewFinalize in interface ViewHelperServicemodel - Top level object containing the datapublic void performCustomViewInitialization(Object model)
performCustomViewInitialization in interface ViewHelperServicemodel - The model.public void processAfterAddLine(ViewModel model, Object lineObject, String collectionId, String collectionPath, boolean isValidLine)
processAfterAddLine in interface ViewHelperServicemodel - object instance that contain's the views datalineObject - the new line that was addedcollectionId - the id of the collection being added tocollectionPath - the path to the collection being modifiedisValidLine - indicates if the line is validpublic void processAfterDeleteLine(ViewModel model, String collectionId, String collectionPath, int lineIndex)
processAfterDeleteLine in interface ViewHelperServicemodel - object instance that contains the views datacollectionId - the id of the collection being added tocollectionPath - the path to the collection being modifiedlineIndex - index of the line that was deletedpublic void processAfterSaveLine(ViewModel model, Object lineObject, String collectionId, String collectionPath)
processAfterSaveLine in interface ViewHelperServicemodel - object instance that contains the views datalineObject - the line instance to be processedcollectionId - the id of the collection being added tocollectionPath - the path to the collection being modifiedpublic void processBeforeAddLine(ViewModel model, Object addLine, String collectionId, String collectionPath)
processBeforeAddLine in interface ViewHelperServicemodel - object instance that contain's the view's dataaddLine - the new line instance to be processedcollectionId - the id of the collection being added tocollectionPath - the path to the collection being modifiedpublic void processBeforeSaveLine(ViewModel model, Object lineObject, String collectionId, String collectionPath)
processBeforeSaveLine in interface ViewHelperServicemodel - object instance that contain's the views datalineObject - the line instance to be processedcollectionId - the id of the collection being added tocollectionPath - the path to the collection being modifiedpublic void processBeforeEditLine(ViewModel model, Object lineObject, String collectionId, String collectionPath)
processBeforeEditLine in interface ViewHelperServicemodel - object instance that contain's the views datalineObject - the line instance to be processedcollectionId - the id of the collection being edited fromcollectionPath - the path to the collection being modifiedpublic void processAfterEditLine(ViewModel model, Object lineObject, String collectionId, String collectionPath)
processAfterEditLine in interface ViewHelperServicemodel - object instance that contains the views datalineObject - the line instance to be processedcollectionId - the id of the collection being edited fromcollectionPath - the path to the collection being modifiedpublic void processCollectionAddBlankLine(ViewModel model, String collectionId, String collectionPath)
Adds a new collection item to the collection and applies any default values.
processCollectionAddBlankLine in interface ViewHelperServicemodel - Top level object containing the view data including the collection and new linecollectionId - the id of the collection being added tocollectionPath - the path to the collection being modifiedpublic void processCollectionAddLine(ViewModel model, String collectionId, String collectionPath)
MessageMapprocessCollectionAddLine in interface ViewHelperServicemodel - Top level object containing the view data including the
collection and new linecollectionId - the id of the collection being added tocollectionPath - the path to the collection being modifiedpublic void processAndAddLineObject(ViewModel viewModel, Object newLine, String collectionId, String collectionPath)
processAndAddLineObject in interface ViewHelperServiceviewModel - object instance that contain's the view's datanewLine - the new line instance to be processedcollectionId - the id of the collection being added tocollectionPath - the path to the collection being modifiedpublic void processCollectionDeleteLine(ViewModel model, String collectionId, String collectionPath, int lineIndex)
MessageMapprocessCollectionDeleteLine in interface ViewHelperServicemodel - Top level object containing the view data including the collectioncollectionId - the id of the collection being added tocollectionPath - the path to the collection being modifiedlineIndex - index of the collection line that was selected for removalpublic void processCollectionRetrieveEditLineDialog(ViewModel model, String collectionId, String collectionPath, int selectedLineIndex)
processCollectionRetrieveEditLineDialog in interface ViewHelperServicemodel - Top level object containing the view data including the collection and new linecollectionId - the id of the collection being added tocollectionPath - the path to the collection being modifiedselectedLineIndex - The index within the collection of the line to edit.public void processCollectionEditLine(ViewModel model, CollectionControllerServiceImpl.CollectionActionParameters parameterData)
processCollectionEditLine in interface ViewHelperServicemodel - Top level object containing the view data including the collection and new lineparameterData - the parameters for edit line requestpublic void processCollectionCloseEditLineDialog(ViewModel model, String collectionId, String collectionPath, int selectedLineIndex)
processCollectionCloseEditLineDialog in interface ViewHelperServicemodel - Top level object containing the view data including the collection and new linecollectionId - the id of the collection being added tocollectionPath - the path to the collection being modifiedselectedLineIndex - The index within the collection of the line to edit.public void processCollectionSaveLine(ViewModel model, CollectionControllerServiceImpl.CollectionActionParameters parameterData)
processCollectionSaveLine in interface ViewHelperServicemodel - Top level object containing the view data including the collection and new lineparameterData - the parameters for save line requestprotected Object extractNewValuesAndAssign(String collectionPath, int selectedLineIndex, Map<String,String[]> parameters, List<Object> collection)
collectionPath - the path to the collection being modifiedselectedLineIndex - The index within the collection of the line to save.parameters - the path to the collection being modifiedcollection - the collection of the lines of dataprotected String extractSingleValue(String[] data)
data - the array of stringspublic void processMultipleValueLookupResults(ViewModel model, String collectionId, String collectionPath, String multiValueReturnFields, String lookupResultValues)
processMultipleValueLookupResults in interface ViewHelperServicemodel - object containing the view datacollectionId - the id of the collection being added tocollectionPath - the path to the collection being modifiedmultiValueReturnFields - String containing the selected line field nameslookupResultValues - String containing the selected line valuesprotected int addLine(Collection<Object> collection, Object addLine, boolean insertFirst)
collection - the Collection to add the given addLine toaddLine - the line to add to the given collectioninsertFirst - indicates if the item should be inserted as the first itemprotected boolean linkAddedLine(Object model, String collectionPath, int addedIndex)
model - the view datacollectionPath - the path to the collection being linkedaddedIndex - the index of the added lineprotected boolean performAddLineValidation(ViewModel viewModel, Object newLine, String collectionId, String collectionPath)
viewModel - object instance that contain's the view's datanewLine - the new line instance to be processedcollectionId - the id of the collection being added tocollectionPath - the path to the collection being modifiedprotected Map<String,String> filterByReturnedFieldConversions(String multiValueReturnFields, Map<String,String> fieldConversions)
multiValueReturnFields - the return fields to filter by, as a comma separated stringfieldConversions - the map of field conversions to filterMap containing the filtered field conversionsprotected boolean containsDuplicateLine(Object addLine, Collection<Object> collectionItems, List<String> duplicateLinePropertyNames)
duplicateLinePropertyNames.addLine - new line instance to validatecollectionItems - items in the collectionduplicateLinePropertyNames - property names to check for duplicatesprotected boolean isDuplicateLine(Object addLine, Object collectionItem, List<String> duplicateLinePropertyNames)
addLine is a duplicate of collectionItem, based on the
duplicateLinePropertyNames.addLine - new line instance to validatecollectionItem - existing instance to validateduplicateLinePropertyNames - the property names to check for duplicatesaddLine is a duplicate of collectionItem, false otherwiseprotected boolean performDeleteLineValidation(ViewModel model, String collectionId, String collectionPath, Object deleteLine)
model - object instance that contain's the view's datacollectionId - the id of the collection being added tocollectionPath - the path to the collection being modifieddeleteLine - line that will be removedpublic void applyDefaultValuesForCollectionLine(CollectionGroup collectionGroup, Object line)
applyDefaultValuesForCollectionLine in interface ViewHelperServicecollectionGroup - The collection group.line - The model object backing the line.public void applyDefaultValues(Component component)
applyDefaultValues in interface ViewHelperServicecomponent - component that should be checked for default valuespublic void populateViewFromRequestParameters(Map<String,String> parameters)
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
populateViewFromRequestParameters in interface ViewHelperServiceparameters - The request parameters that apply to the view.RequestParameterpublic String buildGrowlScript()
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
buildGrowlScript in interface ViewHelperServicepublic void populateDefaultValueForField(Object object, DataField dataField, String bindingPath)
populateDefaultValueForField in interface ViewHelperServiceobject - object that should be populateddataField - field to check for configured default valuebindingPath - path to the property on the object that should be populatedpublic Object getDefaultValueForField(Object object, DataField dataField)
The field's default value is determined in the following order:
getDefaultValueForField in interface ViewHelperServiceobject - object that should be populateddataField - field to retrieve default value forpublic void refreshReference(Object parentObject, String referenceObjectName)
The object needs to be of type PersistableBusinessObject.
refreshReference in interface ViewHelperServiceparentObject - parent object that references the object to be refreshedreferenceObjectName - property name of the parent object to be refreshedpublic void refreshReferences(String referencesToRefresh)
The the individual references in the referencesToRefresh string are separated by KRADConstants.REFERENCES_TO_REFRESH_SEPARATOR).
refreshReferences in interface ViewHelperServicereferencesToRefresh - list of references to refresh (public void retrieveEditModesAndActionFlags()
PresentationController and Authorizer for
the view to get the exported action flags and edit modes that can be used in conditional
logicretrieveEditModesAndActionFlags in interface ViewHelperServicepublic void setViewContext()
setViewContext in interface ViewHelperServicepublic void setElementContext(LifecycleElement element, LifecycleElement parent)
Context is primarily used for expression evaluation. Any object in the context for a component will be available as a variable within expressions.
setElementContext in interface ViewHelperServiceelement - element to setup context forparent - parent of the given elementprotected ConfigurationService getConfigurationService()
public void setConfigurationService(ConfigurationService configurationService)
configurationService - The configuration service.protected DataDictionaryService getDataDictionaryService()
public void setDataDictionaryService(DataDictionaryService dataDictionaryService)
dataDictionaryService - The dictionary service.protected ViewDictionaryService getViewDictionaryService()
public void setViewDictionaryService(ViewDictionaryService viewDictionaryService)
viewDictionaryService - The view dictionary service.public ExpressionEvaluatorFactory getExpressionEvaluatorFactory()
getExpressionEvaluatorFactory in interface ViewHelperServicepublic void setExpressionEvaluatorFactory(ExpressionEvaluatorFactory expressionEvaluatorFactory)
getExpressionEvaluatorFactory().expressionEvaluatorFactory - expression evaluator factoryprotected LegacyDataAdapter getLegacyDataAdapter()
protected DataObjectService getDataObjectService()
protected void setDataObjectService(DataObjectService dataObjectService)
public void setLegacyDataAdapter(LegacyDataAdapter legacyDataAdapter)
legacyDataAdapter - The legacy data adapter.protected void logAndThrowRuntime(String message)
message - The error message.Copyright © 2005–2014 The Kuali Foundation. All rights reserved.