/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package gov.hhs.fha.nhinc.gateway.policyenginetransformation; import gov.hhs.fha.nhinc.common.nhinccommonadapter.CheckPolicyRequestType; import gov.hhs.fha.nhinc.common.eventcommon.NotifyEventType; import gov.hhs.fha.nhinc.gateway.policyenginetransformation.Helpers.ActionHelper; import gov.hhs.fha.nhinc.gateway.policyenginetransformation.Helpers.InboundOutboundChecker; import gov.hhs.fha.nhinc.gateway.policyenginetransformation.Helpers.SubjectHelper; import oasis.names.tc.xacml._2_0.context.schema.os.RequestType; import oasis.names.tc.xacml._2_0.context.schema.os.SubjectType; /** * * @author svalluripalli */ public class NotifyTransformHelper { private static final String ActionInValue = "HIEMNotifyIn"; private static final String ActionOutValue = "HIEMNotifyOut"; public static CheckPolicyRequestType transformNotifyToCheckPolicy(NotifyEventType event) { CheckPolicyRequestType genericPolicyRequest = new CheckPolicyRequestType(); RequestType request = new RequestType(); if (InboundOutboundChecker.IsInbound(event.getDirection())) { request.setAction(ActionHelper.actionFactory(ActionInValue)); } if (InboundOutboundChecker.IsOutbound(event.getDirection())) { request.setAction(ActionHelper.actionFactory(ActionOutValue)); } SubjectType subject = SubjectHelper.subjectFactory(event.getSendingHomeCommunity(), event.getMessage().getAssertion()); request.getSubject().add(subject); genericPolicyRequest.setRequest(request); return genericPolicyRequest; } }