@Test public void testDeleteIndividualProvider() throws Exception { IndividualProviderDto individualProviderDto = mock(IndividualProviderDto.class); when(individualProviderService.findIndividualProviderDto(anyLong())).thenReturn(individualProviderDto); mockMvc.perform(post("/patients/connectionMain/deleteOrganizationalProvider").param("organizationalProviderid", "ScrambledText")) .andExpect(redirectedUrl("/patients/connectionMain.html")); }
@RequestMapping(value = "connectionMain/deleteIndividualProvider", method = RequestMethod.POST) public String deleteIndividualProvider( @RequestParam("individualProviderid") String individualProviderid, Model model) { AuthenticatedUser currentUser = userContext.getCurrentUser(); Long directIndividualProviderId = accessReferenceMapper .getDirectReference(individualProviderid); PatientConnectionDto patientConnectionDto = patientService .findPatientConnectionByUsername(currentUser.getUsername()); for (IndividualProviderDto individualProviderDto : patientConnectionDto .getIndividualProviders()) { if (individualProviderDto.getId() == individualProviderid) { if (individualProviderDto.isDeletable() == false) return "redirect:/patients/connectionMain.html"; } } if (individualProviderService .findIndividualProvider(directIndividualProviderId) != null) { IndividualProviderDto individualProviderDto = individualProviderService .findIndividualProviderDto(directIndividualProviderId); individualProviderDto.setUsername(currentUser.getUsername()); individualProviderService .deleteIndividualProviderDto(individualProviderDto); } return "redirect:/patients/connectionMain.html"; }
ProviderController extends AbstractController { @RequestMapping(value = "connectionMain/deleteIndividualProvider", method = RequestMethod.POST) public String deleteIndividualProvider( @RequestParam("individualProviderid") String individualProviderid, Model model) { AuthenticatedUser currentUser = userContext.getCurrentUser(); Long directIndividualProviderId = accessReferenceMapper .getDirectReference(individualProviderid); PatientConnectionDto patientConnectionDto = patientService .findPatientConnectionByUsername(currentUser.getUsername()); for (IndividualProviderDto individualProviderDto : patientConnectionDto .getIndividualProviders()) { if (individualProviderDto.getId() == individualProviderid) { if (individualProviderDto.isDeletable() == false) return "redirect:/patients/connectionMain.html"; } } if (individualProviderService .findIndividualProvider(directIndividualProviderId) != null) { IndividualProviderDto individualProviderDto = individualProviderService .findIndividualProviderDto(directIndividualProviderId); individualProviderDto.setUsername(currentUser.getUsername()); individualProviderService .deleteIndividualProviderDto(individualProviderDto); } return "redirect:/patients/connectionMain.html"; } }
ProviderController extends AbstractController { @RequestMapping(value = "connectionMain/deleteIndividualProvider", method = RequestMethod.POST) public String deleteIndividualProvider( @RequestParam("individualProviderid") String individualProviderid, Model model) { AuthenticatedUser currentUser = userContext.getCurrentUser(); Long directIndividualProviderId = accessReferenceMapper .getDirectReference(individualProviderid); PatientConnectionDto patientConnectionDto = patientService .findPatientConnectionByUsername(currentUser.getUsername()); for (IndividualProviderDto individualProviderDto : patientConnectionDto .getIndividualProviders()) { if (individualProviderDto.getId() == individualProviderid) { if (individualProviderDto.isDeletable() == false) return "redirect:/patients/connectionMain.html"; } } if (individualProviderService .findIndividualProvider(directIndividualProviderId) != null) { IndividualProviderDto individualProviderDto = individualProviderService .findIndividualProviderDto(directIndividualProviderId); individualProviderDto.setUsername(currentUser.getUsername()); individualProviderService .deleteIndividualProviderDto(individualProviderDto); } return "redirect:/patients/connectionMain.html"; }  }
ProviderController extends AbstractController { @RequestMapping(value = "connectionMain/deleteIndividualProvider", method = RequestMethod.POST) public String deleteIndividualProvider( @RequestParam("individualProviderid") String individualProviderid, Model model) { AuthenticatedUser currentUser = userContext.getCurrentUser(); Long directIndividualProviderId = accessReferenceMapper .getDirectReference(individualProviderid); PatientConnectionDto patientConnectionDto = patientService .findPatientConnectionByUsername(currentUser.getUsername()); for (IndividualProviderDto individualProviderDto : patientConnectionDto .getIndividualProviders()) { if (individualProviderDto.getId() == individualProviderid) { if (individualProviderDto.isDeletable() == false) return "redirect:/patients/connectionMain.html"; } } if (individualProviderService .findIndividualProvider(directIndividualProviderId) != null) { IndividualProviderDto individualProviderDto = individualProviderService .findIndividualProviderDto(directIndividualProviderId); individualProviderDto.setUsername(currentUser.getUsername()); individualProviderService .deleteIndividualProviderDto(individualProviderDto); } return "redirect:/patients/connectionMain.html"; }  @RequestMapping(value = "connectionMain.html") String connectionMain(Model model, HttpServletRequest request); @RequestMapping(value = "connectionMain/deleteIndividualProvider", method = RequestMethod.POST) String deleteIndividualProvider(
			@RequestParam("individualProviderid") String individualProviderid,
			Model model); @RequestMapping(value = "connectionMain/deleteOrganizationalProvider", method = RequestMethod.POST) String deleteOrganizationalProvider(
			@RequestParam("organizationalProviderid") String organizationalProviderid,
			Model model); @RequestMapping(value = "connectionProviderAdd.html") String providerSearch(Model model); @RequestMapping(value = "providerSearch.html", method = RequestMethod.GET) String ajaxProviderSearch(HttpServletRequest request,
			HttpServletResponse response); @RequestMapping(value = "connectionProviderAdd.html", method = RequestMethod.POST) String providerSearch(@RequestParam("npi") String npi); @RequestMapping(value = "connectionProviderAdd_AJAX.html", method = RequestMethod.POST) @ResponseBody String providerSearch_AJAX(
			@RequestParam("npi") String npi); HashMap<String, String> deserializeResult(String providerDtoJSON); }
ProviderController extends AbstractController { @RequestMapping(value = "connectionMain/deleteIndividualProvider", method = RequestMethod.POST) public String deleteIndividualProvider( @RequestParam("individualProviderid") String individualProviderid, Model model) { AuthenticatedUser currentUser = userContext.getCurrentUser(); Long directIndividualProviderId = accessReferenceMapper .getDirectReference(individualProviderid); PatientConnectionDto patientConnectionDto = patientService .findPatientConnectionByUsername(currentUser.getUsername()); for (IndividualProviderDto individualProviderDto : patientConnectionDto .getIndividualProviders()) { if (individualProviderDto.getId() == individualProviderid) { if (individualProviderDto.isDeletable() == false) return "redirect:/patients/connectionMain.html"; } } if (individualProviderService .findIndividualProvider(directIndividualProviderId) != null) { IndividualProviderDto individualProviderDto = individualProviderService .findIndividualProviderDto(directIndividualProviderId); individualProviderDto.setUsername(currentUser.getUsername()); individualProviderService .deleteIndividualProviderDto(individualProviderDto); } return "redirect:/patients/connectionMain.html"; }  @RequestMapping(value = "connectionMain.html") String connectionMain(Model model, HttpServletRequest request); @RequestMapping(value = "connectionMain/deleteIndividualProvider", method = RequestMethod.POST) String deleteIndividualProvider(
			@RequestParam("individualProviderid") String individualProviderid,
			Model model); @RequestMapping(value = "connectionMain/deleteOrganizationalProvider", method = RequestMethod.POST) String deleteOrganizationalProvider(
			@RequestParam("organizationalProviderid") String organizationalProviderid,
			Model model); @RequestMapping(value = "connectionProviderAdd.html") String providerSearch(Model model); @RequestMapping(value = "providerSearch.html", method = RequestMethod.GET) String ajaxProviderSearch(HttpServletRequest request,
			HttpServletResponse response); @RequestMapping(value = "connectionProviderAdd.html", method = RequestMethod.POST) String providerSearch(@RequestParam("npi") String npi); @RequestMapping(value = "connectionProviderAdd_AJAX.html", method = RequestMethod.POST) @ResponseBody String providerSearch_AJAX(
			@RequestParam("npi") String npi); HashMap<String, String> deserializeResult(String providerDtoJSON); static final int NPI_LENGTH; }