XDRPolicyTransformHelper { public CheckPolicyRequestType transformXDRToCheckPolicy(XDREventType event) { LOG.debug("Begin -- XDRPolicyTransformHelper.transformXDRToCheckPolicy()"); CheckPolicyRequestType checkPolicyRequest = null; if (event == null) { LOG.debug("Request is null."); return checkPolicyRequest; } else { checkPolicyRequest = new CheckPolicyRequestType(); } RequestType request = new RequestType(); SubjectHelper subjHelp = new SubjectHelper(); SubjectType subject = subjHelp.subjectFactory(event.getSendingHomeCommunity(), event.getMessage().getAssertion()); LOG.debug("transformXDRToCheckPolicy - adding subject"); request.getSubject().add(subject); String encodedPatientId = getPatientIdFromEvent(event); String assigningAuthorityId = PatientIdFormatUtil.parseCommunityId(encodedPatientId); String patId = PatientIdFormatUtil.parsePatientId(encodedPatientId); if (patId != null && assigningAuthorityId != null) { ResourceType resource = new ResourceType(); AttributeHelper attrHelper = new AttributeHelper(); resource.getAttribute().add(attrHelper.attributeFactory(PatientAssigningAuthorityAttributeId, Constants.DataTypeString, assigningAuthorityId)); LOG.debug("transformXDRToCheckPolicy: sStrippedPatientId = {}", patId); resource.getAttribute() .add(attrHelper.attributeFactory(PatientIdAttributeId, Constants.DataTypeString, patId)); request.getResource().add(resource); } LOG.debug("transformXDRToCheckPolicy - adding assertion data"); AssertionHelper assertHelp = new AssertionHelper(); assertHelp.appendAssertionDataToRequest(request, event.getMessage().getAssertion()); if (NhincConstants.POLICYENGINE_OUTBOUND_DIRECTION.equals(event.getDirection())) { request.setAction(ActionHelper.actionFactory(ActionOutValue)); } else if (NhincConstants.POLICYENGINE_INBOUND_DIRECTION.equals(event.getDirection())) { request.setAction(ActionHelper.actionFactory(ActionInValue)); } checkPolicyRequest.setRequest(request); checkPolicyRequest.setAssertion(event.getMessage().getAssertion()); LOG.debug("End -- XDRPolicyTransformHelper.transformXDRToCheckPolicy()"); return checkPolicyRequest; }  CheckPolicyRequestType transformXDRToCheckPolicy(XDREventType event); CheckPolicyRequestType transformXDREntityToCheckPolicy(
        RespondingGatewayProvideAndRegisterDocumentSetSecuredRequestType request); CheckPolicyRequestType transformXDRResponseToCheckPolicy(XDRResponseEventType event);  }
@Test public void testTransformXDRToCheckPolicy() throws Exception { XDREventType eventA = new XDREventType(); assertionType.setMessageId(MESSAGE_ID); pnt.setFullName("Minh"); assertionType.setPersonName(pnt); rsl.getSlot().add(slotType1); sor.setId("100"); sor.setRequestSlotList(rsl); ProvideAndRegisterDocumentSetRequestType prdsrt = new ProvideAndRegisterDocumentSetRequestType(); Document doc = new Document(); doc.setId("223"); prdsrt.getDocument().add(doc); prdsrt.setSubmitObjectsRequest(sor); sor.setRegistryObjectList(rolt); XDRMessageType xmt = new XDRMessageType(); eventA.setMessage(xmt); xmt.setAssertion(assertionType); xmt.setProvideAndRegisterDocumentSetRequest(prdsrt); RequestType request = new RequestType(); SubjectHelper subjHelp = new SubjectHelper(); SubjectType subject = subjHelp.subjectFactory(hct, assertionType); request.getSubject().add(subject); assertionType.setHomeCommunity(hct); assertionType.setSSN("170112756"); eventA.setSendingHomeCommunity(hct); String direction = "inbound"; eventA.setDirection(direction); eventA.getMessage().setAssertion(assertionType); CheckPolicyRequestType result = xdrTransformHelper.transformXDRToCheckPolicy(eventA); verifycheckPolicy_Request(result); }