1 | /*
|
---|
2 | * To change this template, choose Tools | Templates
|
---|
3 | * and open the template in the editor.
|
---|
4 | */
|
---|
5 |
|
---|
6 | package gov.hhs.fha.nhinc.gateway.policyenginetransformation;
|
---|
7 | import gov.hhs.fha.nhinc.common.nhinccommonadapter.CheckPolicyRequestType;
|
---|
8 | import gov.hhs.fha.nhinc.common.eventcommon.NotifyEventType;
|
---|
9 | import gov.hhs.fha.nhinc.gateway.policyenginetransformation.Helpers.ActionHelper;
|
---|
10 | import gov.hhs.fha.nhinc.gateway.policyenginetransformation.Helpers.InboundOutboundChecker;
|
---|
11 | import gov.hhs.fha.nhinc.gateway.policyenginetransformation.Helpers.SubjectHelper;
|
---|
12 | import oasis.names.tc.xacml._2_0.context.schema.os.RequestType;
|
---|
13 | import oasis.names.tc.xacml._2_0.context.schema.os.SubjectType;
|
---|
14 | /**
|
---|
15 | *
|
---|
16 | * @author svalluripalli
|
---|
17 | */
|
---|
18 | public class NotifyTransformHelper {
|
---|
19 | private static final String ActionInValue = "HIEMNotifyIn";
|
---|
20 | private static final String ActionOutValue = "HIEMNotifyOut";
|
---|
21 |
|
---|
22 | public static CheckPolicyRequestType transformNotifyToCheckPolicy(NotifyEventType event) {
|
---|
23 | CheckPolicyRequestType genericPolicyRequest = new CheckPolicyRequestType();
|
---|
24 | RequestType request = new RequestType();
|
---|
25 | if (InboundOutboundChecker.IsInbound(event.getDirection())) {
|
---|
26 | request.setAction(ActionHelper.actionFactory(ActionInValue));
|
---|
27 | }
|
---|
28 | if (InboundOutboundChecker.IsOutbound(event.getDirection())) {
|
---|
29 | request.setAction(ActionHelper.actionFactory(ActionOutValue));
|
---|
30 | }
|
---|
31 | SubjectType subject = SubjectHelper.subjectFactory(event.getSendingHomeCommunity(), event.getMessage().getAssertion());
|
---|
32 | request.getSubject().add(subject);
|
---|
33 | genericPolicyRequest.setRequest(request);
|
---|
34 | return genericPolicyRequest;
|
---|
35 | }
|
---|
36 | }
|
---|