/** * Count the method statuses for a {@link RestResource} * @param restResource The resource which statuses will be counted * @return The result of the status count */ protected Map<RestMethodStatus, Integer> getRestMethodStatusCount(final RestResource restResource){ Preconditions.checkNotNull(restResource, "The REST resource cannot be null"); final Map<RestMethodStatus, Integer> statuses = ImmutableSet.copyOf(RestMethodStatus.values()).stream() .collect(toMap(status -> status, status -> 0)); final List<RestMethod> methods = this.methodRepository.findWithResourceId(restResource.getId()); methods.stream() .map(RestMethod::getStatus) .forEach(status -> statuses.put(status, statuses.get(status)+1)); return statuses; }
LOGGER.debug("Requested REST project action requested: " + action); if(UPDATE_STATUS.equalsIgnoreCase(action)){ final RestMethodStatus restMethodStatus = RestMethodStatus.valueOf(command.getRestMethodStatus()); for(String restApplicationId : command.getRestApplicationIds()){ serviceProcessor.process(UpdateRestApplicationsStatusInput.builder()
try { event = new RestEvent(restMethod.getName(), restRequest, projectId, applicationId, resourceId, restMethod.getId()); if (RestMethodStatus.DISABLED.equals(restMethod.getStatus())) { throw new RestException("The requested REST method, " + restMethod.getName() + ", is disabled"); } else if (RestMethodStatus.FORWARDED.equals(restMethod.getStatus())) { response = forwardRequest(restRequest, projectId, applicationId, resourceId, restMethod, pathParameters); } else if (RestMethodStatus.RECORDING.equals(restMethod.getStatus())) { response = forwardRequestAndRecordResponse(restRequest, projectId, applicationId, resourceId, restMethod, pathParameters); } else if (RestMethodStatus.RECORD_ONCE.equals(restMethod.getStatus())) { response = forwardRequestAndRecordResponseOnce(restRequest, projectId, applicationId, resourceId, restMethod, pathParameters); } else if (RestMethodStatus.ECHO.equals(restMethod.getStatus())) { response = echoResponse(restRequest); } else { // Status.MOCKED
LOGGER.debug("Requested REST project action requested: " + action); if(UPDATE_STATUS.equalsIgnoreCase(action)){ final RestMethodStatus restMethodStatus = RestMethodStatus.valueOf(command.getRestMethodStatus()); for(String restResourceId : command.getRestResourceIds()){ serviceProcessor.process(UpdateRestResourcesStatusInput.builder()
LOGGER.debug("Requested REST project action requested: " + action); if(UPDATE_STATUS.equalsIgnoreCase(action)){ final RestMethodStatus restMethodStatus = RestMethodStatus.valueOf(command.getRestMethodStatus()); for(String restMethodId : command.getRestMethodIds()){ final ReadRestMethodOutput readRestMethodOutput =
/** * Count the method statuses for {@link RestApplication} * @param restApplication The application which statuses will be counted * @return The result of the status count */ protected Map<RestMethodStatus, Integer> getRestMethodStatusCount(final RestApplication restApplication){ Preconditions.checkNotNull(restApplication, "The REST application cannot be null"); final Map<RestMethodStatus, Integer> statuses = new HashMap<RestMethodStatus, Integer>(); for(RestMethodStatus restMethodStatus : RestMethodStatus.values()){ statuses.put(restMethodStatus, 0); } final List<String> resourceIds = this.resourceRepository.findIdsWithApplicationId(restApplication.getId()); for(String resourceId : resourceIds){ final List<RestMethod> methods = this.methodRepository.findWithResourceId(resourceId); for(RestMethod restMethod : methods){ RestMethodStatus restMethodStatus = restMethod.getStatus(); statuses.put(restMethodStatus, statuses.get(restMethodStatus)+1); } } return statuses; }