validateSubscriptionFilter(subscription.getSubscriptionFilter(), entityExists);
}
public void validateSubscriptionFilter(SubscriptionFilter subscriptionFilter, boolean entityExists) throws DispositionReportFaultMessage {
if (!entityExists && subscriptionFilter == null)
throw new ValueNotAllowedException(new ErrorMessage("errors.subscription.NoFilterOnNewSubscription"));
if (subscriptionFilter != null) {
int filterCount = 0;
ValidateInquiry validateInquiry = new ValidateInquiry(publisher);
if (subscriptionFilter.getFindBinding() != null) {
filterCount++;
validateInquiry.validateFindBinding(subscriptionFilter.getFindBinding());
}
if (subscriptionFilter.getFindBusiness() != null) {
filterCount++;
validateInquiry.validateFindBusiness(subscriptionFilter.getFindBusiness());
}
if (subscriptionFilter.getFindService() != null) {
filterCount++;
validateInquiry.validateFindService(subscriptionFilter.getFindService());
}
if (subscriptionFilter.getFindTModel() != null) {
filterCount++;
validateInquiry.validateFindTModel(subscriptionFilter.getFindTModel(), false);
}
if (subscriptionFilter.getFindRelatedBusinesses() != null) {
filterCount++;
validateInquiry.validateFindRelatedBusinesses(subscriptionFilter.getFindRelatedBusinesses(), false);
}
if (subscriptionFilter.getGetBindingDetail() != null) {
filterCount++;
validateInquiry.validateGetBindingDetail(subscriptionFilter.getGetBindingDetail());
}
if (subscriptionFilter.getGetBusinessDetail() != null) {
filterCount++;
validateInquiry.validateGetBusinessDetail(subscriptionFilter.getGetBusinessDetail());
}
if (subscriptionFilter.getGetServiceDetail() != null) {
filterCount++;
validateInquiry.validateGetServiceDetail(subscriptionFilter.getGetServiceDetail());
}
if (subscriptionFilter.getGetTModelDetail() != null) {
filterCount++;
validateInquiry.validateGetTModelDetail(subscriptionFilter.getGetTModelDetail());
}
if (subscriptionFilter.getGetAssertionStatusReport() != null) {
filterCount++;
}
if (filterCount == 0)
throw new ValueNotAllowedException(new ErrorMessage("errors.subscription.BlankFilter"));
if (filterCount > 1)
throw new ValueNotAllowedException(new ErrorMessage("errors.subscription.TooManyFilters", String.valueOf(filterCount)));
}
}