@Test public void shouldReturnMessageIfSupervisingNodeNotPresent() throws Exception { when(supervisoryNodeService.getFor(FACILITY, PROGRAM)).thenReturn(null); OpenLmisMessage message = requisitionService.getSubmitMessageBasedOnSupervisoryNode(FACILITY, PROGRAM); assertThat(message.getCode(), is("msg.rnr.submitted.without.supervisor")); }
public OpenLmisMessage getSubmitMessageBasedOnSupervisoryNode(Facility facility, Program program) { SupervisoryNode supervisoryNode = supervisoryNodeService.getFor(facility, program); String msg = (supervisoryNode == null) ? NO_SUPERVISORY_NODE_CONTACT_ADMIN : RNR_SUBMITTED_SUCCESSFULLY; return new OpenLmisMessage(msg); }
RequisitionService { public OpenLmisMessage getSubmitMessageBasedOnSupervisoryNode(Facility facility, Program program) { SupervisoryNode supervisoryNode = supervisoryNodeService.getFor(facility, program); String msg = (supervisoryNode == null) ? NO_SUPERVISORY_NODE_CONTACT_ADMIN : RNR_SUBMITTED_SUCCESSFULLY; return new OpenLmisMessage(msg); } }
RequisitionService { public OpenLmisMessage getSubmitMessageBasedOnSupervisoryNode(Facility facility, Program program) { SupervisoryNode supervisoryNode = supervisoryNodeService.getFor(facility, program); String msg = (supervisoryNode == null) ? NO_SUPERVISORY_NODE_CONTACT_ADMIN : RNR_SUBMITTED_SUCCESSFULLY; return new OpenLmisMessage(msg); }  }
RequisitionService { public OpenLmisMessage getSubmitMessageBasedOnSupervisoryNode(Facility facility, Program program) { SupervisoryNode supervisoryNode = supervisoryNodeService.getFor(facility, program); String msg = (supervisoryNode == null) ? NO_SUPERVISORY_NODE_CONTACT_ADMIN : RNR_SUBMITTED_SUCCESSFULLY; return new OpenLmisMessage(msg); }  @Autowired void setRequisitionSearchStrategyFactory(RequisitionSearchStrategyFactory requisitionSearchStrategyFactory); @Transactional Rnr initiate(Facility facility, Program program, Long modifiedBy, Boolean emergency, ProcessingPeriod proposedPeriod); void populateProductsPriceBasedOnPriceSchedule(Long facilityId, Long programId, List<FacilityTypeApprovedProduct> facilityTypeApprovedProducts); @Transactional Rnr save(Rnr rnr); @Transactional Rnr submit(Rnr rnr); @Transactional Rnr authorize(Rnr rnr); @Transactional Rnr approve(Rnr requisition, String name); void releaseRequisitionsAsOrder(List<Rnr> requisitions, Long userId); List<Rnr> get(RequisitionSearchCriteria criteria); List<LossesAndAdjustmentsType> getLossesAndAdjustmentsTypes(); OpenLmisMessage getSubmitMessageBasedOnSupervisoryNode(Facility facility, Program program); OpenLmisMessage getAuthorizeMessageBasedOnSupervisoryNode(Facility facility, Program program); OpenLmisMessage getApproveMessageBasedOnParentNode(Rnr rnr); Rnr getFullRequisitionById(Long id); ProcessingPeriod getPeriodForInitiating(Facility facility, Program program); List<ProcessingPeriod> getAllPeriodsForInitiatingRequisition(Long facilityId, Long programId); @Deprecated List<Rnr> listForApproval(Long userId); List<RnrDTO> listForApprovalDto(Long userId); List<RnrLineItem> getNRnrLineItems(String productCode, Rnr rnr, Integer n, Date startDate); Integer getCategoryCount(Rnr requisition, boolean fullSupply); void insertComment(Comment comment); List getCommentsByRnrId(Long rnrId); Rnr getLWById(Long rnrId); Date getOperationDateFor(Long rnrId, String status); ProcessingPeriod getCurrentPeriod(RequisitionSearchCriteria criteria); List<Rnr> getApprovedRequisitionsForCriteriaAndPageNumber(String searchType, String searchVal, Integer pageNumber,
                                                                   Integer totalNumberOfPages, Long userId, String rightName,
                                                                   String sortBy, String sortDirection); Integer getNumberOfPagesOfApprovedRequisitionsForCriteria(String searchType, String searchVal, Long userId, String rightName); List<ProcessingPeriod> getProcessingPeriods(RequisitionSearchCriteria criteria); List<Rnr> getRequisitionsFor(RequisitionSearchCriteria criteria, List<ProcessingPeriod> periodList); Long getFacilityId(Long id); RnrLineItem getNonSkippedLineItem(Long rnrId, String productCode); String deleteRnR(Long rnrId); void skipRnR(Long rnrId, Long userId); void reOpenRnR(Long rnrId, Long userId); void rejectRnR(Long rnrId, Long userId); Integer findM(ProcessingPeriod period); Long getProgramId(Long rnrId); @Transactional void updateClientFields(Rnr rnr); @Transactional void insertPatientQuantificationLineItems(Rnr rnr); List<Rnr> getRequisitionsByFacility(Facility facility); @Transactional void insertRnrSignatures(Rnr rnr); }
RequisitionService { public OpenLmisMessage getSubmitMessageBasedOnSupervisoryNode(Facility facility, Program program) { SupervisoryNode supervisoryNode = supervisoryNodeService.getFor(facility, program); String msg = (supervisoryNode == null) ? NO_SUPERVISORY_NODE_CONTACT_ADMIN : RNR_SUBMITTED_SUCCESSFULLY; return new OpenLmisMessage(msg); }  @Autowired void setRequisitionSearchStrategyFactory(RequisitionSearchStrategyFactory requisitionSearchStrategyFactory); @Transactional Rnr initiate(Facility facility, Program program, Long modifiedBy, Boolean emergency, ProcessingPeriod proposedPeriod); void populateProductsPriceBasedOnPriceSchedule(Long facilityId, Long programId, List<FacilityTypeApprovedProduct> facilityTypeApprovedProducts); @Transactional Rnr save(Rnr rnr); @Transactional Rnr submit(Rnr rnr); @Transactional Rnr authorize(Rnr rnr); @Transactional Rnr approve(Rnr requisition, String name); void releaseRequisitionsAsOrder(List<Rnr> requisitions, Long userId); List<Rnr> get(RequisitionSearchCriteria criteria); List<LossesAndAdjustmentsType> getLossesAndAdjustmentsTypes(); OpenLmisMessage getSubmitMessageBasedOnSupervisoryNode(Facility facility, Program program); OpenLmisMessage getAuthorizeMessageBasedOnSupervisoryNode(Facility facility, Program program); OpenLmisMessage getApproveMessageBasedOnParentNode(Rnr rnr); Rnr getFullRequisitionById(Long id); ProcessingPeriod getPeriodForInitiating(Facility facility, Program program); List<ProcessingPeriod> getAllPeriodsForInitiatingRequisition(Long facilityId, Long programId); @Deprecated List<Rnr> listForApproval(Long userId); List<RnrDTO> listForApprovalDto(Long userId); List<RnrLineItem> getNRnrLineItems(String productCode, Rnr rnr, Integer n, Date startDate); Integer getCategoryCount(Rnr requisition, boolean fullSupply); void insertComment(Comment comment); List getCommentsByRnrId(Long rnrId); Rnr getLWById(Long rnrId); Date getOperationDateFor(Long rnrId, String status); ProcessingPeriod getCurrentPeriod(RequisitionSearchCriteria criteria); List<Rnr> getApprovedRequisitionsForCriteriaAndPageNumber(String searchType, String searchVal, Integer pageNumber,
                                                                   Integer totalNumberOfPages, Long userId, String rightName,
                                                                   String sortBy, String sortDirection); Integer getNumberOfPagesOfApprovedRequisitionsForCriteria(String searchType, String searchVal, Long userId, String rightName); List<ProcessingPeriod> getProcessingPeriods(RequisitionSearchCriteria criteria); List<Rnr> getRequisitionsFor(RequisitionSearchCriteria criteria, List<ProcessingPeriod> periodList); Long getFacilityId(Long id); RnrLineItem getNonSkippedLineItem(Long rnrId, String productCode); String deleteRnR(Long rnrId); void skipRnR(Long rnrId, Long userId); void reOpenRnR(Long rnrId, Long userId); void rejectRnR(Long rnrId, Long userId); Integer findM(ProcessingPeriod period); Long getProgramId(Long rnrId); @Transactional void updateClientFields(Rnr rnr); @Transactional void insertPatientQuantificationLineItems(Rnr rnr); List<Rnr> getRequisitionsByFacility(Facility facility); @Transactional void insertRnrSignatures(Rnr rnr); static final String RNR_AUTHORIZATION_ERROR; static final String RNR_SUBMISSION_ERROR; static final String RNR_OPERATION_UNAUTHORIZED; static final String RNR_AUTHORIZED_SUCCESSFULLY; static final String RNR_SUBMITTED_SUCCESSFULLY; static final String RNR_AUTHORIZED_SUCCESSFULLY_WITHOUT_SUPERVISOR; static final String RNR_APPROVED_SUCCESSFULLY_WITHOUT_SUPERVISOR; static final String NO_SUPERVISORY_NODE_CONTACT_ADMIN; static final String RNR_APPROVED_SUCCESSFULLY; static final String APPROVAL_NOT_ALLOWED; static final String SEARCH_ALL; static final String SEARCH_PROGRAM_NAME; static final String SEARCH_FACILITY_CODE; static final String SEARCH_FACILITY_NAME; static final String SEARCH_SUPPLYING_DEPOT_NAME; static final String CONVERT_TO_ORDER_PAGE_SIZE; static final String NUMBER_OF_PAGES; }