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.NotifySubscribersOfCdcBioPackageRequestType;
|
---|
8 |
|
---|
9 | import gov.hhs.fha.nhinc.common.nhinccommonadapter.NotifySubscribersOfCdcBioPackageRequestType;
|
---|
10 | import gov.hhs.fha.nhinc.common.subscription.TopicExpressionType;
|
---|
11 | import gov.hhs.fha.nhinc.common.subscriptionb2overrideforcdc.NotificationMessageHolderType;
|
---|
12 | import gov.hhs.fha.nhinc.common.subscriptionb2overrideforcdc.NotificationMessageHolderType.Message;
|
---|
13 | import gov.hhs.fha.nhinc.common.subscriptionb2overrideforcdc.NotifyCdcBioPackageType;
|
---|
14 | import gov.hhs.fha.nhinc.common.subscriptiondte.CreateAgencyNotifyCdcBioPackageRequestType;
|
---|
15 |
|
---|
16 | //import gov.hhs.fha.nhinc.common.subscriptionb2overrideforcdc.NotifyCdcBioPackageType;
|
---|
17 | import gov.hhs.fha.nhinc.common.subscriptiondte.CreateAgencyNotifyCdcBioPackageResponseType;
|
---|
18 | //import gov.hhs.fha.nhinc.subscription.*;
|
---|
19 | import java.util.List;
|
---|
20 | //urn:gov:hhs:fha:nhinc:common:subscriptionb2overrideforcdc
|
---|
21 | import javax.xml.bind.JAXBElement;
|
---|
22 | //import gov.hhs.fha.nhinc.subscription_b_2_overrideforcdc.NotificationMessageHolderType;
|
---|
23 | import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
---|
24 | //import gov.hhs.fha.nhinc.subscription_b_2_overrideforcdc.NotificationMessageHolderType.Message;
|
---|
25 | //import gov.hhs.fha.nhinc.subscription_b_2_overrideforcdc.NotifyCdcBioPackageType;
|
---|
26 | //import java.util.ArrayList;
|
---|
27 | //import java.util.List;
|
---|
28 | //import javax.xml.bind.JAXBElement;
|
---|
29 | //import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
---|
30 | //import gov.hhs.fha.nhinc.common.subscriptiondte.CreateAgencyNotifyCdcBioPackageResponseType;
|
---|
31 | //import gov.hhs.fha.nhinc.common.subscriptiondte.CreateAgencyNotifyCdcBioPackageRequestType;
|
---|
32 |
|
---|
33 | /**
|
---|
34 | *
|
---|
35 | * @author rayj
|
---|
36 | */
|
---|
37 | public class CreateAgencyNotifyCdcBioPackageHelper {
|
---|
38 |
|
---|
39 | public static CreateAgencyNotifyCdcBioPackageResponseType createAgencyNotifyCdcBioPackage(CreateAgencyNotifyCdcBioPackageRequestType createNotifyRequest) {
|
---|
40 | CreateAgencyNotifyCdcBioPackageResponseType result = new CreateAgencyNotifyCdcBioPackageResponseType();
|
---|
41 |
|
---|
42 | NotifySubscribersOfCdcBioPackageRequestType notifySubscribers = new NotifySubscribersOfCdcBioPackageRequestType();
|
---|
43 | result.setNotifySubscribersOfCdcBioPackageRequest(notifySubscribers);
|
---|
44 |
|
---|
45 | NotifyCdcBioPackageType notify =new NotifyCdcBioPackageType();
|
---|
46 | notifySubscribers.setNotify(notify);
|
---|
47 |
|
---|
48 | List< NotificationMessageHolderType> notificationMessageList = notify.getNotificationMessage();
|
---|
49 |
|
---|
50 | NotificationMessageHolderType notificationMessage = new NotificationMessageHolderType();
|
---|
51 | notificationMessageList.add(notificationMessage);
|
---|
52 | Message message = new Message();
|
---|
53 | notificationMessage.setMessage(message);
|
---|
54 |
|
---|
55 | org.oasis_open.docs.wsn.b_2.NotificationMessageHolderType.Message nhinNotificationMessage = NotifyHelper.getMessage(createNotifyRequest.getNotify());
|
---|
56 | Object any = nhinNotificationMessage.getAny();
|
---|
57 | if ((any != null) && (any instanceof JAXBElement)) {
|
---|
58 | Object anyvalue = ((JAXBElement) any).getValue();
|
---|
59 | if (anyvalue instanceof byte[]) {
|
---|
60 | byte[] bytearray = (byte[]) anyvalue;
|
---|
61 | message.setCdcBioPackagePayload(bytearray);
|
---|
62 | }
|
---|
63 | }
|
---|
64 |
|
---|
65 | W3CEndpointReference nhinSubscriptionReference = SubscriptionReferenceHelper.createNhinSubscriptionReference(createNotifyRequest.getSubscriptionReference());
|
---|
66 | notificationMessage.setSubscriptionReference(nhinSubscriptionReference);
|
---|
67 |
|
---|
68 | org.oasis_open.docs.wsn.b_2.TopicExpressionType topic = TopicHelper.GetTopic(createNotifyRequest.getNotify());
|
---|
69 | notificationMessage.setTopic(topic);
|
---|
70 |
|
---|
71 |
|
---|
72 | return result;
|
---|
73 | }
|
---|
74 | }
|
---|