use of de.symeda.sormas.api.sormastosormas.event.SormasToSormasEventDto in project SORMAS-Project by hzi-braunschweig.
the class ReceivedEntitiesProcessor method processReceivedData.
public List<ValidationErrors> processReceivedData(SormasToSormasDto receivedData, ShareDataExistingEntities existingEntities) {
List<ValidationErrors> validationErrors = new ArrayList<>();
SormasToSormasOriginInfoDto originInfo = receivedData.getOriginInfo();
originInfo.setUuid(DataHelper.createUuid());
originInfo.setChangeDate(new Date());
ValidationErrors originInfoErrors = validateOriginInfo(originInfo, Captions.sormasToSormasOriginInfo);
if (originInfoErrors.hasError()) {
validationErrors.add(originInfoErrors);
}
List<SormasToSormasCaseDto> cases = receivedData.getCases();
if (CollectionUtils.isNotEmpty(cases)) {
cases.forEach(c -> {
ValidationErrors caseErrors = caseProcessor.processReceivedData(c, existingEntities.getCases().get(c.getEntity().getUuid()));
if (caseErrors.hasError()) {
validationErrors.add(new ValidationErrors(ValidationHelper.buildCaseValidationGroupName(c.getEntity()), caseErrors));
}
});
}
List<SormasToSormasContactDto> contacts = receivedData.getContacts();
if (CollectionUtils.isNotEmpty(contacts)) {
contacts.forEach(c -> {
ValidationErrors contactErrors = contactProcessor.processReceivedData(c, existingEntities.getContacts().get(c.getEntity().getUuid()));
if (contactErrors.hasError()) {
validationErrors.add(new ValidationErrors(ValidationHelper.buildContactValidationGroupName(c.getEntity()), contactErrors));
}
});
}
List<SormasToSormasEventDto> events = receivedData.getEvents();
if (CollectionUtils.isNotEmpty(events)) {
events.forEach(e -> {
ValidationErrors eventErrors = eventProcessor.processReceivedData(e, existingEntities.getEvents().get(e.getEntity().getUuid()));
if (eventErrors.hasError()) {
validationErrors.add(new ValidationErrors(ValidationHelper.buildEventValidationGroupName(e.getEntity()), eventErrors));
}
});
}
List<SormasToSormasEventParticipantDto> eventParticipants = receivedData.getEventParticipants();
if (CollectionUtils.isNotEmpty(eventParticipants)) {
eventParticipants.forEach(ep -> {
ValidationErrors eventParticipantErrors = eventParticipantProcessor.processReceivedData(ep, existingEntities.getEventParticipants().get(ep.getEntity().getUuid()));
if (eventParticipantErrors.hasError()) {
validationErrors.add(new ValidationErrors(ValidationHelper.buildEventParticipantValidationGroupName(ep.getEntity()), eventParticipantErrors));
}
});
}
List<SormasToSormasSampleDto> samples = receivedData.getSamples();
if (CollectionUtils.isNotEmpty(samples)) {
samples.forEach(s -> {
ValidationErrors contactErrors = sampleProcessor.processReceivedData(s, existingEntities.getSamples().get(s.getEntity().getUuid()));
if (contactErrors.hasError()) {
validationErrors.add(new ValidationErrors(ValidationHelper.buildSampleValidationGroupName(s.getEntity()), contactErrors));
}
});
}
List<SormasToSormasImmunizationDto> immunizations = receivedData.getImmunizations();
if (CollectionUtils.isNotEmpty(immunizations)) {
immunizations.forEach(s -> {
ValidationErrors immunizationErrors = immunizationProcessor.processReceivedData(s, existingEntities.getImmunizations().get(s.getEntity().getUuid()));
if (immunizationErrors.hasError()) {
validationErrors.add(new ValidationErrors(ValidationHelper.buildImmunizationValidationGroupName(s.getEntity()), immunizationErrors));
}
});
}
return validationErrors;
}
Aggregations