Search in sources :

Example 1 with ParticipationMode

use of org.ehrbase.client.classgenerator.shareddefinition.ParticipationMode in project openEHR_SDK by ehrbase.

the class DefaultValues method buildParticipation.

public static Participation buildParticipation(Collection<Map.Entry<String, String>> subValues) {
    Participation participation = new Participation();
    participation.setPerformer(new PartyIdentified());
    extractExact(subValues, "id", s -> {
        participation.getPerformer().setExternalRef(new PartyRef());
        participation.getPerformer().getExternalRef().setType("PARTY");
        GenericId id = new GenericId();
        id.setValue(s);
        participation.getPerformer().getExternalRef().setId(id);
    });
    extract(subValues, "name", ((PartyIdentified) participation.getPerformer())::setName);
    if (participation.getPerformer().getExternalRef() != null) {
        extract(subValues, "id_namespace", n -> participation.getPerformer().getExternalRef().setNamespace(n));
        extract(subValues, "id_scheme", ((GenericId) participation.getPerformer().getExternalRef().getId())::setScheme);
    }
    extract(subValues, "function", s -> participation.setFunction(new DvText(s)));
    extract(subValues, "mode", s -> {
        ParticipationMode participationMode = findEnumValueOrThrow(s, ParticipationMode.class);
        participation.setMode(new DvCodedText());
        participation.getMode().setValue(participationMode.getValue());
        participation.getMode().setDefiningCode(participationMode.toCodePhrase());
    });
    ((PartyIdentified) participation.getPerformer()).setIdentifiers(splitByIndex(filter(subValues.stream().collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)), DefaultValuePath.PARTICIPATION.getPath() + "_" + "identifiers")).values().stream().map(DefaultValues::toDvIdentifier).collect(Collectors.toList()));
    return participation;
}
Also used : PartyRef(com.nedap.archie.rm.support.identification.PartyRef) Participation(com.nedap.archie.rm.generic.Participation) GenericId(com.nedap.archie.rm.support.identification.GenericId) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) ParticipationMode(org.ehrbase.client.classgenerator.shareddefinition.ParticipationMode) DvText(com.nedap.archie.rm.datavalues.DvText)

Aggregations

DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)1 DvText (com.nedap.archie.rm.datavalues.DvText)1 Participation (com.nedap.archie.rm.generic.Participation)1 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)1 GenericId (com.nedap.archie.rm.support.identification.GenericId)1 PartyRef (com.nedap.archie.rm.support.identification.PartyRef)1 ParticipationMode (org.ehrbase.client.classgenerator.shareddefinition.ParticipationMode)1