protected MCCIIN000002UV01 addPatientDiscoveryAsyncReq( RespondingGatewayPRPAIN201305UV02RequestType request) { MCCIIN000002UV01 ack = new MCCIIN000002UV01(); // "process" the request and send a response out to the Nhin. PatientDiscovery201305Processor msgProcessor = new PatientDiscovery201305Processor(); PRPAIN201306UV02 resp = msgProcessor.process201305(request.getPRPAIN201305UV02(), request.getAssertion()); // Generate a new response assertion AsyncMessageProcessHelper asyncProcess = createAsyncProcesser(); AssertionType newAssertion = asyncProcess.copyAssertionTypeObject(request.getAssertion()); // Original request message id is now set as the relates to id newAssertion.getRelatesToList().add(request.getAssertion().getMessageId()); // Generate a new unique response assertion Message ID newAssertion.setMessageId(AsyncMessageIdCreator.generateMessageId()); // Set user info homeCommunity String homeCommunityId = HomeCommunityMap.getLocalHomeCommunityId(); HomeCommunityType homeCommunityType = new HomeCommunityType(); homeCommunityType.setHomeCommunityId(homeCommunityId); homeCommunityType.setName(homeCommunityId); newAssertion.setHomeCommunity(homeCommunityType); if (newAssertion.getUserInfo() != null && newAssertion.getUserInfo().getOrg() != null) { newAssertion.getUserInfo().getOrg().setHomeCommunityId(homeCommunityId); newAssertion.getUserInfo().getOrg().setName(homeCommunityId); } ack = sendToNhin(resp, newAssertion, request.getNhinTargetCommunities()); return ack; }
public MCCIIN000002UV01 processPatientDiscoveryAsyncReqError( PRPAIN201305UV02 request, PRPAIN201306UV02 response, AssertionType assertion, String errMsg) { MCCIIN000002UV01 ack = HL7AckTransforms.createAckErrorFrom201305(request, errMsg); AsyncMessageProcessHelper asyncProcess = createAsyncProcesser(); // Add a new inbound PD request entry to the local deferred queue boolean bIsQueueOk = asyncProcess.addPatientDiscoveryRequest( request, assertion, AsyncMsgRecordDao.QUEUE_DIRECTION_INBOUND); // check for valid queue entry if (bIsQueueOk) { bIsQueueOk = asyncProcess.processAck( assertion.getMessageId(), AsyncMsgRecordDao.QUEUE_STATUS_REQRCVDERR, AsyncMsgRecordDao.QUEUE_STATUS_REQRCVDERR, ack); } else { String ackMsg = "Deferred Patient Discovery processing halted; deferred queue repository error encountered; " + errMsg; // Set the error acknowledgement status // fatal error with deferred queue repository ack = HL7AckTransforms.createAckErrorFrom201305(request, ackMsg); } return ack; }
public MCCIIN000002UV01 addPatientDiscoveryAsyncReq( PRPAIN201305UV02 request, AssertionType assertion, NhinTargetCommunitiesType targets) { MCCIIN000002UV01 resp = new MCCIIN000002UV01(); RespondingGatewayPRPAIN201305UV02RequestType unsecureRequest = new RespondingGatewayPRPAIN201305UV02RequestType(); unsecureRequest.setAssertion(assertion); unsecureRequest.setNhinTargetCommunities(targets); unsecureRequest.setPRPAIN201305UV02(request); // Audit the incoming Nhin 201305 Message PatientDiscoveryAuditLogger auditLogger = new PatientDiscoveryAuditLogger(); AcknowledgementType ack = auditLogger.auditEntityDeferred201305( unsecureRequest, unsecureRequest.getAssertion(), NhincConstants.AUDIT_LOG_INBOUND_DIRECTION, NhincConstants.AUDIT_LOG_RESPONSE_PROCESS); // ASYNCMSG PROCESSING - RSPPROCESS AsyncMessageProcessHelper asyncProcess = createAsyncProcesser(); String messageId = assertion.getMessageId(); boolean bIsQueueOk = asyncProcess.processMessageStatus(messageId, AsyncMsgRecordDao.QUEUE_STATUS_RSPPROCESS); // check for valid queue entry if (bIsQueueOk) { resp = addPatientDiscoveryAsyncReq(unsecureRequest); asyncProcess.processAck( messageId, AsyncMsgRecordDao.QUEUE_STATUS_RSPSENTACK, AsyncMsgRecordDao.QUEUE_STATUS_RSPSENTERR, resp); } else { String ackMsg = "Deferred Patient Discovery response processing halted; deferred queue repository error encountered"; // Set the error acknowledgement status // fatal error with deferred queue repository resp = HL7AckTransforms.createAckErrorFrom201305(request, ackMsg); } // Audit the responding Acknowledgement Message ack = auditLogger.auditAck( resp, unsecureRequest.getAssertion(), NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION, NhincConstants.AUDIT_LOG_ENTITY_INTERFACE); return resp; }