1 | /*
|
---|
2 | * To change this template, choose Tools | Templates
|
---|
3 | * and open the template in the editor.
|
---|
4 | */
|
---|
5 | package gov.hhs.fha.nhinc.subscription.dte;
|
---|
6 |
|
---|
7 | import gov.hhs.fha.nhinc.common.nhinccommonadapter.SubscribeCdcBioPackageRequestType;
|
---|
8 | import gov.hhs.fha.nhinc.common.subscription.KeyValuePairType;
|
---|
9 | import gov.hhs.fha.nhinc.common.subscription.SubscriptionItemType;
|
---|
10 | import gov.hhs.fha.nhinc.common.subscriptionb2overrideforcdc.SubscribeCdcBioPackageType;
|
---|
11 | import gov.hhs.fha.nhinc.common.subscriptionb2overrideforcdc.SubscriptionPolicyType;
|
---|
12 | import gov.hhs.fha.nhinc.common.subscriptiondte.CreateAgencySubscribeCdcBioPackageResponseType;
|
---|
13 | import gov.hhs.healthit.nhin.cdc.CdcBioPackageSubscriptionCriteriaType;
|
---|
14 | import gov.hhs.healthit.nhin.cdc.CdcBioPackageSubscriptionCriteriaType.Frequency;
|
---|
15 | import java.math.BigInteger;
|
---|
16 | import javax.xml.bind.JAXBElement;
|
---|
17 | import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
---|
18 | import org.oasis_open.docs.wsn.b_2.Subscribe;
|
---|
19 | import org.oasis_open.docs.wsn.b_2.Subscribe.SubscriptionPolicy;
|
---|
20 |
|
---|
21 | /**
|
---|
22 | *
|
---|
23 | * @author rayj
|
---|
24 | */
|
---|
25 | public 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 | }
|
---|