use of care.better.platform.web.template.validator.ValidationErrorDto in project openEHR_SDK by ehrbase.
the class CompositionValidatorImp method validateWithParams.
@Override
public List<ValidationErrorDto> validateWithParams(String template, String rawComposition, boolean strictTextValidation, boolean relaxedNameMatching) throws Exception {
TemplateDocument templateDocument = TemplateDocument.Factory.parse(IOUtils.toInputStream(template, StandardCharsets.UTF_8));
Composition composition = new CanonicalJson().unmarshal(rawComposition.replace("@class", "_type"), Composition.class);
org.ehrbase.validation.CompositionValidator validator = new org.ehrbase.validation.CompositionValidator();
List<ValidationErrorDto> errorDtoList = validator.validate(composition, templateDocument.getTemplate()).stream().filter(e -> !List.of("/content[openEHR-EHR-SECTION.ispek_dialog.v1 and name/value='Restraint medication']/items[openEHR-EHR-INSTRUCTION.medication_order.v1]/activities[at0001]/description[at0002]/items[at0070]", "/context/other_context[at0001]/items[at0.0.81]").contains(e.getAqlPath())).peek(e -> logger.info(e.getMessage() + "|" + e.getAqlPath())).map(e -> new ValidationErrorDto(e.getMessage(), new String[0], 0)).collect(Collectors.toList());
return errorDtoList;
}
Aggregations