Need help with using the reference implementation library

Hi,

I am a student trying to use OpenEHR reference implementation. I downloaded the jars and
was able to use it to parse an ADL file and get the AOM. But i am not able to find the
correct way of acessing the AOM (Archetype object) to find the leaf nodes. I could get
to the definition and the children at the fist level but beyond that i was not able to
do anything. I am just trying to create a simple UI for a very simple observation model
(only body temperature) by parsing an ADL. But i am struggling to find a correct way of
doing it. I am not able to locate useful documentation either.

Can somebody please help?

Thanks and Regards,
Saurabh

Hi Saurabh,
you can iterate through each one of the paths and filter what you need:

        Map<String, CObject> pathObjectMap = ar.getPathNodeMap();
        ArrayList<String> paths = new ArrayList<String>(pathObjectMap.keySet());
        //Sort paths. Shortest path first (to access clusters before children)
        Collections.sort(paths);
        for (String path : paths) {
            CObject cObject = pathObjectMap.get(path);
           //manage cObject
        }

In the GDL project you have a full example:
https://github.com/openEHR/gdl-tools/blob/master/cds/cds-openehr/src/main/java/se/cambio/cds/openehr/model/facade/archetype/plain/PlainArchetypeFacadeDelegate.java
(loadArchetypeObjects method)

Cheers,

iago