@Test public void testDeleteOrganizationalProvider() throws Exception { OrganizationalProviderDto organizationalProviderDto = mock(OrganizationalProviderDto.class); when(organizationalProviderService.findOrganizationalProviderDto(anyLong())).thenReturn(organizationalProviderDto); mockMvc.perform(post("/patients/connectionMain/deleteOrganizationalProvider").param("organizationalProviderid", "ScrambledText")) .andExpect(redirectedUrl("/patients/connectionMain.html")); }
@RequestMapping(value = "connectionMain/deleteOrganizationalProvider", method = RequestMethod.POST) public String deleteOrganizationalProvider( @RequestParam("organizationalProviderid") String organizationalProviderid, Model model) { AuthenticatedUser currentUser = userContext.getCurrentUser(); PatientConnectionDto patientConnectionDto = patientService .findPatientConnectionByUsername(currentUser.getUsername()); Long directOrganizationalProviderId = accessReferenceMapper .getDirectReference(organizationalProviderid); for (OrganizationalProviderDto organizationalProviderDto : patientConnectionDto .getOrganizationalProviders()) { if (organizationalProviderDto.getId() == organizationalProviderid) { if (organizationalProviderDto.isDeletable() == false) return "redirect:/patients/connectionMain.html"; } } if (organizationalProviderService .findOrganizationalProvider(directOrganizationalProviderId) != null) { OrganizationalProviderDto organizationalProviderDto = organizationalProviderService .findOrganizationalProviderDto(directOrganizationalProviderId); organizationalProviderDto.setUsername(currentUser.getUsername()); organizationalProviderService .deleteOrganizationalProviderDto(organizationalProviderDto); } return "redirect:/patients/connectionMain.html"; }
ProviderController extends AbstractController { @RequestMapping(value = "connectionMain/deleteOrganizationalProvider", method = RequestMethod.POST) public String deleteOrganizationalProvider( @RequestParam("organizationalProviderid") String organizationalProviderid, Model model) { AuthenticatedUser currentUser = userContext.getCurrentUser(); PatientConnectionDto patientConnectionDto = patientService .findPatientConnectionByUsername(currentUser.getUsername()); Long directOrganizationalProviderId = accessReferenceMapper .getDirectReference(organizationalProviderid); for (OrganizationalProviderDto organizationalProviderDto : patientConnectionDto .getOrganizationalProviders()) { if (organizationalProviderDto.getId() == organizationalProviderid) { if (organizationalProviderDto.isDeletable() == false) return "redirect:/patients/connectionMain.html"; } } if (organizationalProviderService .findOrganizationalProvider(directOrganizationalProviderId) != null) { OrganizationalProviderDto organizationalProviderDto = organizationalProviderService .findOrganizationalProviderDto(directOrganizationalProviderId); organizationalProviderDto.setUsername(currentUser.getUsername()); organizationalProviderService .deleteOrganizationalProviderDto(organizationalProviderDto); } return "redirect:/patients/connectionMain.html"; } }
ProviderController extends AbstractController { @RequestMapping(value = "connectionMain/deleteOrganizationalProvider", method = RequestMethod.POST) public String deleteOrganizationalProvider( @RequestParam("organizationalProviderid") String organizationalProviderid, Model model) { AuthenticatedUser currentUser = userContext.getCurrentUser(); PatientConnectionDto patientConnectionDto = patientService .findPatientConnectionByUsername(currentUser.getUsername()); Long directOrganizationalProviderId = accessReferenceMapper .getDirectReference(organizationalProviderid); for (OrganizationalProviderDto organizationalProviderDto : patientConnectionDto .getOrganizationalProviders()) { if (organizationalProviderDto.getId() == organizationalProviderid) { if (organizationalProviderDto.isDeletable() == false) return "redirect:/patients/connectionMain.html"; } } if (organizationalProviderService .findOrganizationalProvider(directOrganizationalProviderId) != null) { OrganizationalProviderDto organizationalProviderDto = organizationalProviderService .findOrganizationalProviderDto(directOrganizationalProviderId); organizationalProviderDto.setUsername(currentUser.getUsername()); organizationalProviderService .deleteOrganizationalProviderDto(organizationalProviderDto); } return "redirect:/patients/connectionMain.html"; }  }
ProviderController extends AbstractController { @RequestMapping(value = "connectionMain/deleteOrganizationalProvider", method = RequestMethod.POST) public String deleteOrganizationalProvider( @RequestParam("organizationalProviderid") String organizationalProviderid, Model model) { AuthenticatedUser currentUser = userContext.getCurrentUser(); PatientConnectionDto patientConnectionDto = patientService .findPatientConnectionByUsername(currentUser.getUsername()); Long directOrganizationalProviderId = accessReferenceMapper .getDirectReference(organizationalProviderid); for (OrganizationalProviderDto organizationalProviderDto : patientConnectionDto .getOrganizationalProviders()) { if (organizationalProviderDto.getId() == organizationalProviderid) { if (organizationalProviderDto.isDeletable() == false) return "redirect:/patients/connectionMain.html"; } } if (organizationalProviderService .findOrganizationalProvider(directOrganizationalProviderId) != null) { OrganizationalProviderDto organizationalProviderDto = organizationalProviderService .findOrganizationalProviderDto(directOrganizationalProviderId); organizationalProviderDto.setUsername(currentUser.getUsername()); organizationalProviderService .deleteOrganizationalProviderDto(organizationalProviderDto); } 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/deleteOrganizationalProvider", method = RequestMethod.POST) public String deleteOrganizationalProvider( @RequestParam("organizationalProviderid") String organizationalProviderid, Model model) { AuthenticatedUser currentUser = userContext.getCurrentUser(); PatientConnectionDto patientConnectionDto = patientService .findPatientConnectionByUsername(currentUser.getUsername()); Long directOrganizationalProviderId = accessReferenceMapper .getDirectReference(organizationalProviderid); for (OrganizationalProviderDto organizationalProviderDto : patientConnectionDto .getOrganizationalProviders()) { if (organizationalProviderDto.getId() == organizationalProviderid) { if (organizationalProviderDto.isDeletable() == false) return "redirect:/patients/connectionMain.html"; } } if (organizationalProviderService .findOrganizationalProvider(directOrganizationalProviderId) != null) { OrganizationalProviderDto organizationalProviderDto = organizationalProviderService .findOrganizationalProviderDto(directOrganizationalProviderId); organizationalProviderDto.setUsername(currentUser.getUsername()); organizationalProviderService .deleteOrganizationalProviderDto(organizationalProviderDto); } 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; }