Search in sources :

Example 1 with ValidationErrors

use of de.symeda.sormas.api.sormastosormas.validation.ValidationErrors in project SORMAS-Project by hzi-braunschweig.

the class SormasToSormasImmunizationDtoValidator method validate.

@Override
public ValidationErrors validate(SormasToSormasImmunizationDto sharedData, ValidationDirection direction) {
    final ImmunizationDto im = sharedData.getEntity();
    ValidationErrors validationErrors = new ValidationErrors(buildImmunizationValidationGroupName(im));
    final String groupNameTag = Captions.Immunization;
    infraValidator.validateCountry(im.getCountry(), groupNameTag, validationErrors, im::setCountry, direction);
    infraValidator.validateResponsibleRegion(im.getResponsibleRegion(), groupNameTag, validationErrors, im::setResponsibleRegion, direction);
    infraValidator.validateResponsibleDistrict(im.getResponsibleDistrict(), groupNameTag, validationErrors, im::setResponsibleDistrict, direction);
    infraValidator.validateResponsibleCommunity(im.getResponsibleCommunity(), groupNameTag, validationErrors, im::setResponsibleCommunity, direction);
    infraValidator.validateFacility(im.getHealthFacility(), im.getFacilityType(), im.getHealthFacilityDetails(), groupNameTag, validationErrors, f -> {
        im.setHealthFacility(f.getEntity());
        im.setHealthFacilityDetails(f.getDetails());
    });
    return validationErrors;
}
Also used : SormasToSormasImmunizationDto(de.symeda.sormas.api.sormastosormas.immunization.SormasToSormasImmunizationDto) ImmunizationDto(de.symeda.sormas.api.immunization.ImmunizationDto) ValidationErrors(de.symeda.sormas.api.sormastosormas.validation.ValidationErrors)

Example 2 with ValidationErrors

use of de.symeda.sormas.api.sormastosormas.validation.ValidationErrors in project SORMAS-Project by hzi-braunschweig.

the class SormasToSormasLabMessageFacadeEjb method validateSharedLabMessage.

private ValidationErrors validateSharedLabMessage(SormasToSormasLabMessageDto dto) throws ValidationRuntimeException {
    ValidationErrors errors = new ValidationErrors();
    if (labMessageFacade.exists(dto.getEntity().getUuid())) {
        errors.add(new ValidationErrorGroup(Captions.LabMessage), new ValidationErrorMessage(Validations.sormasToSormasLabMessageExists));
    }
    errors.addAll(dtoValidator.validateIncoming(dto));
    return errors;
}
Also used : ValidationErrorGroup(de.symeda.sormas.api.sormastosormas.validation.ValidationErrorGroup) ValidationErrors(de.symeda.sormas.api.sormastosormas.validation.ValidationErrors) ValidationErrorMessage(de.symeda.sormas.api.sormastosormas.validation.ValidationErrorMessage)

Example 3 with ValidationErrors

use of de.symeda.sormas.api.sormastosormas.validation.ValidationErrors in project SORMAS-Project by hzi-braunschweig.

the class SormasToSormasSampleDtoValidator method validate.

@Override
public ValidationErrors validate(SormasToSormasSampleDto sharedData, ValidationDirection direction) {
    SampleDto sample = sharedData.getEntity();
    ValidationErrors validationErrors = new ValidationErrors(buildSampleValidationGroupName(sample));
    // todo shouldn't this be FacilityType.LABORATORY?
    infraValidator.validateFacility(sample.getLab(), null, sample.getLabDetails(), Captions.Sample_lab, validationErrors, f -> {
        sample.setLab(f.getEntity());
        sample.setLabDetails(f.getDetails());
    });
    sharedData.getPathogenTests().forEach(pathogenTest -> validatePathogenTest(validationErrors, pathogenTest));
    return validationErrors;
}
Also used : ValidationErrors(de.symeda.sormas.api.sormastosormas.validation.ValidationErrors) SampleDto(de.symeda.sormas.api.sample.SampleDto) SormasToSormasSampleDto(de.symeda.sormas.api.sormastosormas.sample.SormasToSormasSampleDto)

Example 4 with ValidationErrors

use of de.symeda.sormas.api.sormastosormas.validation.ValidationErrors in project SORMAS-Project by hzi-braunschweig.

the class SormasToSormasContactDtoValidator method validate.

@Override
public ValidationErrors validate(SormasToSormasContactDto sharedData, ValidationDirection direction) {
    ContactDto contact = sharedData.getEntity();
    ValidationErrors validationErrors = new ValidationErrors(buildContactValidationGroupName(contact));
    ValidationErrors personValidationErrors = validatePerson(sharedData.getPerson(), direction);
    validationErrors.addAll(personValidationErrors);
    String groupNameTag = Captions.Contact;
    infraValidator.validateRegion(contact.getRegion(), groupNameTag, validationErrors, contact::setRegion, direction);
    infraValidator.validateDistrict(contact.getDistrict(), groupNameTag, validationErrors, contact::setDistrict, direction);
    infraValidator.validateCommunity(contact.getCommunity(), groupNameTag, validationErrors, contact::setCommunity, direction);
    infraValidator.validateDistrict(contact.getReportingDistrict(), groupNameTag, validationErrors, contact::setReportingDistrict, direction);
    validateEpiData(contact.getEpiData(), validationErrors, direction);
    return validationErrors;
}
Also used : ValidationErrors(de.symeda.sormas.api.sormastosormas.validation.ValidationErrors) ContactDto(de.symeda.sormas.api.contact.ContactDto) SormasToSormasContactDto(de.symeda.sormas.api.sormastosormas.contact.SormasToSormasContactDto)

Example 5 with ValidationErrors

use of de.symeda.sormas.api.sormastosormas.validation.ValidationErrors in project SORMAS-Project by hzi-braunschweig.

the class SormasToSormasEventParticipantDtoValidator method validatePreview.

@Override
public ValidationErrors validatePreview(SormasToSormasEventParticipantPreview preview, ValidationDirection direction) {
    ValidationErrors validationErrors = new ValidationErrors(buildEventParticipantValidationGroupName(preview));
    validationErrors.addAll(validatePersonPreview(preview.getPerson(), direction));
    return validationErrors;
}
Also used : ValidationErrors(de.symeda.sormas.api.sormastosormas.validation.ValidationErrors)

Aggregations

ValidationErrors (de.symeda.sormas.api.sormastosormas.validation.ValidationErrors)26 SormasToSormasValidationException (de.symeda.sormas.api.sormastosormas.validation.SormasToSormasValidationException)7 ArrayList (java.util.ArrayList)7 SormasToSormasContactDto (de.symeda.sormas.api.sormastosormas.contact.SormasToSormasContactDto)3 SormasToSormasEventDto (de.symeda.sormas.api.sormastosormas.event.SormasToSormasEventDto)3 SormasToSormasEventParticipantDto (de.symeda.sormas.api.sormastosormas.event.SormasToSormasEventParticipantDto)3 SormasToSormasImmunizationDto (de.symeda.sormas.api.sormastosormas.immunization.SormasToSormasImmunizationDto)3 SormasToSormasSampleDto (de.symeda.sormas.api.sormastosormas.sample.SormasToSormasSampleDto)3 CaseDataDto (de.symeda.sormas.api.caze.CaseDataDto)2 ContactDto (de.symeda.sormas.api.contact.ContactDto)2 EventDto (de.symeda.sormas.api.event.EventDto)2 LabMessageDto (de.symeda.sormas.api.labmessage.LabMessageDto)2 SormasToSormasException (de.symeda.sormas.api.sormastosormas.SormasToSormasException)2 SormasToSormasOriginInfoDto (de.symeda.sormas.api.sormastosormas.SormasToSormasOriginInfoDto)2 SormasToSormasCaseDto (de.symeda.sormas.api.sormastosormas.caze.SormasToSormasCaseDto)2 SormasToSormasLabMessageDto (de.symeda.sormas.api.sormastosormas.labmessage.SormasToSormasLabMessageDto)2 ValidationErrorGroup (de.symeda.sormas.api.sormastosormas.validation.ValidationErrorGroup)2 ValidationErrorMessage (de.symeda.sormas.api.sormastosormas.validation.ValidationErrorMessage)2 Navigator (com.vaadin.navigator.Navigator)1 Sizeable (com.vaadin.server.Sizeable)1