1 | package gov.hhs.fha.nhinc.subscription.repository;
|
---|
2 |
|
---|
3 | import gov.hhs.fha.nhinc.nhinccomponentsubscriptionrepository.NhincComponentSubscriptionRepositoryPortType;
|
---|
4 | import javax.ejb.Stateless;
|
---|
5 | import javax.jws.WebService;
|
---|
6 | import org.apache.commons.logging.Log;
|
---|
7 | import org.apache.commons.logging.LogFactory;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * Service for the gateway subscription repository.
|
---|
11 | *
|
---|
12 | * @author Neil Webb
|
---|
13 | */
|
---|
14 | @WebService(serviceName = "NhincComponentSubscriptionRepositoryService", portName = "NhincComponentSubscriptionRepositoryPort", endpointInterface = "gov.hhs.fha.nhinc.nhinccomponentsubscriptionrepository.NhincComponentSubscriptionRepositoryPortType", targetNamespace = "urn:gov:hhs:fha:nhinc:nhinccomponentsubscriptionrepository", wsdlLocation = "META-INF/wsdl/GatewaySubscriptionRepository/NhincComponentSubscriptionRepository.wsdl")
|
---|
15 | @Stateless
|
---|
16 | public class GatewaySubscriptionRepository implements NhincComponentSubscriptionRepositoryPortType {
|
---|
17 | private static Log log = LogFactory.getLog(GatewaySubscriptionRepository.class);
|
---|
18 |
|
---|
19 | public gov.hhs.fha.nhinc.common.subscription.SubscriptionReferenceType storeSubscription(gov.hhs.fha.nhinc.common.subscription.SubscriptionItemType subscriptionItem) {
|
---|
20 | gov.hhs.fha.nhinc.common.subscription.SubscriptionReferenceType subscriptionReference = null;
|
---|
21 | try
|
---|
22 | {
|
---|
23 | subscriptionReference = new SubscriptionRepositoryHelper().storeSubscription(subscriptionItem);
|
---|
24 | }
|
---|
25 | catch(Throwable t)
|
---|
26 | {
|
---|
27 | log.error(t.getMessage(), t);
|
---|
28 | // Return empty reference until fault handling is implemented
|
---|
29 | subscriptionReference = new gov.hhs.fha.nhinc.common.subscription.SubscriptionReferenceType();
|
---|
30 | }
|
---|
31 | return subscriptionReference;
|
---|
32 | }
|
---|
33 |
|
---|
34 | public gov.hhs.fha.nhinc.common.nhinccommon.AcknowledgementType deleteSubscription(gov.hhs.fha.nhinc.common.subscription.DeleteSubscriptionMessageRequestType deleteSubscriptionMessage) {
|
---|
35 | gov.hhs.fha.nhinc.common.nhinccommon.AcknowledgementType ack = null;
|
---|
36 | try
|
---|
37 | {
|
---|
38 | if(deleteSubscriptionMessage != null)
|
---|
39 | {
|
---|
40 | ack = new SubscriptionRepositoryHelper().deleteSubscription(deleteSubscriptionMessage.getSubscriptionReference());
|
---|
41 | }
|
---|
42 | }
|
---|
43 | catch (SubscriptionRepositoryException ex)
|
---|
44 | {
|
---|
45 | log.error(ex.getMessage(), ex);
|
---|
46 | // Create an ack here until proper fault handling is established.
|
---|
47 | ack = new gov.hhs.fha.nhinc.common.nhinccommon.AcknowledgementType();
|
---|
48 | }
|
---|
49 | return ack;
|
---|
50 | }
|
---|
51 |
|
---|
52 | public gov.hhs.fha.nhinc.common.subscription.SubscriptionItemsType retrieveByCriteria(gov.hhs.fha.nhinc.common.subscription.SubscriptionCriteriaType subscriptionCriteria) {
|
---|
53 | gov.hhs.fha.nhinc.common.subscription.SubscriptionItemsType subscriptionItems = null;
|
---|
54 | try
|
---|
55 | {
|
---|
56 | subscriptionItems = new SubscriptionRepositoryHelper().retrieveByCriteria(subscriptionCriteria);
|
---|
57 | }
|
---|
58 | catch (SubscriptionRepositoryException ex)
|
---|
59 | {
|
---|
60 | log.error(ex.getMessage(), ex);
|
---|
61 | // Create empty response until fault handling is added
|
---|
62 | subscriptionItems = new gov.hhs.fha.nhinc.common.subscription.SubscriptionItemsType();
|
---|
63 | }
|
---|
64 | return subscriptionItems;
|
---|
65 | }
|
---|
66 |
|
---|
67 | public gov.hhs.fha.nhinc.common.subscription.SubscriptionItemType retrieveBySubscriptionReference(gov.hhs.fha.nhinc.common.subscription.RetrieveBySubscriptionReferenceRequestMessageType retrieveBySubscriptionReferenceRequest) {
|
---|
68 | gov.hhs.fha.nhinc.common.subscription.SubscriptionItemType subscriptionItem = null;
|
---|
69 | try
|
---|
70 | {
|
---|
71 | if(retrieveBySubscriptionReferenceRequest != null)
|
---|
72 | {
|
---|
73 | subscriptionItem = new SubscriptionRepositoryHelper().retrieveBySubscriptionReference(retrieveBySubscriptionReferenceRequest.getSubscriptionReference());
|
---|
74 | }
|
---|
75 | }
|
---|
76 | catch (SubscriptionRepositoryException ex)
|
---|
77 | {
|
---|
78 | log.error(ex.getMessage(), ex);
|
---|
79 | // Create empty response until fault handling is added
|
---|
80 | subscriptionItem = new gov.hhs.fha.nhinc.common.subscription.SubscriptionItemType();
|
---|
81 | }
|
---|
82 | return subscriptionItem;
|
---|
83 | }
|
---|
84 | }
|
---|