@PreAuthorize("hasAuthority('READER') or hasAuthority('MODIFIER') or hasAuthority('ADMIN')") @RequestMapping(value = "/{restProjectId}/application/{restApplicationId}/resource/{restResourceId}/method/{restMethodId}/response/{restMockResponseId}", method = RequestMethod.GET) public ModelAndView defaultPage(@PathVariable final String restProjectId, @PathVariable final String restApplicationId, @PathVariable final String restResourceId, @PathVariable final String restMethodId, @PathVariable final String restMockResponseId) { final ReadRestMockResponseOutput output = serviceProcessor.process(ReadRestMockResponseInput.builder() .restProjectId(restProjectId) .restApplicationId(restApplicationId) .restResourceId(restResourceId) .restMethodId(restMethodId) .restMockResponse(restMockResponseId) .build()); final ReadRestResourceQueryParametersOutput resourceQueryParameters = serviceProcessor.process(ReadRestResourceQueryParametersInput.builder() .projectId(restProjectId) .applicationId(restApplicationId) .resourceId(restResourceId) .build()); final ModelAndView model = createPartialModelAndView(PAGE); model.addObject(REST_PROJECT_ID, restProjectId); model.addObject(REST_APPLICATION_ID, restApplicationId); model.addObject(REST_RESOURCE_ID, restResourceId); model.addObject(REST_METHOD_ID, restMethodId); model.addObject(REST_MOCK_RESPONSE, output.getRestMockResponse()); model.addObject(REST_MOCK_RESPONSE_STATUSES, RestMockResponseStatus.values()); model.addObject(REST_QUERY_PARAMETERS, resourceQueryParameters.getQueries()); return model; }
LOGGER.debug("REST operation action requested: " + action); if(UPDATE_STATUS.equalsIgnoreCase(action)){ final RestMockResponseStatus status = RestMockResponseStatus.valueOf(command.getRestMockResponseStatus()); for(String mockResponseId : command.getRestMockResponseIds()){ ReadRestMockResponseOutput readRestMockResponseOutput = serviceProcessor.process(ReadRestMockResponseInput.builder()
if(mockResponse.getStatus().equals(RestMockResponseStatus.ENABLED)){ enabledMockResponses.add(mockResponse);
@PreAuthorize("hasAuthority('READER') or hasAuthority('MODIFIER') or hasAuthority('ADMIN')") @RequestMapping(value = "/{restProjectId}/application/{restApplicationId}/resource/{restResourceId}/method/{restMethodId}/create/response", method = RequestMethod.GET) public ModelAndView displayCreatePage(@PathVariable final String restProjectId, @PathVariable final String restApplicationId, @PathVariable final String restResourceId, @PathVariable final String restMethodId) { final ReadRestMethodOutput output = serviceProcessor.process(ReadRestMethodInput.builder() .restProjectId(restProjectId) .restApplicationId(restApplicationId) .restResourceId(restResourceId) .restMethodId(restMethodId).build()); final ReadRestResourceQueryParametersOutput resourceQueryParameters = serviceProcessor.process(ReadRestResourceQueryParametersInput.builder() .projectId(restProjectId) .applicationId(restApplicationId) .resourceId(restResourceId) .build()); final RestMockResponse mockResponse = new RestMockResponse(); mockResponse.setBody(output.getRestMethod().getDefaultBody()); mockResponse.setHttpStatusCode(DEFAULT_HTTP_STATUS_CODE); final ModelAndView model = createPartialModelAndView(PAGE); model.addObject(REST_PROJECT_ID, restProjectId); model.addObject(REST_APPLICATION_ID, restApplicationId); model.addObject(REST_RESOURCE_ID, restResourceId); model.addObject(REST_METHOD_ID, restMethodId); model.addObject(REST_MOCK_RESPONSE, mockResponse); model.addObject(REST_MOCK_RESPONSE_STATUSES, RestMockResponseStatus.values()); model.addObject(REST_QUERY_PARAMETERS, resourceQueryParameters.getQueries()); return model; }
model.addObject(REST_RESOURCE_ID, restResourceId); model.addObject(REST_METHOD, restMethod); model.addObject(REST_MOCK_RESPONSE_STATUSES, RestMockResponseStatus.values()); model.addObject(REST_EVENTS, readRestEventWithMethodIdOutput.getRestEvents()); model.addObject(REST_MOCK_RESPONSE_MODIFIER_COMMAND, new RestMockResponseModifierCommand());