@Test public void shouldGetAllOrdersForPOD() { List<Order> ordersForPOD = null; when(orderService.searchByStatusAndRight(USER_ID, MANAGE_POD, asList(RELEASED, PACKED, TRANSFER_FAILED, READY_TO_PACK),1L,0L)).thenReturn(ordersForPOD); mockStatic(OrderDTO.class); List<OrderDTO> orderDTOs = new ArrayList<>(); when(OrderDTO.getOrdersForView(ordersForPOD)).thenReturn(orderDTOs); ResponseEntity<OpenLmisResponse> response = orderController.getOrdersForPOD(1L,0L,request); assertThat((List<OrderDTO>) response.getBody().getData().get(ORDERS_FOR_POD), is(orderDTOs)); verify(orderService).searchByStatusAndRight(USER_ID, MANAGE_POD, asList(RELEASED, PACKED, TRANSFER_FAILED, READY_TO_PACK),1L,0L); }
@RequestMapping(value = "/manage-pod-orders", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") public ResponseEntity<OpenLmisResponse> getOrdersForPOD(@RequestParam("program") Long program, @RequestParam(value = "facility", defaultValue = "0") Long facility, HttpServletRequest request) { List<Order> ordersForPOD = orderService.searchByStatusAndRight(loggedInUserId(request), MANAGE_POD, asList(RELEASED, PACKED, TRANSFER_FAILED, READY_TO_PACK),program, facility); return response(ORDERS_FOR_POD, getOrdersForView(ordersForPOD)); }
OrderController extends BaseController { @RequestMapping(value = "/manage-pod-orders", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") public ResponseEntity<OpenLmisResponse> getOrdersForPOD(@RequestParam("program") Long program, @RequestParam(value = "facility", defaultValue = "0") Long facility, HttpServletRequest request) { List<Order> ordersForPOD = orderService.searchByStatusAndRight(loggedInUserId(request), MANAGE_POD, asList(RELEASED, PACKED, TRANSFER_FAILED, READY_TO_PACK),program, facility); return response(ORDERS_FOR_POD, getOrdersForView(ordersForPOD)); } }
OrderController extends BaseController { @RequestMapping(value = "/manage-pod-orders", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") public ResponseEntity<OpenLmisResponse> getOrdersForPOD(@RequestParam("program") Long program, @RequestParam(value = "facility", defaultValue = "0") Long facility, HttpServletRequest request) { List<Order> ordersForPOD = orderService.searchByStatusAndRight(loggedInUserId(request), MANAGE_POD, asList(RELEASED, PACKED, TRANSFER_FAILED, READY_TO_PACK),program, facility); return response(ORDERS_FOR_POD, getOrdersForView(ordersForPOD)); }  }
OrderController extends BaseController { @RequestMapping(value = "/manage-pod-orders", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") public ResponseEntity<OpenLmisResponse> getOrdersForPOD(@RequestParam("program") Long program, @RequestParam(value = "facility", defaultValue = "0") Long facility, HttpServletRequest request) { List<Order> ordersForPOD = orderService.searchByStatusAndRight(loggedInUserId(request), MANAGE_POD, asList(RELEASED, PACKED, TRANSFER_FAILED, READY_TO_PACK),program, facility); return response(ORDERS_FOR_POD, getOrdersForView(ordersForPOD)); }  @RequestMapping(value = "/orders", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'CONVERT_TO_ORDER')") ResponseEntity<OpenLmisResponse> convertToOrder(@RequestBody RequisitionList rnrList,
                                                         HttpServletRequest request); @RequestMapping(value = "/orders", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'VIEW_ORDER')") ResponseEntity<OpenLmisResponse> getOrdersForPage(@RequestParam(value = "page",
    required = true,
    defaultValue = "1") Integer page,
     @RequestParam(value="supplyDepot", defaultValue = "0") Long supplyDepot,
     @RequestParam(value="period", defaultValue = "0") Long period,
     @RequestParam(value="program", defaultValue = "0") Long program,
     HttpServletRequest request); @RequestMapping(value = "/orders/{id}/download.csv", method = GET, headers = ACCEPT_CSV) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'VIEW_ORDER')") ModelAndView downloadOrderCsv(@PathVariable Long id); @RequestMapping(value = "/order-file-template", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> getOrderFileTemplateDTO(); @RequestMapping(value = "/order-file-template", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> saveOrderFileTemplateDTO(@RequestBody OrderFileTemplateDTO orderFileTemplateDTO,
                                                                   HttpServletRequest request); @RequestMapping(value = "/order-number-configuration", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> getOrderNumberConfiguration(); @RequestMapping(value = "/order-number-configuration", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> updateOrderNumberConfiguration(@RequestBody OrderNumberConfiguration orderNumberConfiguration); @RequestMapping(value = "/date-formats", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> getAllDateFormats(); @RequestMapping(value = "/manage-pod-orders", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") ResponseEntity<OpenLmisResponse> getOrdersForPOD(@RequestParam("program") Long program, @RequestParam(value = "facility", defaultValue = "0") Long facility, HttpServletRequest request); }
OrderController extends BaseController { @RequestMapping(value = "/manage-pod-orders", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") public ResponseEntity<OpenLmisResponse> getOrdersForPOD(@RequestParam("program") Long program, @RequestParam(value = "facility", defaultValue = "0") Long facility, HttpServletRequest request) { List<Order> ordersForPOD = orderService.searchByStatusAndRight(loggedInUserId(request), MANAGE_POD, asList(RELEASED, PACKED, TRANSFER_FAILED, READY_TO_PACK),program, facility); return response(ORDERS_FOR_POD, getOrdersForView(ordersForPOD)); }  @RequestMapping(value = "/orders", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'CONVERT_TO_ORDER')") ResponseEntity<OpenLmisResponse> convertToOrder(@RequestBody RequisitionList rnrList,
                                                         HttpServletRequest request); @RequestMapping(value = "/orders", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'VIEW_ORDER')") ResponseEntity<OpenLmisResponse> getOrdersForPage(@RequestParam(value = "page",
    required = true,
    defaultValue = "1") Integer page,
     @RequestParam(value="supplyDepot", defaultValue = "0") Long supplyDepot,
     @RequestParam(value="period", defaultValue = "0") Long period,
     @RequestParam(value="program", defaultValue = "0") Long program,
     HttpServletRequest request); @RequestMapping(value = "/orders/{id}/download.csv", method = GET, headers = ACCEPT_CSV) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'VIEW_ORDER')") ModelAndView downloadOrderCsv(@PathVariable Long id); @RequestMapping(value = "/order-file-template", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> getOrderFileTemplateDTO(); @RequestMapping(value = "/order-file-template", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> saveOrderFileTemplateDTO(@RequestBody OrderFileTemplateDTO orderFileTemplateDTO,
                                                                   HttpServletRequest request); @RequestMapping(value = "/order-number-configuration", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> getOrderNumberConfiguration(); @RequestMapping(value = "/order-number-configuration", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> updateOrderNumberConfiguration(@RequestBody OrderNumberConfiguration orderNumberConfiguration); @RequestMapping(value = "/date-formats", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> getAllDateFormats(); @RequestMapping(value = "/manage-pod-orders", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal, 'MANAGE_POD')") ResponseEntity<OpenLmisResponse> getOrdersForPOD(@RequestParam("program") Long program, @RequestParam(value = "facility", defaultValue = "0") Long facility, HttpServletRequest request); static final String ORDERS; static final String ORDER; static final String ORDER_FILE_TEMPLATE; static final String ORDER_NUMBER_CONFIGURATION; static final String DATE_FORMATS; static final String PAGE_SIZE; static final String NUMBER_OF_PAGES; static final String ORDERS_FOR_POD; }