Skip to content

Commit

Permalink
Enforce ITI TF 3:4.2.2 Once deprecated, a DocumentEntry shall not be …
Browse files Browse the repository at this point in the history
…referenced by future associations
  • Loading branch information
Bhaskarla committed Aug 18, 2021
1 parent 061c6c6 commit 405afa6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public void transformRequest(HttpGetter requestIn, HttpGetter requestOut) {
// GET
if (resourceType.equals("DocumentReference") && uid.contains(".")) {
// by UID
sender = FhirSq.documentEntryByUidQuery(uid, toAddr, task);
sender = FhirSq.documentEntryByUidQuery(uid, null, toAddr, task);
returnAhqrResults(requestOut);
} else if (resourceType.equals("DocumentReference") && uid.contains("-")) {
// by UUID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -828,21 +828,31 @@ private void addSubject(RegistryObjectType ro, ResourceWrapper resource, Ref ref
private AssociationType1 addRelationship(RegistryObjectType source, String relationshipType, Ref target, ValE val) {
Objects.requireNonNull(task);
Objects.requireNonNull(sqEndpoint);
if (relationshipType == null || !relationshipType.equals("replaces")) {
if (relationshipType == null ||
!(relationshipType.equals("replaces")
|| relationshipType.equals("appends")
|| relationshipType.equals("transforms"))) {
val.add(new ValE("Relationship " + relationshipType + " is not supported ").asError());
return null;
}

AhqrSender sender = FhirSq.documentEntryByUidQuery(target.getId(), sqEndpoint, task.newTask());
val.add(new ValE("Once deprecated, a DocumentEntry shall not be referenced by future associations").addIheRequirement("ITI TF 3, 4.2.2"));

AhqrSender sender = FhirSq.documentEntryByUidQuery(
target.getId(),
"urn:oasis:names:tc:ebxml-regrep:StatusType:Approved",
sqEndpoint,
task.newTask());
List<IdentifiableType> contents = sender.getContents();
if (contents.size() != 1) {
val.add(new ValE("Error retrieving DocumentEntry " + target.getId() + " from " + sqEndpoint + " - expected 1 entry but got " + contents.size()).asError());
val.add(new ValE("Error retrieving DocumentEntry with Approved status " + target.getId() + " from " + sqEndpoint + " - expected 1 entry but got " + contents.size()).asError());
return null;
}
ExtrinsicObjectType eo = (ExtrinsicObjectType) contents.get(0);
String targetId = eo.getId();

return createAssociation("urn:ihe:iti:2007:AssociationType:RPLC",
String iheAssociationType = buildTypeMap().get(relationshipType);
return createAssociation(iheAssociationType,
source.getId(),
targetId,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,12 @@ public static AhqrSender docManQuery(String httpQueryString, URI toAddr, ITask t

}

public static AhqrSender documentEntryByUidQuery(String uid, URI toAddr, ITask task) {
public static AhqrSender documentEntryByUidQuery(String uid, String status, URI toAddr, ITask task) {
Map<String, List<String>> model = new HashMap<>();
model.put("$XDSDocumentEntryUniqueId", Collections.singletonList(uid));
if (status != null) {
model.put("$XDSDocumentEntryStatus", Collections.singletonList(status));
}
return run(model, "urn:uuid:5c4f972b-d56b-40ac-a5fc-c8ca9b40b9d4", toAddr, true, task);
}

Expand Down

0 comments on commit 405afa6

Please sign in to comment.