use of se.inera.intyg.common.support.modules.support.api.dto.ValidationStatus in project webcert by sklintyg.
the class UtkastServiceImpl method convertToDraftValidation.
private DraftValidation convertToDraftValidation(ValidateDraftResponse dr) {
DraftValidation draftValidation = new DraftValidation();
ValidationStatus validationStatus = dr.getStatus();
// Always return the warning messages
for (ValidationMessage validationWarning : dr.getValidationWarnings()) {
draftValidation.addWarning(new DraftValidationMessage(validationWarning.getCategory(), validationWarning.getField(), validationWarning.getType(), validationWarning.getMessage(), validationWarning.getDynamicKey()));
}
if (ValidationStatus.VALID.equals(validationStatus)) {
LOG.debug("Validation is OK");
return draftValidation;
}
draftValidation.setStatus(ValidationStatus.INVALID);
// Only bother with returning validation (e.g. error) messages if the ArendeDraft is INVALID.
for (ValidationMessage validationMsg : dr.getValidationErrors()) {
draftValidation.addMessage(new DraftValidationMessage(validationMsg.getCategory(), validationMsg.getField(), validationMsg.getType(), validationMsg.getMessage(), validationMsg.getDynamicKey()));
}
LOG.debug("Validation failed with {} validation messages", draftValidation.getMessages().size());
return draftValidation;
}
use of se.inera.intyg.common.support.modules.support.api.dto.ValidationStatus in project webcert by sklintyg.
the class AbstractUtkastBuilder method validateDraft.
private UtkastStatus validateDraft(ModuleApi moduleApi, String draftCopyJson) throws ModuleException {
ValidateDraftResponse validationResponse = moduleApi.validateDraft(draftCopyJson);
ValidationStatus validationStatus = validationResponse.getStatus();
return ValidationStatus.VALID.equals(validationStatus) ? UtkastStatus.DRAFT_COMPLETE : UtkastStatus.DRAFT_INCOMPLETE;
}
Aggregations