[507] | 1 | package gov.hhs.fha.nhinc.transform.document;
|
---|
| 2 |
|
---|
| 3 | import gov.hhs.fha.nhinc.common.nhinccommondocumenttransform.ReplaceAdhocQueryPatientIdResponseType;
|
---|
| 4 | import gov.hhs.fha.nhinc.common.nhinccommondocumenttransform.ReplaceAdhocQueryPatientIdRequestType;
|
---|
| 5 |
|
---|
| 6 | import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest;
|
---|
| 7 |
|
---|
| 8 | import org.apache.commons.logging.Log;
|
---|
| 9 | import org.apache.commons.logging.LogFactory;
|
---|
| 10 |
|
---|
| 11 | /**
|
---|
| 12 | * Class to perform transform operations for document query messages.
|
---|
| 13 | *
|
---|
| 14 | * @author Neil Webb
|
---|
| 15 | */
|
---|
| 16 | public class DocumentTransformHelper
|
---|
| 17 | {
|
---|
| 18 | private static Log log = LogFactory.getLog(DocumentTransformHelper.class);
|
---|
| 19 |
|
---|
| 20 | /**
|
---|
| 21 | * Replace the patient identifier information in an AdhocQuery message with the information
|
---|
| 22 | * provided in the request. The information replaced includes the community id, assigning
|
---|
| 23 | * authority, and patient identifier.
|
---|
| 24 | *
|
---|
| 25 | * @param replaceAdhocQueryPatientIdRequest Request message containing the AdhocQuery message
|
---|
| 26 | * and patient identifier information
|
---|
| 27 | * @return Altered AdhocQuery Message
|
---|
| 28 | */
|
---|
| 29 | public ReplaceAdhocQueryPatientIdResponseType replaceAdhocQueryPatientId(ReplaceAdhocQueryPatientIdRequestType replaceAdhocQueryPatientIdRequest)
|
---|
| 30 | {
|
---|
| 31 | log.debug("DocumentTransformHelper.replaceAdhocQueryPatientId() -- Begin");
|
---|
| 32 | ReplaceAdhocQueryPatientIdResponseType response = new ReplaceAdhocQueryPatientIdResponseType();
|
---|
| 33 |
|
---|
| 34 | if ((replaceAdhocQueryPatientIdRequest != null) &&
|
---|
| 35 | (replaceAdhocQueryPatientIdRequest.getAdhocQueryRequest() != null))
|
---|
| 36 | {
|
---|
| 37 | // Collect input data
|
---|
| 38 | String homeCommunityId = replaceAdhocQueryPatientIdRequest.getHomeCommunityId();
|
---|
| 39 | String assigningAuthorityId = null;
|
---|
| 40 | String patientId = null;
|
---|
| 41 | if(replaceAdhocQueryPatientIdRequest.getQualifiedSubjectIdentifier() != null)
|
---|
| 42 | {
|
---|
| 43 | assigningAuthorityId = replaceAdhocQueryPatientIdRequest.getQualifiedSubjectIdentifier().getAssigningAuthorityIdentifier();
|
---|
| 44 | patientId = replaceAdhocQueryPatientIdRequest.getQualifiedSubjectIdentifier().getSubjectIdentifier();
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | // Call transform
|
---|
| 48 | DocumentQueryTransform transform = new DocumentQueryTransform();
|
---|
| 49 | AdhocQueryRequest adhocQueryRequest = transform.replaceAdhocQueryPatientId(replaceAdhocQueryPatientIdRequest.getAdhocQueryRequest(), homeCommunityId, assigningAuthorityId, patientId);
|
---|
| 50 | response.setAdhocQueryRequest(adhocQueryRequest);
|
---|
| 51 |
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | log.debug("DocumentQueryTransform.replaceAdhocQueryPatientId() -- End");
|
---|
| 55 | return response;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | }
|
---|