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; }
protected RequestType getRequestType(RespondingGatewayPRPAIN201305UV02RequestType event) { addDebugLog("Begin -- PatientDiscoveryPolicyTransformHelper.getRequestType()"); RequestType request = new RequestType(); setSubjectToRequestType(event, request); ResourceType resource = null; AttributeHelper attrHelper = new AttributeHelper(); II ii = extractPatientIdentifier(event.getPRPAIN201305UV02()); if (ii != null) { resource = new ResourceType(); resource .getAttribute() .add( attrHelper.attributeFactory( PatientAssigningAuthorityAttributeId, Constants.DataTypeString, ii.getRoot())); String sStrippedPatientId = PatientIdFormatUtil.parsePatientId(ii.getExtension()); log.debug("transformSubjectAddedInToCheckPolicy: sStrippedPatientId = " + sStrippedPatientId); resource .getAttribute() .add( attrHelper.attributeFactory( PatientIdAttributeId, Constants.DataTypeString, sStrippedPatientId)); request.getResource().add(resource); } request.getResource().add(resource); addDebugLog("End -- PatientDiscoveryPolicyTransformHelper.getRequestType()"); return request; }
public org.hl7.v3.MCCIIN000002UV01 processPatientDiscoveryAsyncReq( org.hl7.v3.RespondingGatewayPRPAIN201305UV02RequestType processPatientDiscoveryAsyncReqAsyncRequest) { return new AdapterPatientDiscoveryDeferredRequestImpl() .processPatientDiscoveryAsyncReq( processPatientDiscoveryAsyncReqAsyncRequest.getPRPAIN201305UV02(), processPatientDiscoveryAsyncReqAsyncRequest.getAssertion(), context); }
private HomeCommunityType getReceiverHomeCommunityFrom201305( RespondingGatewayPRPAIN201305UV02RequestType event) { HomeCommunityType receiverHomeCommunity = new HomeCommunityType(); if (event != null && event.getPRPAIN201305UV02().getReceiver() != null && !event.getPRPAIN201305UV02().getReceiver().isEmpty() && event.getPRPAIN201305UV02().getReceiver().get(0) != null && event.getPRPAIN201305UV02().getReceiver().get(0).getDevice() != null && event.getPRPAIN201305UV02().getReceiver().get(0).getDevice().getId() != null && event.getPRPAIN201305UV02().getReceiver().get(0).getDevice().getId().get(0) != null && NullChecker.isNotNullish( event .getPRPAIN201305UV02() .getReceiver() .get(0) .getDevice() .getId() .get(0) .getRoot())) { receiverHomeCommunity.setHomeCommunityId( event.getPRPAIN201305UV02().getReceiver().get(0).getDevice().getId().get(0).getRoot()); } return receiverHomeCommunity; }
protected HomeCommunityType getHomeCommunityFrom201305( RespondingGatewayPRPAIN201305UV02RequestType event) { HomeCommunityType senderHomeCommunity = new HomeCommunityType(); if (event != null && event.getPRPAIN201305UV02().getSender() != null && event.getPRPAIN201305UV02().getSender().getDevice() != null && event.getPRPAIN201305UV02().getSender().getDevice().getAsAgent() != null && event.getPRPAIN201305UV02().getSender().getDevice().getAsAgent().getValue() != null && event .getPRPAIN201305UV02() .getSender() .getDevice() .getAsAgent() .getValue() .getRepresentedOrganization() != null && event .getPRPAIN201305UV02() .getSender() .getDevice() .getAsAgent() .getValue() .getRepresentedOrganization() .getValue() != null && NullChecker.isNotNullish( event .getPRPAIN201305UV02() .getSender() .getDevice() .getAsAgent() .getValue() .getRepresentedOrganization() .getValue() .getId()) && event .getPRPAIN201305UV02() .getSender() .getDevice() .getAsAgent() .getValue() .getRepresentedOrganization() .getValue() .getId() .get(0) != null && NullChecker.isNotNullish( event .getPRPAIN201305UV02() .getSender() .getDevice() .getAsAgent() .getValue() .getRepresentedOrganization() .getValue() .getId() .get(0) .getRoot())) { senderHomeCommunity.setHomeCommunityId( event .getPRPAIN201305UV02() .getSender() .getDevice() .getAsAgent() .getValue() .getRepresentedOrganization() .getValue() .getId() .get(0) .getRoot()); } return senderHomeCommunity; }
/** * Transform method to create a CheckPolicyRequest object from a 201305 request * * @param request * @return CheckPolicyRequestType */ public CheckPolicyRequestType transformPatientDiscoveryEntityToCheckPolicy( RespondingGatewayPRPAIN201305UV02RequestType event) { addDebugLog( "Begin -- PatientDiscoveryPolicyTransformHelper.transformPatientDiscoveryEntityToCheckPolicy()"); CheckPolicyRequestType checkPolicyRequest = null; if (event == null) { addErrorLog("Request is null."); return checkPolicyRequest; } else { checkPolicyRequest = new CheckPolicyRequestType(); } PRPAIN201305UV02 patDiscReq = event.getPRPAIN201305UV02(); // RequestType request = getRequestType(patDiscReq, event.getAssertion()); RequestType request = new RequestType(); SubjectHelper subjHelp = new SubjectHelper(); // SubjectType subject = subjHelp.subjectFactory(event.getAssertion().getHomeCommunity(), // event.getAssertion()); SubjectType subject = new SubjectType(); subject.setSubjectCategory(SubjectHelper.SubjectCategory); log.debug("transformPatientDiscoveryNhincToCheckPolicy - adding subject"); request.getSubject().add(subject); II qualifiedPatientIdentifier = extractPatientIdentifier(patDiscReq); if (qualifiedPatientIdentifier != null) { ResourceType resource = new ResourceType(); AttributeHelper attrHelper = new AttributeHelper(); resource .getAttribute() .add( attrHelper.attributeFactory( PatientAssigningAuthorityAttributeId, Constants.DataTypeString, qualifiedPatientIdentifier.getRoot())); String sStrippedPatientId = PatientIdFormatUtil.parsePatientId(qualifiedPatientIdentifier.getExtension()); log.debug( "transformPatientDiscoveryNhincToCheckPolicy: sStrippedPatientId = " + sStrippedPatientId); resource .getAttribute() .add( attrHelper.attributeFactory( PatientIdAttributeId, Constants.DataTypeString, sStrippedPatientId)); HomeCommunityType homeCommunityId = null; if (event != null && event.getPRPAIN201305UV02() != null && NullChecker.isNotNullish(event.getPRPAIN201305UV02().getReceiver()) && event.getPRPAIN201305UV02().getReceiver().get(0) != null && event.getPRPAIN201305UV02().getReceiver().get(0).getDevice() != null && event.getPRPAIN201305UV02().getReceiver().get(0).getDevice().getAsAgent() != null && event.getPRPAIN201305UV02().getReceiver().get(0).getDevice().getAsAgent().getValue() != null && event .getPRPAIN201305UV02() .getReceiver() .get(0) .getDevice() .getAsAgent() .getValue() .getRepresentedOrganization() != null && event .getPRPAIN201305UV02() .getReceiver() .get(0) .getDevice() .getAsAgent() .getValue() .getRepresentedOrganization() .getValue() != null && NullChecker.isNotNullish( event .getPRPAIN201305UV02() .getReceiver() .get(0) .getDevice() .getAsAgent() .getValue() .getRepresentedOrganization() .getValue() .getId()) && event .getPRPAIN201305UV02() .getReceiver() .get(0) .getDevice() .getAsAgent() .getValue() .getRepresentedOrganization() .getValue() .getId() .get(0) != null && NullChecker.isNotNullish( event .getPRPAIN201305UV02() .getReceiver() .get(0) .getDevice() .getAsAgent() .getValue() .getRepresentedOrganization() .getValue() .getId() .get(0) .getRoot())) { homeCommunityId = new HomeCommunityType(); homeCommunityId.setHomeCommunityId( event .getPRPAIN201305UV02() .getReceiver() .get(0) .getDevice() .getAsAgent() .getValue() .getRepresentedOrganization() .getValue() .getId() .get(0) .getRoot()); } resource .getAttribute() .add( attrHelper.attributeFactory( Constants.HomeCommunityAttributeId, Constants.DataTypeString, subjHelp.determineSendingHomeCommunityId(homeCommunityId, event.getAssertion()))); request.getResource().add(resource); } log.debug("transformPatientDiscoveryNhincToCheckPolicy - adding assertion data"); AssertionHelper assertHelp = new AssertionHelper(); assertHelp.appendAssertionDataToRequest(request, event.getAssertion()); request.setAction(ActionHelper.actionFactory(ActionOutValue)); checkPolicyRequest.setRequest(request); checkPolicyRequest.setAssertion(event.getAssertion()); addDebugLog( "End -- PatientDiscoveryPolicyTransformHelper.transformPatientDiscoveryEntityToCheckPolicy()"); return checkPolicyRequest; }