@Test public void searchByStockLocation_shouldGetPurchaseOrdersByStockLocation() throws Exception { String results = controller.searchByStockLocation("9356400c-a5a2-4532-8f2b-2361b3446eb8", request); LinkedHashMap di = (LinkedHashMap) ((ArrayList) SimpleObject.parseJson(results).get("results")).get(0); Assert.assertEquals("Test drug PO", di.get("name")); }
@RequestMapping(method = RequestMethod.GET, params = "stockLocation") @WSDoc("Fetch all non-retired drug purchase orders according to stockLocation") @ResponseBody() public String searchByStockLocation(@RequestParam("stockLocation") String stockLocation, HttpServletRequest request) throws ResponseException { initDrugPurchaseOrderController(); List<DrugPurchaseOrder> dPOs = service.getDrugPurchaseOrderByStockLocation(Context.getLocationService() .getLocationByUuid(stockLocation).getId()); return purchaseOrderListToJson(dPOs); }
DrugPurchaseOrderController extends BaseRestController { @RequestMapping(method = RequestMethod.GET, params = "stockLocation") @WSDoc("Fetch all non-retired drug purchase orders according to stockLocation") @ResponseBody() public String searchByStockLocation(@RequestParam("stockLocation") String stockLocation, HttpServletRequest request) throws ResponseException { initDrugPurchaseOrderController(); List<DrugPurchaseOrder> dPOs = service.getDrugPurchaseOrderByStockLocation(Context.getLocationService() .getLocationByUuid(stockLocation).getId()); return purchaseOrderListToJson(dPOs); } }
DrugPurchaseOrderController extends BaseRestController { @RequestMapping(method = RequestMethod.GET, params = "stockLocation") @WSDoc("Fetch all non-retired drug purchase orders according to stockLocation") @ResponseBody() public String searchByStockLocation(@RequestParam("stockLocation") String stockLocation, HttpServletRequest request) throws ResponseException { initDrugPurchaseOrderController(); List<DrugPurchaseOrder> dPOs = service.getDrugPurchaseOrderByStockLocation(Context.getLocationService() .getLocationByUuid(stockLocation).getId()); return purchaseOrderListToJson(dPOs); }  }
DrugPurchaseOrderController extends BaseRestController { @RequestMapping(method = RequestMethod.GET, params = "stockLocation") @WSDoc("Fetch all non-retired drug purchase orders according to stockLocation") @ResponseBody() public String searchByStockLocation(@RequestParam("stockLocation") String stockLocation, HttpServletRequest request) throws ResponseException { initDrugPurchaseOrderController(); List<DrugPurchaseOrder> dPOs = service.getDrugPurchaseOrderByStockLocation(Context.getLocationService() .getLocationByUuid(stockLocation).getId()); return purchaseOrderListToJson(dPOs); }  void initDrugPurchaseOrderController(); @RequestMapping(method = RequestMethod.POST) @WSDoc("Save New DrugPurchaseOrder") @ResponseBody Object createNewDrugPurchaseOrder(@RequestBody SimpleObject post, HttpServletRequest request,
	        HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.POST) @WSDoc("Updates an existing purchase order") @ResponseBody Object updateDrugPurchaseOrder(@PathVariable("uuid") String uuid, @RequestBody SimpleObject post,
	        HttpServletRequest request, HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET) @WSDoc("Gets DrugPurchaseOrder for the uuid path") @ResponseBody() String getDrugPuchaseOrderByUuid(@PathVariable("uuid") String uuid, HttpServletRequest request); DrugPurchaseOrder setPostFields(SimpleObject post, DrugPurchaseOrder purchaseOrder); @RequestMapping(method = RequestMethod.GET) @WSDoc("Get All Unretired Drug Purchase Orders in the system") @ResponseBody() String getAllDrugPurchaseOrders(HttpServletRequest request, HttpServletResponse response); @RequestMapping(method = RequestMethod.GET, params = "stockLocation") @WSDoc("Fetch all non-retired drug purchase orders according to stockLocation") @ResponseBody() String searchByStockLocation(@RequestParam("stockLocation") String stockLocation, HttpServletRequest request); }
DrugPurchaseOrderController extends BaseRestController { @RequestMapping(method = RequestMethod.GET, params = "stockLocation") @WSDoc("Fetch all non-retired drug purchase orders according to stockLocation") @ResponseBody() public String searchByStockLocation(@RequestParam("stockLocation") String stockLocation, HttpServletRequest request) throws ResponseException { initDrugPurchaseOrderController(); List<DrugPurchaseOrder> dPOs = service.getDrugPurchaseOrderByStockLocation(Context.getLocationService() .getLocationByUuid(stockLocation).getId()); return purchaseOrderListToJson(dPOs); }  void initDrugPurchaseOrderController(); @RequestMapping(method = RequestMethod.POST) @WSDoc("Save New DrugPurchaseOrder") @ResponseBody Object createNewDrugPurchaseOrder(@RequestBody SimpleObject post, HttpServletRequest request,
	        HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.POST) @WSDoc("Updates an existing purchase order") @ResponseBody Object updateDrugPurchaseOrder(@PathVariable("uuid") String uuid, @RequestBody SimpleObject post,
	        HttpServletRequest request, HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET) @WSDoc("Gets DrugPurchaseOrder for the uuid path") @ResponseBody() String getDrugPuchaseOrderByUuid(@PathVariable("uuid") String uuid, HttpServletRequest request); DrugPurchaseOrder setPostFields(SimpleObject post, DrugPurchaseOrder purchaseOrder); @RequestMapping(method = RequestMethod.GET) @WSDoc("Get All Unretired Drug Purchase Orders in the system") @ResponseBody() String getAllDrugPurchaseOrders(HttpServletRequest request, HttpServletResponse response); @RequestMapping(method = RequestMethod.GET, params = "stockLocation") @WSDoc("Fetch all non-retired drug purchase orders according to stockLocation") @ResponseBody() String searchByStockLocation(@RequestParam("stockLocation") String stockLocation, HttpServletRequest request);  }