use of org.ehrbase.client.classgenerator.interfaces.CompositionEntity in project fhir-bridge by ehrbase.
the class ProvideResourceResponseProcessor method process.
@Override
public void process(Exchange exchange) throws Exception {
CompositionEntity composition = exchange.getIn().getBody(CompositionEntity.class);
MethodOutcome outcome = exchange.getProperty(CamelConstants.OUTCOME, MethodOutcome.class);
String resourceId = outcome.getId().getIdPart();
ResourceComposition resourceComposition = resourceCompositionRepository.findById(resourceId).orElse(new ResourceComposition(resourceId));
resourceComposition.setCompositionId(getCompositionId(composition));
resourceCompositionRepository.save(resourceComposition);
LOG.debug("Saved ResourceComposition: resourceId={}, compositionId={}", resourceComposition.getResourceId(), resourceComposition.getCompositionId());
exchange.getMessage().setBody(outcome);
}
use of org.ehrbase.client.classgenerator.interfaces.CompositionEntity in project fhir-bridge by ehrbase.
the class AbstractMappingTestSetupIT method compareCompositions.
public Diff compareCompositions(Javers javers, String paragonFilePath, CompositionEntity mappedComposition) throws IOException {
RMObject composition = new CanonicalJson().unmarshal(testFileLoader.loadResourceToString(paragonFilePath), com.nedap.archie.rm.composition.Composition.class);
ResourceTemplateProvider resourceTemplateProvider = new ResourceTemplateProvider("classpath:/opt/");
resourceTemplateProvider.afterPropertiesSet();
Flattener cut = new Flattener(resourceTemplateProvider);
CompositionEntity paragonComposition = cut.flatten(composition, mappedComposition.getClass());
Diff diff = javers.compare(paragonComposition, mappedComposition);
diff.getChanges().forEach(System.out::println);
return diff;
}
Aggregations