1 | /*
|
---|
2 | * To change this template, choose Tools | Templates
|
---|
3 | * and open the template in the editor.
|
---|
4 | */
|
---|
5 | package gov.hhs.fha.nhinc.auditquery;
|
---|
6 |
|
---|
7 | import com.services.nhinc.schema.auditmessage.FindAuditEventsResponseType;
|
---|
8 | import com.services.nhinc.schema.auditmessage.FindAuditEventsType;
|
---|
9 | import gov.hhs.fha.nhinc.common.nhinccommoninternalorch.FindAuditEventsRequestType;
|
---|
10 | import gov.hhs.fha.nhinc.nhincauditlogquery.NhincAuditLogQueryPortType;
|
---|
11 | import gov.hhs.fha.nhinc.nhincauditlogquery.NhincAuditLogQueryService;
|
---|
12 | import gov.hhs.fha.nhinc.nhinclib.NullChecker;
|
---|
13 | import gov.hhs.fha.nhinc.saml.extraction.SamlTokenExtractor;
|
---|
14 | import gov.hhs.fha.nhinc.saml.extraction.SamlTokenExtractorHelper;
|
---|
15 | import javax.xml.ws.WebServiceContext;
|
---|
16 | import org.apache.commons.logging.Log;
|
---|
17 | import org.apache.commons.logging.LogFactory;
|
---|
18 |
|
---|
19 | /**
|
---|
20 | *
|
---|
21 | * @author Jon Hoppesch
|
---|
22 | */
|
---|
23 | public class AuditQueryImpl {
|
---|
24 |
|
---|
25 | private static Log log = LogFactory.getLog(AuditQueryImpl.class);
|
---|
26 |
|
---|
27 | public static FindAuditEventsResponseType auditQuery(FindAuditEventsType query, WebServiceContext context) {
|
---|
28 | log.debug("Entering AuditQueryImpl.auditQuery");
|
---|
29 | FindAuditEventsResponseType resp = new FindAuditEventsResponseType();
|
---|
30 | FindAuditEventsRequestType request = new FindAuditEventsRequestType();
|
---|
31 |
|
---|
32 | request.setFindAuditEvents(query);
|
---|
33 | request.setAssertion(SamlTokenExtractor.GetAssertion(context));
|
---|
34 |
|
---|
35 | String homeCommunityId = SamlTokenExtractorHelper.getHomeCommunityId();
|
---|
36 |
|
---|
37 | if (NullChecker.isNotNullish(homeCommunityId)) {
|
---|
38 | NhincAuditLogQueryService service = new NhincAuditLogQueryService();
|
---|
39 | NhincAuditLogQueryPortType port = service.getNhincAuditLogcQueryPortTypeBindingPort();
|
---|
40 | ((javax.xml.ws.BindingProvider) port).getRequestContext().put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, SamlTokenExtractorHelper.INTERNAL_AUDIT_QUERY));
|
---|
41 |
|
---|
42 | resp = port.nhincAuditLogQuery(request);
|
---|
43 | }
|
---|
44 | else {
|
---|
45 | return null;
|
---|
46 | }
|
---|
47 |
|
---|
48 | log.debug("Exiting AuditQueryImpl.auditQuery");
|
---|
49 | return resp;
|
---|
50 | }
|
---|
51 | }
|
---|