+ try {
+ checker.required( "feedName", sub.getFeedName());
+ }catch ( RequiredFieldException rfe2 ) {
+ logger.debug( rfe2.getApiError().toString() );
+ return responseBuilder.error(rfe2.getApiError());
+ }
+ // if we found a FeedName instead of a FeedId then try to look it up.
+ List<Feed> nfeeds = feeds.getAllFeeds( sub.getFeedName(), sub.getFeedVersion(), "equals");
+ if ( nfeeds.isEmpty() ) {
+ apiError.setCode(Status.NOT_FOUND.getStatusCode());
+ apiError.setFields("feedName");
+ return responseBuilder.error(apiError);
+ } else if (nfeeds.size() > 1) {
+ logger.debug( "Attempt to match "+ sub.getFeedName() + " ver="+sub.getFeedVersion() + " matched " + nfeeds.size() );
+ apiError.setCode(Status.CONFLICT.getStatusCode());
+ apiError.setFields("feedName");
+ return responseBuilder.error(apiError);
+ }
+ fnew = Iterables.getOnlyElement(nfeeds);