source: ccr/trunk/nhin-vista/projects/NHINC/Current/Product/Production/Gateway/GatewayPolicyEngineTransformationEjb/src/java/gov/hhs/fha/nhinc/gateway/policyenginetransformation/FindAuditEventsTransformHelper.java@ 507

Last change on this file since 507 was 507, checked in by George Lilly, 15 years ago

NHIN gateway and adaptor for use on linux with VistA EHR and RPMS

File size: 2.8 KB
Line 
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5package gov.hhs.fha.nhinc.gateway.policyenginetransformation;
6
7import com.services.nhinc.schema.auditmessage.FindAuditEventsType;
8import gov.hhs.fha.nhinc.common.nhinccommonadapter.CheckPolicyRequestType;
9import gov.hhs.fha.nhinc.common.eventcommon.FindAuditEventsEventType;
10import gov.hhs.fha.nhinc.common.eventcommon.FindAuditEventsMessageType;
11import gov.hhs.fha.nhinc.gateway.policyenginetransformation.Helpers.ActionHelper;
12import gov.hhs.fha.nhinc.gateway.policyenginetransformation.Helpers.AttributeHelper;
13import gov.hhs.fha.nhinc.gateway.policyenginetransformation.Helpers.Constants;
14import gov.hhs.fha.nhinc.gateway.policyenginetransformation.Helpers.InboundOutboundChecker;
15import gov.hhs.fha.nhinc.gateway.policyenginetransformation.Helpers.SubjectHelper;
16import oasis.names.tc.xacml._2_0.context.schema.os.RequestType;
17import oasis.names.tc.xacml._2_0.context.schema.os.ResourceType;
18import oasis.names.tc.xacml._2_0.context.schema.os.SubjectType;
19
20/**
21 *
22 * @author svalluripalli
23 */
24public class FindAuditEventsTransformHelper {
25
26 private static final String ActionInValue = "AuditLogQueryIn";
27 private static final String ActionOutValue = "AuditLogQueryOut";
28 private static final String PatientIdAttributeId = Constants.ResourceIdAttributeId;
29
30 public static CheckPolicyRequestType transformFindAuditEventsToCheckPolicy(FindAuditEventsEventType event) {
31 CheckPolicyRequestType genericPolicyRequest = new CheckPolicyRequestType();
32 RequestType request = new RequestType();
33
34 if (event != null) {
35 if (InboundOutboundChecker.IsInbound(event.getDirection())) {
36 request.setAction(ActionHelper.actionFactory(ActionInValue));
37 }
38 if (InboundOutboundChecker.IsOutbound(event.getDirection())) {
39 request.setAction(ActionHelper.actionFactory(ActionOutValue));
40 }
41 SubjectType subject = SubjectHelper.subjectFactory(event.getSendingHomeCommunity(), event.getMessage().getAssertion());
42 request.getSubject().add(subject);
43 FindAuditEventsMessageType message = event.getMessage();
44 if (message != null) {
45 FindAuditEventsType findAudit = message.getFindAuditEvents();
46 if(findAudit != null)
47 {
48 findAudit.getPatientId();
49 ResourceType resource = new ResourceType();
50 resource.getAttribute().add(AttributeHelper.attributeFactory(PatientIdAttributeId, Constants.DataTypeString, findAudit.getPatientId()));
51 request.getResource().add(resource);
52 }
53 }
54 }
55 genericPolicyRequest.setRequest(request);
56 return genericPolicyRequest;
57 }
58}
Note: See TracBrowser for help on using the repository browser.