source: ccr/trunk/nhin-vista/projects/NHINC/Current/Product/Production/Adapters/General/AdapterPolicyEngineTransformEJB/src/java/gov/hhs/fha/nhinc/adapters/general/adapterpolicyenginetransformejb/adapterpolicyenginetransform/AdapterPolicyEngineTransform.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: 8.2 KB
Line 
1package gov.hhs.fha.nhinc.adapters.general.adapterpolicyenginetransformejb.adapterpolicyenginetransform;
2
3import gov.hhs.fha.nhinc.adapterpolicyenginetransform.AdapterPolicyEngineTransformPortType;
4import javax.ejb.Stateless;
5import javax.jws.WebService;
6import gov.hhs.fha.nhinc.common.nhinccommonadapter.TransformXACMLRequestToCppAQRResponseType;
7import gov.hhs.fha.nhinc.common.nhinccommonadapter.TransformXACMLRequestToCppAQRRequestType;
8import gov.hhs.fha.nhinc.common.nhinccommonadapter.TransformAQRToCppRDSRResponseType;
9import gov.hhs.fha.nhinc.common.nhinccommonadapter.TransformAQRToCppRDSRRequestType;
10import gov.hhs.fha.nhinc.common.nhinccommonadapter.CheckPatientOptInResponseType;
11import gov.hhs.fha.nhinc.common.nhinccommonadapter.CheckPatientOptInRequestType;
12import gov.hhs.fha.nhinc.common.nhinccommonadapter.TransformXACMLRequestToAQRForPatientIdResponseType;
13import gov.hhs.fha.nhinc.common.nhinccommonadapter.TransformXACMLRequestToAQRForPatientIdRequestType;
14import gov.hhs.fha.nhinc.common.nhinccommonadapter.TransformPatientIdAQRToCppXACMLResponseType;
15import gov.hhs.fha.nhinc.common.nhinccommonadapter.TransformPatientIdAQRToCppXACMLRequestType;
16
17import org.apache.commons.logging.Log;
18import org.apache.commons.logging.LogFactory;
19
20
21/**
22 * This is used to do some of the transforms of messages for the Policy Engine. They
23 * were getting too complex to do in BPEL and this seemed like a much better place to do these.
24 *
25 * @author Les Westberg
26 *
27 */
28@WebService(serviceName = "AdapterPolicyEngineTransform",
29 portName = "AdapterPolicyEngineTransformPortSoap11",
30 endpointInterface = "gov.hhs.fha.nhinc.adapterpolicyenginetransform.AdapterPolicyEngineTransformPortType",
31 targetNamespace = "urn:gov:hhs:fha:nhinc:adapterpolicyenginetransform",
32 wsdlLocation = "META-INF/wsdl/AdapterPolicyEngineTransform/AdapterPolicyEngineTransform.wsdl")
33@Stateless
34public class AdapterPolicyEngineTransform implements AdapterPolicyEngineTransformPortType
35{
36 private static Log log = LogFactory.getLog(AdapterPolicyEngineTransform.class);
37
38 /**
39 * This message transforms a XACML request message to an AdhocQueryRequest
40 * message that can be used to find the CPP (Consumer Preferences Profile)
41 * document for the patient.
42 *
43 * @param transformXACMLRequestToCppAQRRequest The XACML request to be
44 * transformed.
45 *
46 * @return The AdhocQueryRequest to get the CPP document.
47 */
48 public TransformXACMLRequestToCppAQRResponseType transformXACMLRequestToCppAQR(TransformXACMLRequestToCppAQRRequestType transformXACMLRequestToCppAQRRequest)
49 {
50 TransformXACMLRequestToCppAQRResponseType oResponse = new TransformXACMLRequestToCppAQRResponseType();
51
52 try
53 {
54 oResponse = AdapterPolicyEngineTransformHelper.transformXACMLRequestToCppAQR(transformXACMLRequestToCppAQRRequest);
55 }
56 catch (Exception e)
57 {
58 String sErrorMessage = "Failed to transform XACML request to a CPP AdhocQueryRequest. Error: " +
59 e.getMessage();
60 log.error(sErrorMessage);
61 }
62
63 return oResponse;
64 }
65
66 /**
67 * This method transforms a message from a CPP AdhocQueryResponse message to
68 * a RetrieveDocumentSetRequest message that can be used to retrieve the
69 * CPP document.
70 *
71 * @param transformAQRToCppRDSRRequest The AdhocQueryResponse message that
72 * was returned form the Document Query to get the CPP document.
73 * @return The RetrieveDocumentSetRequest that can be used to retrieve
74 * the CPP document.
75 */
76 public TransformAQRToCppRDSRResponseType transformAQRToCppRDSR(TransformAQRToCppRDSRRequestType transformAQRToCppRDSRRequest)
77 {
78 TransformAQRToCppRDSRResponseType oResponse = new TransformAQRToCppRDSRResponseType();
79
80 try
81 {
82 oResponse = AdapterPolicyEngineTransformHelper.transformAQRToCppRDSR(transformAQRToCppRDSRRequest);
83 }
84 catch (Exception e)
85 {
86 String sErrorMessage = "Failed to transform CPP AdhocQueryResponse to a CPP RetrieveDocumentSetRequest. Error: " +
87 e.getMessage();
88 log.error(sErrorMessage);
89 }
90
91 return oResponse;
92 }
93
94 /**
95 * This method takes the RetrieveDocumentSetResponse message from the
96 * document repository that contains the CPP document and looks at the
97 * CPP document and returns TRUE if the patient has opted in and false if
98 * they have not. If the document does not exist or the input parameter
99 * is null, then it means that the patient has opted out and false is
100 * returned.
101 *
102 * @param checkPatientOptInRequest The RetrieveDocumentSetResponse containing
103 * the CPP document.
104 * @return TRUE if the patient has opted in and false if they have not.
105 */
106 public CheckPatientOptInResponseType checkPatientOptIn(CheckPatientOptInRequestType checkPatientOptInRequest)
107 {
108 CheckPatientOptInResponseType oResponse = new CheckPatientOptInResponseType();
109
110 try
111 {
112 oResponse = AdapterPolicyEngineTransformHelper.checkPatientOptIn(checkPatientOptInRequest);
113 }
114 catch (Exception e)
115 {
116 String sErrorMessage = "Failed to transform CPP RetrieveDocumentSetResponse to a valid patient opt in value. Error: " +
117 e.getMessage();
118 log.error(sErrorMessage);
119 }
120
121 return oResponse;
122 }
123
124 /**
125 * This method transforms a XACML request to the information needed to
126 * retrienve the patient ID from the Document Registry based on the
127 * document information. This will return an AdhocQueryRequest.
128 *
129 * @param transformXACMLRequestToAQRForPatientIdRequest The XACML information
130 * that contains the document identifiers.
131 * @return The AdhocQueryRequest to retrieve the patient ID
132 * information based on the document identifiers.
133 */
134 public TransformXACMLRequestToAQRForPatientIdResponseType transformXACMLRequestToAQRForPatientId(TransformXACMLRequestToAQRForPatientIdRequestType transformXACMLRequestToAQRForPatientIdRequest)
135 {
136 TransformXACMLRequestToAQRForPatientIdResponseType oResponse = new TransformXACMLRequestToAQRForPatientIdResponseType();
137
138 try
139 {
140 oResponse = AdapterPolicyEngineTransformHelper.transformXACMLRequestToAQRForPatientId(transformXACMLRequestToAQRForPatientIdRequest);
141 }
142 catch (Exception e)
143 {
144 String sErrorMessage = "Failed to transform XACML Request to a valid AdhocQueryRequest to retrive the meta data for the document. Error: " +
145 e.getMessage();
146 log.error(sErrorMessage);
147 }
148
149 return oResponse;
150 }
151
152 /**
153 * This method takes the AdhocQueryResponse containing the document
154 * meta data including the Patient ID and it will create a XACML request
155 * containing the patient ID so that it can be passed into the
156 * CheckPolicyPatientOptIn method to determine if the patient has opted in.
157 *
158 * @param transformPatientIdAQRToCppXACMLRequest The AdhocQueryResponse
159 * containing the patient ID for the patient associated with the document.
160 * @return The XACML policy containing the patient ID.
161 *
162 */
163 public TransformPatientIdAQRToCppXACMLResponseType transformPatientIdAQRToCppXACML(TransformPatientIdAQRToCppXACMLRequestType transformPatientIdAQRToCppXACMLRequest)
164 {
165 TransformPatientIdAQRToCppXACMLResponseType oResponse = new TransformPatientIdAQRToCppXACMLResponseType();
166
167 try
168 {
169 oResponse = AdapterPolicyEngineTransformHelper.transformPatientIdAQRToCppXACML(transformPatientIdAQRToCppXACMLRequest);
170 }
171 catch (Exception e)
172 {
173 String sErrorMessage = "Failed to transform AdhocQueryRequest to a valid XACML Request object containing the patient ID. Error: " +
174 e.getMessage();
175 log.error(sErrorMessage);
176 }
177
178 return oResponse;
179 }
180}
Note: See TracBrowser for help on using the repository browser.