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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations