Search in sources :

Example 21 with RMObject

use of com.nedap.archie.rm.RMObject in project openEHR_SDK by ehrbase.

the class ToCompositionWalker method extractRMChild.

@Override
protected Object extractRMChild(RMObject currentRM, WebTemplateNode currentNode, WebTemplateNode childNode, boolean isChoice, Integer count) {
    Object newChild = WebTemplateSkeletonBuilder.build(childNode, false, Object.class);
    WebTemplateSkeletonBuilder.insert(currentNode, currentRM, childNode, newChild);
    return wrap(newChild);
}
Also used : RMObject(com.nedap.archie.rm.RMObject)

Example 22 with RMObject

use of com.nedap.archie.rm.RMObject in project fhir-bridge by ehrbase.

the class CompositionProducer method debugMapping.

private void debugMapping(CompositionEntity composition) {
    ResourceTemplateProvider resourceTemplateProvider = new ResourceTemplateProvider("classpath:/opt/");
    resourceTemplateProvider.afterPropertiesSet();
    Unflattener unflattener = new Unflattener(resourceTemplateProvider);
    RMObject rmObject = unflattener.unflatten(composition);
    CanonicalJson canonicalJson = new CanonicalJson();
    String compositionJson = canonicalJson.marshal(rmObject);
    writeToFile(compositionJson);
}
Also used : CanonicalJson(org.ehrbase.serialisation.jsonencoding.CanonicalJson) ResourceTemplateProvider(org.ehrbase.fhirbridge.ehr.ResourceTemplateProvider) Unflattener(org.ehrbase.client.flattener.Unflattener) RMObject(com.nedap.archie.rm.RMObject)

Example 23 with RMObject

use of com.nedap.archie.rm.RMObject 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;
}
Also used : CanonicalJson(org.ehrbase.serialisation.jsonencoding.CanonicalJson) ResourceTemplateProvider(org.ehrbase.fhirbridge.ehr.ResourceTemplateProvider) CompositionEntity(org.ehrbase.client.classgenerator.interfaces.CompositionEntity) Diff(org.javers.core.diff.Diff) Flattener(org.ehrbase.client.flattener.Flattener) RMObject(com.nedap.archie.rm.RMObject)

Example 24 with RMObject

use of com.nedap.archie.rm.RMObject in project openEHR_SDK by ehrbase.

the class CanonicalUtil method toRmObjectList.

public static List<RMObject> toRmObjectList(List<Object> rmObjectListAsMap) {
    List<RMObject> objects = new ArrayList<>();
    for (Object item : rmObjectListAsMap) {
        if (item instanceof Map) {
            Map<String, Object> mappedObject = (Map<String, Object>) item;
            // get the type
            String type = (String) mappedObject.get(AT_TYPE);
            Class rmClass = ArchieRMInfoLookup.getInstance().getClass(type);
            RMObject rmObject = toRmObject(mappedObject, rmClass);
            objects.add(rmObject);
        }
    }
    return objects;
}
Also used : ArrayList(java.util.ArrayList) RMObject(com.nedap.archie.rm.RMObject) Map(java.util.Map) RMObject(com.nedap.archie.rm.RMObject)

Example 25 with RMObject

use of com.nedap.archie.rm.RMObject in project openEHR_SDK by ehrbase.

the class CanonicalUtil method compareArbitraryRmClass.

public static Object compareArbitraryRmClass(Map<String, Object> anRmObjectAsMap, Class rmClass, RMObject compareExpectedObject) {
    RMObject actualRmObject = toRmObject(anRmObjectAsMap, rmClass);
    assertThat(actualRmObject).isEqualTo(compareExpectedObject);
    return null;
}
Also used : RMObject(com.nedap.archie.rm.RMObject)

Aggregations

RMObject (com.nedap.archie.rm.RMObject)57 Test (org.junit.Test)19 Composition (com.nedap.archie.rm.composition.Composition)10 CanonicalJson (org.ehrbase.serialisation.jsonencoding.CanonicalJson)9 QueryResponseData (org.ehrbase.response.openehr.QueryResponseData)8 Locatable (com.nedap.archie.rm.archetyped.Locatable)7 List (java.util.List)7 WebTemplateNode (org.ehrbase.webtemplate.model.WebTemplateNode)6 Collectors (java.util.stream.Collectors)5 TemplateId (com.nedap.archie.rm.archetyped.TemplateId)4 IOException (java.io.IOException)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 Map (java.util.Map)4 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)4 TestDataTemplateProvider (org.ehrbase.client.templateprovider.TestDataTemplateProvider)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 Archetyped (com.nedap.archie.rm.archetyped.Archetyped)3 Version (com.nedap.archie.rm.changecontrol.Version)3 CodePhrase (com.nedap.archie.rm.datatypes.CodePhrase)3