Handle missing contained subscription

This commit is contained in:
jamesagnew 2021-05-19 09:45:04 -04:00
parent ff2698d4d1
commit e359b6d823
1 changed files with 5 additions and 1 deletions

View File

@ -354,6 +354,7 @@ public class SubscriptionCanonicalizer {
} }
@SuppressWarnings("EnumSwitchStatementWhichMissesCases") @SuppressWarnings("EnumSwitchStatementWhichMissesCases")
@Nullable
public String getCriteria(IBaseResource theSubscription) { public String getCriteria(IBaseResource theSubscription) {
String retVal = null; String retVal = null;
@ -371,7 +372,10 @@ public class SubscriptionCanonicalizer {
org.hl7.fhir.r5.model.Subscription subscription = (org.hl7.fhir.r5.model.Subscription) theSubscription; org.hl7.fhir.r5.model.Subscription subscription = (org.hl7.fhir.r5.model.Subscription) theSubscription;
String topicElement = subscription.getTopicElement().getValue(); String topicElement = subscription.getTopicElement().getValue();
org.hl7.fhir.r5.model.SubscriptionTopic topic = (org.hl7.fhir.r5.model.SubscriptionTopic) subscription.getContained().stream().filter(t -> ("#" + t.getId()).equals(topicElement) || (t.getId()).equals(topicElement)).findFirst().orElse(null); org.hl7.fhir.r5.model.SubscriptionTopic topic = (org.hl7.fhir.r5.model.SubscriptionTopic) subscription.getContained().stream().filter(t -> ("#" + t.getId()).equals(topicElement) || (t.getId()).equals(topicElement)).findFirst().orElse(null);
Validate.notNull(topic); if (topic == null) {
ourLog.warn("Missing contained subscription topic in R5 subscription");
return null;
}
retVal = topic.getResourceTriggerFirstRep().getQueryCriteria().getCurrent(); retVal = topic.getResourceTriggerFirstRep().getQueryCriteria().getCurrent();
break; break;
} }