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);
}
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;
}
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());
}
}
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");
}
}
}
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;
}
Aggregations