use of com.nedap.archie.rm.support.identification.TerminologyId in project ehrbase by ehrbase.
the class ContributionServiceImp method retrieveAuditDetails.
/**
* retrieval and building of AuditDetails object attached to the given contribution context
* @param contributionId ID of contribution
* @return {@link AuditDetails} object from contribution
*/
private AuditDetails retrieveAuditDetails(UUID contributionId) {
UUID auditId = I_ContributionAccess.retrieveInstance(this.getDataAccess(), contributionId).getHasAuditDetails();
I_AuditDetailsAccess auditDetailsAccess = new AuditDetailsAccess(this.getDataAccess()).retrieveInstance(this.getDataAccess(), auditId);
String systemId = auditDetailsAccess.getSystemId().toString();
PartyProxy committer = new PersistedPartyProxy(this.getDataAccess()).retrieve(auditDetailsAccess.getCommitter());
DvDateTime timeCommitted = new DvDateTime(LocalDateTime.ofInstant(auditDetailsAccess.getTimeCommitted().toInstant(), ZoneId.of(auditDetailsAccess.getTimeCommittedTzId())));
int changeTypeCode = I_ConceptAccess.ContributionChangeType.valueOf(auditDetailsAccess.getChangeType().getLiteral().toUpperCase()).getCode();
// FIXME: what's the terminology ID of the official change type terminology?
DvCodedText changeType = new DvCodedText(auditDetailsAccess.getChangeType().getLiteral(), new CodePhrase(new TerminologyId("audit change type"), String.valueOf(changeTypeCode)));
DvText description = new DvText(auditDetailsAccess.getDescription());
return new AuditDetails(systemId, committer, timeCommitted, changeType, description);
}
use of com.nedap.archie.rm.support.identification.TerminologyId in project ehrbase by ehrbase.
the class RecordedDvCodedText method fromDB.
public Object fromDB(Record record, Field<DvCodedTextRecord> fromField) {
Object retObject;
DvCodedTextRecord dvCodedTextRecord = record.get(fromField);
CodePhraseRecord codePhraseDefiningCode = dvCodedTextRecord.getDefiningCode();
CodePhraseRecord codePhraseLanguage = dvCodedTextRecord.getLanguage();
CodePhraseRecord codePhraseEncoding = dvCodedTextRecord.getEncoding();
if (codePhraseDefiningCode != null)
retObject = new DvCodedText(dvCodedTextRecord.getValue(), codePhraseLanguage == null ? null : new CodePhrase(new TerminologyId(codePhraseLanguage.getTerminologyIdValue()), codePhraseLanguage.getCodeString()), codePhraseEncoding == null ? null : new CodePhrase(new TerminologyId(codePhraseEncoding.getTerminologyIdValue()), codePhraseEncoding.getCodeString()), new CodePhrase(new TerminologyId(codePhraseDefiningCode.getTerminologyIdValue()), codePhraseDefiningCode.getCodeString()));
else
// assume DvText
retObject = new DvText(dvCodedTextRecord.getValue(), codePhraseLanguage == null ? null : new CodePhrase(new TerminologyId(codePhraseLanguage.getTerminologyIdValue()), codePhraseLanguage.getCodeString()), codePhraseEncoding == null ? null : new CodePhrase(new TerminologyId(codePhraseEncoding.getTerminologyIdValue()), codePhraseEncoding.getCodeString()));
if (dvCodedTextRecord.getTermMapping() != null && dvCodedTextRecord.getTermMapping().length > 0) {
for (String dvCodedTextTermMappingRecord : dvCodedTextRecord.getTermMapping()) {
((DvText) retObject).addMapping(new PersistentTermMapping().decode(dvCodedTextTermMappingRecord));
}
}
return retObject;
}
Aggregations