use of org.asqatasun.webapp.ui.form.SelectFormField in project Asqatasun by Asqatasun.
the class AbstractAuditSetUpController method displayFormWithErrors.
/**
* @param model
* @param contract
* @param auditSetUpCommand
* @param authorisedReferentialList
* @param parametersMap
* @return
*/
private String displayFormWithErrors(Model model, Contract contract, AuditSetUpCommand auditSetUpCommand, Collection<String> authorisedReferentialList, Map<String, List<AuditSetUpFormField>> parametersMap) {
model.addAttribute(TgolKeyStore.EXPANDED_KEY, TgolKeyStore.EXPANDED_VALUE);
model.addAttribute(TgolKeyStore.AUDIT_SET_UP_COMMAND_KEY, auditSetUpCommand);
model.addAttribute(TgolKeyStore.PARAMETERS_MAP_KEY, parametersMap);
// Get a fresh list of the auditSetUpFormField that handles the choice
// of the referential and its level
List<SelectFormField> refAndLevelFormFieldList = this.getFreshRefAndLevelSetUpFormFieldList(authorisedReferentialList, referentialAndLevelFormFieldBuilderList);
// Otherwise it corresponds to the default behaviour;
// The selection of default level is delegated to the helper.
// When the form is on error, the default level value corresponds to the
// one the user has chosen.
auditSetUpFormFieldHelper.selectDefaultLevelFromLevelValue(refAndLevelFormFieldList, auditSetUpCommand.getLevel());
model.addAttribute(TgolKeyStore.LEVEL_LIST_KEY, refAndLevelFormFieldList);
// if the user is authenticated, the url of the form is under
// /home/contract/. To display error pages, we need to precise the
// backward relative path and to add the breadCrumb.
model.addAttribute(TgolKeyStore.CONTRACT_NAME_KEY, contract.getLabel());
ScopeEnum auditScope = auditSetUpCommand.getScope();
switch(auditScope) {
case DOMAIN:
return TgolKeyStore.AUDIT_SITE_SET_UP_VIEW_NAME;
case PAGE:
return TgolKeyStore.AUDIT_PAGE_SET_UP_VIEW_NAME;
case FILE:
return TgolKeyStore.AUDIT_UPLOAD_SET_UP_VIEW_NAME;
}
return TgolKeyStore.OUPS_VIEW_NAME;
}
Aggregations