use of org.asqatasun.webapp.command.ManualAuditCommand in project Asqatasun by Asqatasun.
the class AbstractAuditResultController method prepareSuccessfullPageData.
/**
* This methods handles audit data in case of page type audit
*
* @param page
* @param audit
* @param model
* @param displayScope
* @param isManualAudit
* @param manualAuditCommand
* @return the success audit page result view name
*/
protected String prepareSuccessfullPageData(Page page, Audit audit, Model model, String displayScope, boolean isManualAudit, ManualAuditCommand manualAuditCommand) {
Contract contract = retrieveContractFromAudit(audit);
if (!audit.getStatus().equals(AuditStatus.COMPLETED) && !audit.getStatus().equals(AuditStatus.MANUAL_ANALYSE_IN_PROGRESS) && !audit.getStatus().equals(AuditStatus.MANUAL_COMPLETED) && !audit.getStatus().equals(AuditStatus.MANUAL_INITIALIZING)) {
return prepareFailedAuditData(audit, model);
}
model.addAttribute(TgolKeyStore.STATUS_KEY, computeAuditStatus(audit));
model.addAttribute(TgolKeyStore.RESULT_ACTION_LIST_KEY, actionHandler.getActionList("EXPORT"));
// Attributes for breadcrumb
model.addAttribute(TgolKeyStore.CONTRACT_ID_KEY, contract.getId());
model.addAttribute(TgolKeyStore.CONTRACT_NAME_KEY, contract.getLabel());
model.addAttribute(TgolKeyStore.AUDIT_ID_KEY, audit.getId());
// Add a boolean used to display the breadcrumb.
model.addAttribute(TgolKeyStore.AUTHORIZED_SCOPE_FOR_PAGE_LIST, isAuthorizedScopeForPageList(audit));
// Add a command to relaunch the audit from the result page
model.addAttribute(TgolKeyStore.AUDIT_SET_UP_COMMAND_KEY, AuditSetUpCommandFactory.getInstance().getPageAuditSetUpCommand(contract, page.getURL(), getParameterDataService().getParameterSetFromAudit(audit)));
if (StringUtils.equalsIgnoreCase(displayScope, TgolKeyStore.TEST_DISPLAY_SCOPE_VALUE)) {
AuditResultSortCommand asuc = ((AuditResultSortCommand) model.asMap().get(TgolKeyStore.AUDIT_RESULT_SORT_COMMAND_KEY));
model.addAttribute(TgolKeyStore.TEST_RESULT_LIST_KEY, TestResultFactory.getInstance().getTestResultSortedByThemeMap(page, getPageScope(), asuc.getSortOptionMap().get(themeSortKey).toString(), getTestResultSortSelection(asuc)));
if (isManualAudit) {
if (manualAuditCommand == null) {
manualAuditCommand = new ManualAuditCommand();
}
manualAuditCommand.setModifedManualResultMap(TestResultFactory.getInstance().getTestResultMap(page, getPageScope(), asuc.getSortOptionMap().get(themeSortKey).toString(), getTestResultSortSelection(asuc)));
model.addAttribute(TgolKeyStore.MANUAL_AUDIT_COMMAND_KEY, manualAuditCommand);
}
return TgolKeyStore.RESULT_PAGE_VIEW_NAME;
} else {
AuditResultSortCommand asuc = ((AuditResultSortCommand) model.asMap().get(TgolKeyStore.AUDIT_RESULT_SORT_COMMAND_KEY));
model.addAttribute(TgolKeyStore.CRITERION_RESULT_LIST_KEY, CriterionResultFactory.getInstance().getCriterionResultSortedByThemeMap(page, asuc.getSortOptionMap().get(themeSortKey).toString(), getTestResultSortSelection(asuc)));
return TgolKeyStore.RESULT_PAGE_BY_CRITERION_VIEW_NAME;
}
}
use of org.asqatasun.webapp.command.ManualAuditCommand in project Asqatasun by Asqatasun.
the class ManualAuditValidator method validate.
@Override
public void validate(Object target, Errors errors) {
ManualAuditCommand manualAuditCommand = (ManualAuditCommand) target;
checkAuditManuelExist(manualAuditCommand.getProcessResultList(), errors);
}
Aggregations