Search in sources :

Example 1 with AuditSetUpFormValidator

use of org.asqatasun.webapp.validator.AuditSetUpFormValidator in project Asqatasun by Asqatasun.

the class AuditScenarioController method submitForm.

@RequestMapping(value = TgolKeyStore.AUDIT_SCENARIO_SET_UP_CONTRACT_URL, method = RequestMethod.POST)
@Secured({ TgolKeyStore.ROLE_USER_KEY, TgolKeyStore.ROLE_ADMIN_KEY })
protected String submitForm(@ModelAttribute(TgolKeyStore.ADD_SCENARIO_COMMAND_KEY) AuditSetUpCommand auditSetUpCommand, BindingResult result, Model model, HttpServletRequest request) {
    Contract contract = getContractDataService().read(auditSetUpCommand.getContractId());
    Map<String, List<AuditSetUpFormField>> formFielMap = getFreshAuditSetUpFormFieldMap(contract, getScenarioOptionFormFieldBuilderMap());
    AuditSetUpFormValidator auditSetUpFormValidator = getAuditSiteSetUpFormValidator();
    return submitForm(contract, auditSetUpCommand, formFielMap, auditSetUpFormValidator, model, result, request);
}
Also used : AuditSetUpFormValidator(org.asqatasun.webapp.validator.AuditSetUpFormValidator) Contract(org.asqatasun.webapp.entity.contract.Contract) Secured(org.springframework.security.access.annotation.Secured) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with AuditSetUpFormValidator

use of org.asqatasun.webapp.validator.AuditSetUpFormValidator in project Asqatasun by Asqatasun.

the class AuditSetUpController method submitAuditSetUpForm.

/**
     * Submit in case of site audit
     * @param auditSetUpCommand
     * @param result
     * @param model
     * @param request
     * @return 
     */
@RequestMapping(method = RequestMethod.POST)
@Secured({ TgolKeyStore.ROLE_USER_KEY, TgolKeyStore.ROLE_ADMIN_KEY })
protected String submitAuditSetUpForm(@ModelAttribute(TgolKeyStore.AUDIT_SET_UP_COMMAND_KEY) AuditSetUpCommand auditSetUpCommand, BindingResult result, Model model, HttpServletRequest request) {
    Contract contract = getContractDataService().read(auditSetUpCommand.getContractId());
    Map<String, List<AuditSetUpFormField>> formFielMap = null;
    AuditSetUpFormValidator auditSetUpFormValidator = null;
    if (auditSetUpCommand.getRelaunch()) {
        return launchAudit(contract, auditSetUpCommand, model, request);
    }
    switch(auditSetUpCommand.getScope()) {
        case DOMAIN:
            formFielMap = getFreshAuditSetUpFormFieldMap(contract, getSiteOptionFormFieldBuilderMap());
            auditSetUpFormValidator = getAuditSiteSetUpFormValidator();
            break;
        case PAGE:
            formFielMap = getFreshAuditSetUpFormFieldMap(contract, getPageOptionFormFieldBuilderMap());
            auditSetUpFormValidator = getAuditPageSetUpFormValidator();
            break;
        case FILE:
            formFielMap = getFreshAuditSetUpFormFieldMap(contract, getUploadOptionFormFieldBuilderMap());
            auditSetUpFormValidator = getAuditUploadSetUpFormValidator();
            break;
    }
    return submitForm(contract, auditSetUpCommand, formFielMap, auditSetUpFormValidator, model, result, request);
}
Also used : AuditSetUpFormValidator(org.asqatasun.webapp.validator.AuditSetUpFormValidator) List(java.util.List) Contract(org.asqatasun.webapp.entity.contract.Contract) Secured(org.springframework.security.access.annotation.Secured) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Contract (org.asqatasun.webapp.entity.contract.Contract)2 AuditSetUpFormValidator (org.asqatasun.webapp.validator.AuditSetUpFormValidator)2 Secured (org.springframework.security.access.annotation.Secured)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 List (java.util.List)1