Class CollectionGroupLineBuilder
- All Implemented Interfaces:
Serializable
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds aBindingInfoinstance for the given binding path to the collection groups unauthorized list.protected voidadjustFieldBinding(Field lineField, String bindingPath) Adjusts the binding path for the given field to match the collections path.protected voidadjustFieldBindingAndId(List<Field> lineFields, String bindingPath) Adjusts the binding path for the given fields to match the collections path, and sets the container id suffix for the fields so all nested components will get their ids adjusted.protected voidadjustFieldId(Field lineField) Adjusts the id suffix for the given field.protected voidapplyLineFieldAuthorizationAndPresentationLogic(boolean readOnlyLine, List<Field> lineFields, List<? extends Component> actionList) Iterates through the line fields and checks the view field authorization using the view's configured authorizer and presentation controller.protected voidapplyOnChangeForSave(List<Field> lineFields) IfCollectionGroup.isRenderSaveLineActions()is true and the line has been added by the user, on change script is added to any controls in the line to enable the save action.voidInvoked to build a line in the collection.protected voidFor each configured sub collection of the collection group, creates a field group by copyingCollectionLayoutManager.getSubCollectionFieldGroupPrototype()and adds to a list which is stored in the line context.protected booleancheckEditLineAuthorization(List<Field> lineFields) Determines whether the user is authorized to the edit the line.protected booleancheckEditLineAuthorizationAndPresentationLogic(CollectionGroup collectionGroup, ViewModel model, Object currentLine) Invokes the view's configured authorizer and presentation controller to determine if the user has permission to edit the line (if a permission has been established).protected booleancheckSubCollectionRender(CollectionGroup subCollectionGroup) Checks whether the given sub-collection should be rendered, any conditional render string is evaluated.protected booleanDetermines whether the user is authorized to the view the line.protected booleanInvokes the view's configured authorizer and presentation controller to determine if the user has permission to view the line (if a permission has been established).getContextForField(View view, CollectionGroup collectionGroup, Field field) Helper method to build the context for a field (needed because the apply model phase for line fields has not been applied yet and their full context not set)Copies either the collections groups items or add line items to a list of components that will be used for the collection line.voidPerforms various preprocessing of the line components and configuration.processAnyRemoteFieldsHolder(CollectionGroup group, List<? extends Component> items) Iterates through the given items checking forRemotableFieldsHolder, if found the holder is invoked to retrieved the remotable fields and translate to attribute fields.removeNonRenderLineFields(List<Field> lineFields) Evaluates the render property for the given list of field instances for the line and removes any fields from the returned list that have render false.protected voidsetFocusOnIdForActions(List<Action> actions, List<Field> lineFields) For any actions with focus idUifConstants.Order.LINE_FIRST, the focus id is replaced to match to id of the first control in the line.protected voidsetupAddLineControlValidation(List<Field> lineFields) Add additional information to the fields in the add line to allow for correct add control selection.protected voidsetupAddLineControlValidation(InputField lineField, List<String> selectors, String suffix) Add additional information to a field in the add line to allow for correct add control selection.protected voidSetup edit line dialog group with the line fields
-
Constructor Details
-
CollectionGroupLineBuilder
-
-
Method Details
-
buildLine
public void buildLine()Invoked to build a line in the collection.First the context for the line is preprocessed in
preprocessLine(). After preprocessing the configured layout manager is invoked to place the line into the layout. -
preprocessLine
public void preprocessLine()Performs various preprocessing of the line components and configuration.Preprocessing includes:
- Make a copy of the collection groups items and adjust binding and id
- Process any remotable fields within the line
- Check line and field authorization
- Remove fields that should not be rendered
- Configure client side functionality such as save enable and add line validation
- Build field groups to hold any configured sub-collections
-
initializeLineItems
Copies either the collections groups items or add line items to a list of components that will be used for the collection line.- Returns:
- list of component instance for the collection line
-
processAnyRemoteFieldsHolder
public List<Field> processAnyRemoteFieldsHolder(CollectionGroup group, List<? extends Component> items) Iterates through the given items checking forRemotableFieldsHolder, if found the holder is invoked to retrieved the remotable fields and translate to attribute fields.The translated list is then inserted into the returned list at the position of the holder
- Parameters:
group- collection group instance to check for any remotable fields holderitems- list of items to process
-
adjustFieldBindingAndId
Adjusts the binding path for the given fields to match the collections path, and sets the container id suffix for the fields so all nested components will get their ids adjusted.- Parameters:
lineFields- list of fields to updatebindingPath- binding path to add
-
adjustFieldBinding
Adjusts the binding path for the given field to match the collections path.- Parameters:
lineField- field to updatebindingPath- binding path to add
-
adjustFieldId
Adjusts the id suffix for the given field.- Parameters:
lineField- field to update
-
setFocusOnIdForActions
For any actions with focus idUifConstants.Order.LINE_FIRST, the focus id is replaced to match to id of the first control in the line.- Parameters:
actions- list of actions to potientially updatelineFields- list of line fields, the control for the first field in the list will be used for the focus id
-
applyOnChangeForSave
IfCollectionGroup.isRenderSaveLineActions()is true and the line has been added by the user, on change script is added to any controls in the line to enable the save action.- Parameters:
lineFields- list of line fields
-
removeNonRenderLineFields
Evaluates the render property for the given list of field instances for the line and removes any fields from the returned list that have render false.The conditional render string is also taken into account. This needs to be done here as opposed to during the normal condition evaluation so the the fields are not used while building the collection lines
- Parameters:
lineFields- list of fields configured for the line- Returns:
- list of field instances that should be rendered
-
checkViewLineAuthorization
protected boolean checkViewLineAuthorization()Determines whether the user is authorized to the view the line.- Returns:
- boolean true if the user can view the line, false if not
-
checkViewLineAuthorizationAndPresentationLogic
protected boolean checkViewLineAuthorizationAndPresentationLogic()Invokes the view's configured authorizer and presentation controller to determine if the user has permission to view the line (if a permission has been established).- Returns:
- true if the user can view the line, false if not
-
checkEditLineAuthorization
Determines whether the user is authorized to the edit the line.- Parameters:
lineFields- list of fields configured for the line- Returns:
- boolean true if the user can edit the line, false if not
-
checkEditLineAuthorizationAndPresentationLogic
protected boolean checkEditLineAuthorizationAndPresentationLogic(CollectionGroup collectionGroup, ViewModel model, Object currentLine) Invokes the view's configured authorizer and presentation controller to determine if the user has permission to edit the line (if a permission has been established).- Returns:
- true if the user can edit the line, false if not
-
addUnauthorizedBindingInfo
protected void addUnauthorizedBindingInfo()Adds aBindingInfoinstance for the given binding path to the collection groups unauthorized list. -
applyLineFieldAuthorizationAndPresentationLogic
protected void applyLineFieldAuthorizationAndPresentationLogic(boolean readOnlyLine, List<Field> lineFields, List<? extends Component> actionList) Iterates through the line fields and checks the view field authorization using the view's configured authorizer and presentation controller.If the field is viewable, then sets the edit field authorization. Finally iterates through the line actions invoking the authorizer and presentation controller to authorizer the action
- Parameters:
readOnlyLine- flag indicating whether the line has been marked as read only (which will force the fields to be read only)lineFields- list of fields instances for the lineactionList- list of action field instances for the line
-
buildSubCollectionFieldGroups
protected void buildSubCollectionFieldGroups()For each configured sub collection of the collection group, creates a field group by copyingCollectionLayoutManager.getSubCollectionFieldGroupPrototype()and adds to a list which is stored in the line context. -
checkSubCollectionRender
Checks whether the given sub-collection should be rendered, any conditional render string is evaluated.- Parameters:
subCollectionGroup- sub collection group to check render status for- Returns:
- true if sub collection should be rendered, false if it should not be rendered
-
setupAddLineControlValidation
Add additional information to the fields in the add line to allow for correct add control selection.- Parameters:
lineFields- list of fields instances for the line
-
setupAddLineControlValidation
protected void setupAddLineControlValidation(InputField lineField, List<String> selectors, String suffix) Add additional information to a field in the add line to allow for correct add control selection.- Parameters:
lineField- field instance for the lineselectors- list of selectorssuffix- id suffix to add
-
setupEditLineDetails
protected void setupEditLineDetails()Setup edit line dialog group with the line fieldsThe items for a dialog are created from line fields and added if not provided by the user, but if they are then each item is processed.
-
getContextForField
protected Map<String,Object> getContextForField(View view, CollectionGroup collectionGroup, Field field) Helper method to build the context for a field (needed because the apply model phase for line fields has not been applied yet and their full context not set)- Parameters:
view- view instance the field belongs tocollectionGroup- collection group instance the field belongs tofield- field instance to build context for- Returns:
- Mapinvalid input: '<'String, Object> context for field
-