Search in sources :

Example 1 with ObjectId

use of com.nedap.archie.rm.support.identification.ObjectId in project ehrbase by ehrbase.

the class PersistedPartySelf method render.

@Override
public PartyProxy render(PartyIdentifiedRecord partyIdentifiedRecord) {
    PartyRef partyRef = null;
    if (partyIdentifiedRecord.getPartyRefType() != null) {
        ObjectId objectID = new PersistedObjectId().fromDB(partyIdentifiedRecord);
        partyRef = new PartyRef(objectID, partyIdentifiedRecord.getPartyRefNamespace(), partyIdentifiedRecord.getPartyRefType());
    }
    return new PartySelf(partyRef);
}
Also used : PartyRef(com.nedap.archie.rm.support.identification.PartyRef) ObjectId(com.nedap.archie.rm.support.identification.ObjectId) PartySelf(com.nedap.archie.rm.generic.PartySelf)

Example 2 with ObjectId

use of com.nedap.archie.rm.support.identification.ObjectId in project ehrbase by ehrbase.

the class PartyRefValue method attributes.

/**
 * extract the attributes of party_ref
 * @return
 */
PartyRefValue attributes() {
    if (// PartySelf f.e.
    partyProxy.getExternalRef() == null)
        return this;
    PartyRef partyRef = partyProxy.getExternalRef();
    namespace = partyRef != null ? partyRef.getNamespace() : null;
    ObjectId objectId = partyRef.getId();
    value = objectId != null ? objectId.getValue() : null;
    if (objectId != null && objectId instanceof GenericId)
        scheme = ((GenericId) objectId).getScheme();
    type = partyRef != null ? partyRef.getType() : null;
    objectIdType = partyRef != null ? PartyRefIdType.valueOf(new PersistedObjectId().objectIdClassSnakeCase(partyRef)) : PartyRefIdType.undefined;
    return this;
}
Also used : PartyRef(com.nedap.archie.rm.support.identification.PartyRef) GenericId(com.nedap.archie.rm.support.identification.GenericId) ObjectId(com.nedap.archie.rm.support.identification.ObjectId)

Example 3 with ObjectId

use of com.nedap.archie.rm.support.identification.ObjectId in project openEHR_SDK by ehrbase.

the class EntryMarshalPostprocessor method process.

/**
 * {@inheritDoc} Adds the encoding information
 */
@Override
public void process(String term, Entry rmObject, Map<String, Object> values, Context<Map<String, Object>> context) {
    values.put(term + PATH_DIVIDER + "encoding|code", "UTF-8");
    values.put(term + PATH_DIVIDER + "encoding|terminology", "IANA_character-sets");
    if (rmObject.getProvider() != null) {
        PartyIdentifiedStdConfig partyIdentifiedStdConfig = new PartyIdentifiedStdConfig();
        values.putAll(partyIdentifiedStdConfig.buildChildValues(term + PATH_DIVIDER + "_provider", (PartyIdentified) rmObject.getProvider(), null));
    }
    if (rmObject.getOtherParticipations() != null) {
        IntStream.range(0, rmObject.getOtherParticipations().size()).forEach(i -> {
            callMarshal(term, "_other_participation:" + i, rmObject.getOtherParticipations().get(i), values, context, context.getNodeDeque().peek().findChildById("participation").orElse(null));
            callPostprocess(term, "_other_participation:" + i, rmObject.getOtherParticipations().get(i), values, context, context.getNodeDeque().peek().findChildById("participation").orElse(null));
        });
    }
    if (rmObject.getWorkflowId() != null) {
        addValue(values, term + "/_work_flow_id", "id", Optional.of(rmObject.getWorkflowId()).map(ObjectRef::getId).map(ObjectId::getValue).orElse(null));
        addValue(values, term + "/_work_flow_id", "id_scheme", Optional.of(rmObject.getWorkflowId()).map(ObjectRef::getId).filter(i -> GenericId.class.isAssignableFrom(i.getClass())).map(GenericId.class::cast).map(GenericId::getScheme).orElse(null));
        addValue(values, term + "/_work_flow_id", "namespace", rmObject.getWorkflowId().getNamespace());
        addValue(values, term + "/_work_flow_id", "type", rmObject.getWorkflowId().getType());
    }
}
Also used : GenericId(com.nedap.archie.rm.support.identification.GenericId) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) ObjectId(com.nedap.archie.rm.support.identification.ObjectId) PartyIdentifiedStdConfig(org.ehrbase.serialisation.flatencoding.std.marshal.config.PartyIdentifiedStdConfig)

Example 4 with ObjectId

use of com.nedap.archie.rm.support.identification.ObjectId in project openEHR_SDK by ehrbase.

the class LocatableMarshalPostprocessor method process.

/**
 * {@inheritDoc}
 */
@Override
public void process(String term, Locatable rmObject, Map<String, Object> values, Context<Map<String, Object>> context) {
    if (RmConstants.ELEMENT.equals(context.getNodeDeque().peek().getRmType()) || !context.getFlatHelper().skip(context)) {
        addValue(values, term + PATH_DIVIDER + "_uid", null, Optional.of(rmObject).map(Locatable::getUid).map(ObjectId::getValue).orElse(null));
        if (rmObject.getLinks() != null) {
            IntStream.range(0, rmObject.getLinks().size()).forEach(i -> {
                Link link = rmObject.getLinks().get(i);
                String termLoop = term + PATH_DIVIDER + "_link:" + i;
                addValue(values, termLoop, "meaning", Optional.of(link).map(Link::getMeaning).map(DvText::getValue).orElse(null));
                addValue(values, termLoop, "type", Optional.of(link).map(Link::getType).map(DvText::getValue).orElse(null));
                addValue(values, termLoop, "target", Optional.of(link).map(Link::getTarget).map(DvEHRURI::getValue).orElse(null));
            });
        }
        if (rmObject.getFeederAudit() != null) {
            callMarshal(term, "_feeder_audit", rmObject.getFeederAudit(), values, context, context.getNodeDeque().peek().findChildById("feeder_audit").orElse(FlatHelper.buildDummyChild("feeder_audit", context.getNodeDeque().peek())));
        }
        if (Optional.ofNullable(rmObject.getName()).map(DvText::getValue).filter(n -> !Objects.equals(context.getNodeDeque().peek().getName(), n)).isPresent()) {
            handleRmAttribute(term, rmObject.getName(), values, context, "name");
        }
    }
}
Also used : IntStream(java.util.stream.IntStream) Context(org.ehrbase.serialisation.walker.Context) FlatHelper(org.ehrbase.serialisation.walker.FlatHelper) DvText(com.nedap.archie.rm.datavalues.DvText) ObjectId(com.nedap.archie.rm.support.identification.ObjectId) DvEHRURI(com.nedap.archie.rm.datavalues.DvEHRURI) Objects(java.util.Objects) PATH_DIVIDER(org.ehrbase.webtemplate.parser.OPTParser.PATH_DIVIDER) Map(java.util.Map) RmConstants(org.ehrbase.util.rmconstants.RmConstants) Locatable(com.nedap.archie.rm.archetyped.Locatable) Optional(java.util.Optional) Link(com.nedap.archie.rm.archetyped.Link) ObjectId(com.nedap.archie.rm.support.identification.ObjectId) DvEHRURI(com.nedap.archie.rm.datavalues.DvEHRURI) Link(com.nedap.archie.rm.archetyped.Link) DvText(com.nedap.archie.rm.datavalues.DvText)

Example 5 with ObjectId

use of com.nedap.archie.rm.support.identification.ObjectId in project openEHR_SDK by ehrbase.

the class ParticipationConfig method buildChildValues.

/**
 * {@inheritDoc}
 */
@Override
public Map<String, Object> buildChildValues(String currentTerm, Participation rmObject, Context<Map<String, Object>> context) {
    Map<String, Object> result = new HashMap<>();
    addValue(result, currentTerm, "id", Optional.of(rmObject).map(Participation::getPerformer).map(PartyProxy::getExternalRef).map(ObjectRef::getId).map(ObjectId::getValue).orElse(null));
    addValue(result, currentTerm, "id_namespace", Optional.of(rmObject).map(Participation::getPerformer).map(PartyProxy::getExternalRef).map(ObjectRef::getNamespace).orElse(null));
    addValue(result, currentTerm, "id_scheme", Optional.of(rmObject).map(Participation::getPerformer).map(PartyProxy::getExternalRef).map(PartyRef::getId).filter(cls -> GenericId.class.isAssignableFrom(cls.getClass())).map(GenericId.class::cast).map(GenericId::getScheme).orElse(null));
    addValue(result, currentTerm, "name", Optional.of(rmObject).map(Participation::getPerformer).filter(p -> PartyIdentified.class.isAssignableFrom(p.getClass())).map(PartyIdentified.class::cast).map(PartyIdentified::getName).orElse(null));
    addValue(result, currentTerm, "mode", Optional.of(rmObject).map(Participation::getMode).map(DvText::getValue).orElse(null));
    addValue(result, currentTerm, "function", Optional.of(rmObject).map(Participation::getFunction).map(DvText::getValue).orElse(null));
    List<DvIdentifier> dvIdentifiers = Optional.of(rmObject).map(Participation::getPerformer).filter(p -> PartyIdentified.class.isAssignableFrom(p.getClass())).map(PartyIdentified.class::cast).map(PartyIdentified::getIdentifiers).orElse(Collections.emptyList());
    IntStream.range(0, dvIdentifiers.size()).forEach(i -> {
        DvIdentifier identifier = dvIdentifiers.get(i);
        addValue(result, currentTerm, "identifiers_id:" + i, identifier.getId());
        addValue(result, currentTerm, "identifiers_issuer:" + i, identifier.getIssuer());
        addValue(result, currentTerm, "identifiers_assigner:" + i, identifier.getAssigner());
        addValue(result, currentTerm, "identifiers_type:" + i, identifier.getType());
    });
    return result;
}
Also used : DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier) PartyProxy(com.nedap.archie.rm.generic.PartyProxy) IntStream(java.util.stream.IntStream) ObjectRef(com.nedap.archie.rm.support.identification.ObjectRef) Context(org.ehrbase.serialisation.walker.Context) java.util(java.util) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) PartyRef(com.nedap.archie.rm.support.identification.PartyRef) DvText(com.nedap.archie.rm.datavalues.DvText) GenericId(com.nedap.archie.rm.support.identification.GenericId) Participation(com.nedap.archie.rm.generic.Participation) ObjectId(com.nedap.archie.rm.support.identification.ObjectId) Participation(com.nedap.archie.rm.generic.Participation) GenericId(com.nedap.archie.rm.support.identification.GenericId) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) ObjectId(com.nedap.archie.rm.support.identification.ObjectId) DvText(com.nedap.archie.rm.datavalues.DvText) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier) PartyProxy(com.nedap.archie.rm.generic.PartyProxy) ObjectRef(com.nedap.archie.rm.support.identification.ObjectRef)

Aggregations

ObjectId (com.nedap.archie.rm.support.identification.ObjectId)14 GenericId (com.nedap.archie.rm.support.identification.GenericId)7 ObjectRef (com.nedap.archie.rm.support.identification.ObjectRef)7 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)5 PartyRef (com.nedap.archie.rm.support.identification.PartyRef)5 Map (java.util.Map)5 Test (org.junit.Test)5 Context (org.ehrbase.serialisation.walker.Context)4 WorkflowIdTest (care.better.platform.web.template.WorkflowIdTest)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 ImmutableMap (com.google.common.collect.ImmutableMap)3 Composition (com.nedap.archie.rm.composition.Composition)3 Entry (com.nedap.archie.rm.composition.Entry)3 Section (com.nedap.archie.rm.composition.Section)3 OffsetDateTime (java.time.OffsetDateTime)3 ZoneId (java.time.ZoneId)3 ZonedDateTime (java.time.ZonedDateTime)3 DateTimeFormatter (java.time.format.DateTimeFormatter)3 IntStream (java.util.stream.IntStream)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3