source: ccr/trunk/nhin-vista/projects/NHINC/Current/Product/Production/Gateway/SubscriptionDteEjb/src/java/gov/hhs/fha/nhinc/subscription/dte/CreateAgencySubscribeCdcBioPackageHelper.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: 3.6 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.subscription.dte;
6
7import gov.hhs.fha.nhinc.common.nhinccommonadapter.SubscribeCdcBioPackageRequestType;
8import gov.hhs.fha.nhinc.common.subscription.KeyValuePairType;
9import gov.hhs.fha.nhinc.common.subscription.SubscriptionItemType;
10import gov.hhs.fha.nhinc.common.subscriptionb2overrideforcdc.SubscribeCdcBioPackageType;
11import gov.hhs.fha.nhinc.common.subscriptionb2overrideforcdc.SubscriptionPolicyType;
12import gov.hhs.fha.nhinc.common.subscriptiondte.CreateAgencySubscribeCdcBioPackageResponseType;
13import gov.hhs.healthit.nhin.cdc.CdcBioPackageSubscriptionCriteriaType;
14import gov.hhs.healthit.nhin.cdc.CdcBioPackageSubscriptionCriteriaType.Frequency;
15import java.math.BigInteger;
16import javax.xml.bind.JAXBElement;
17import javax.xml.ws.wsaddressing.W3CEndpointReference;
18import org.oasis_open.docs.wsn.b_2.Subscribe;
19import org.oasis_open.docs.wsn.b_2.Subscribe.SubscriptionPolicy;
20
21/**
22 *
23 * @author rayj
24 */
25public class CreateAgencySubscribeCdcBioPackageHelper {
26
27 public static gov.hhs.fha.nhinc.common.subscriptiondte.CreateAgencySubscribeCdcBioPackageResponseType createAgencySubscribeCdcBioPackage(gov.hhs.fha.nhinc.common.subscriptiondte.CreateAgencySubscribeCdcBioPackageRequestType request) {
28 CreateAgencySubscribeCdcBioPackageResponseType response = new CreateAgencySubscribeCdcBioPackageResponseType();
29
30 Subscribe nhinSubscribe = request.getSubscribe();
31 SubscribeCdcBioPackageType agencySubscribe = CreateSubscribeCdcBioPackage(nhinSubscribe);
32 response.setSubscribe(agencySubscribe);
33
34 return response;
35 }
36
37// public static SubscribeCdcBioPackageRequestType CreateSubscribeCdcBioPackageRequest(org.oasis_open.docs.wsn.b_2.Subscribe nhinSubscribe) {
38// SubscribeCdcBioPackageRequestType subscribeCdcBioPackageRequest = new SubscribeCdcBioPackageRequestType();
39//
40// SubscribeCdcBioPackageType subscribe = CreateSubscribeCdcBioPackage(nhinSubscribe);
41// subscribeCdcBioPackageRequest.setSubscribe(subscribe);
42//
43// return subscribeCdcBioPackageRequest;
44// }
45 public static SubscribeCdcBioPackageType CreateSubscribeCdcBioPackage(org.oasis_open.docs.wsn.b_2.Subscribe nhinSubscribe) {
46 SubscribeCdcBioPackageType subscribeCdcBioPackage = new SubscribeCdcBioPackageType();
47
48 subscribeCdcBioPackage.setFilter(nhinSubscribe.getFilter());
49
50 SubscriptionPolicyType agencyPolicy = new SubscriptionPolicyType();
51 SubscriptionPolicy nhinPolicy = nhinSubscribe.getSubscriptionPolicy();
52 for (Object nhinPolicyAnyItem : nhinPolicy.getAny()) {
53 if (nhinPolicyAnyItem instanceof JAXBElement) {
54 JAXBElement jb = (JAXBElement) nhinPolicyAnyItem;
55 if (jb.getValue() instanceof CdcBioPackageSubscriptionCriteriaType) {
56 CdcBioPackageSubscriptionCriteriaType nhinSubscriptionCriteria = (CdcBioPackageSubscriptionCriteriaType) jb.getValue();
57 agencyPolicy.setCdcBioPackageSubscriptionCriteria(nhinSubscriptionCriteria);
58 }
59 }
60 }
61
62 subscribeCdcBioPackage.setSubscriptionPolicy(agencyPolicy);
63
64
65
66
67 String notificationConsumerEndpointAddress = Configuration.getlocalNotificationConsumerEndpointAddress();
68 String userAddress = null;
69 W3CEndpointReference consumerReference = ConsumerReferenceHelper.CreateConsumerReference(notificationConsumerEndpointAddress, userAddress);
70 subscribeCdcBioPackage.setConsumerReference(consumerReference);
71
72 return subscribeCdcBioPackage;
73 }
74}
Note: See TracBrowser for help on using the repository browser.