@Test public void testFindAllByCode() { Page<ConceptCode> conceptCodes = mock(Page.class); List<ConceptCodeDto> conceptCodeDtos = mock(List.class); when( conceptCodeRepository.findAllByCodeLike(anyString(), anyString(), anyString(), anyString(), any(Pageable.class))).thenReturn(conceptCodes); when( valueSetMgmtHelper .convertConceptCodeEntitiesToDtos(conceptCodes .getContent())).thenReturn(conceptCodeDtos); assertEquals( conceptCodeServiceImpl.findAllByCode("a", null, null, null, 0) .get("conceptCodes"), conceptCodeDtos); }
@Override public Map<String, Object> findAllByCode(String searchTerm, String codeSystem, String codeSystemVersion, String valueSetName, int pageNumber) { Sort sort = new Sort(new Order(Direction.ASC, "code")); PageRequest pageRequest = new PageRequest(pageNumber, CONCEPT_CODE_PAGE_SIZE, sort); Page<ConceptCode> pagedConceptCodes = conceptCodeRepository .findAllByCodeLike("%" + searchTerm + "%", "%" + codeSystem + "%", "%" + codeSystemVersion + "%", "%" + valueSetName + "%", pageRequest); logger.debug("Total Concept Codes: " + pagedConceptCodes.getTotalElements()); logger.debug("Total Pages: " + pagedConceptCodes.getTotalPages()); Map<String, Object> pageResultsMap = new HashMap<String, Object>(); pageResultsMap.put("conceptCodes", valueSetMgmtHelper .convertConceptCodeEntitiesToDtos(pagedConceptCodes .getContent())); pageResultsMap.put("totalNumberOfConceptCodes", pagedConceptCodes.getTotalElements()); pageResultsMap.put("totalPages", pagedConceptCodes.getTotalPages()); pageResultsMap.put("itemsPerPage", pagedConceptCodes.getSize()); pageResultsMap.put("currentPage", pagedConceptCodes.getNumber()); pageResultsMap.put("numberOfElements", pagedConceptCodes.getNumberOfElements()); return pageResultsMap; }
ConceptCodeServiceImpl implements ConceptCodeService { @Override public Map<String, Object> findAllByCode(String searchTerm, String codeSystem, String codeSystemVersion, String valueSetName, int pageNumber) { Sort sort = new Sort(new Order(Direction.ASC, "code")); PageRequest pageRequest = new PageRequest(pageNumber, CONCEPT_CODE_PAGE_SIZE, sort); Page<ConceptCode> pagedConceptCodes = conceptCodeRepository .findAllByCodeLike("%" + searchTerm + "%", "%" + codeSystem + "%", "%" + codeSystemVersion + "%", "%" + valueSetName + "%", pageRequest); logger.debug("Total Concept Codes: " + pagedConceptCodes.getTotalElements()); logger.debug("Total Pages: " + pagedConceptCodes.getTotalPages()); Map<String, Object> pageResultsMap = new HashMap<String, Object>(); pageResultsMap.put("conceptCodes", valueSetMgmtHelper .convertConceptCodeEntitiesToDtos(pagedConceptCodes .getContent())); pageResultsMap.put("totalNumberOfConceptCodes", pagedConceptCodes.getTotalElements()); pageResultsMap.put("totalPages", pagedConceptCodes.getTotalPages()); pageResultsMap.put("itemsPerPage", pagedConceptCodes.getSize()); pageResultsMap.put("currentPage", pagedConceptCodes.getNumber()); pageResultsMap.put("numberOfElements", pagedConceptCodes.getNumberOfElements()); return pageResultsMap; } }
ConceptCodeServiceImpl implements ConceptCodeService { @Override public Map<String, Object> findAllByCode(String searchTerm, String codeSystem, String codeSystemVersion, String valueSetName, int pageNumber) { Sort sort = new Sort(new Order(Direction.ASC, "code")); PageRequest pageRequest = new PageRequest(pageNumber, CONCEPT_CODE_PAGE_SIZE, sort); Page<ConceptCode> pagedConceptCodes = conceptCodeRepository .findAllByCodeLike("%" + searchTerm + "%", "%" + codeSystem + "%", "%" + codeSystemVersion + "%", "%" + valueSetName + "%", pageRequest); logger.debug("Total Concept Codes: " + pagedConceptCodes.getTotalElements()); logger.debug("Total Pages: " + pagedConceptCodes.getTotalPages()); Map<String, Object> pageResultsMap = new HashMap<String, Object>(); pageResultsMap.put("conceptCodes", valueSetMgmtHelper .convertConceptCodeEntitiesToDtos(pagedConceptCodes .getContent())); pageResultsMap.put("totalNumberOfConceptCodes", pagedConceptCodes.getTotalElements()); pageResultsMap.put("totalPages", pagedConceptCodes.getTotalPages()); pageResultsMap.put("itemsPerPage", pagedConceptCodes.getSize()); pageResultsMap.put("currentPage", pagedConceptCodes.getNumber()); pageResultsMap.put("numberOfElements", pagedConceptCodes.getNumberOfElements()); return pageResultsMap; } ConceptCodeServiceImpl(int conceptCodePageSize,
			ConceptCodeRepository conceptCodeRepository,
			ValueSetRepository valueSetRepository,
			CodeSystemRepository codeSystemRepository,
			CodeSystemVersionRepository codeSystemVersionRepository,
			ConceptCodeValueSetRepository conceptCodeValueSetRepository,
			ValueSetMgmtHelper valueSetMgmtHelper); }
ConceptCodeServiceImpl implements ConceptCodeService { @Override public Map<String, Object> findAllByCode(String searchTerm, String codeSystem, String codeSystemVersion, String valueSetName, int pageNumber) { Sort sort = new Sort(new Order(Direction.ASC, "code")); PageRequest pageRequest = new PageRequest(pageNumber, CONCEPT_CODE_PAGE_SIZE, sort); Page<ConceptCode> pagedConceptCodes = conceptCodeRepository .findAllByCodeLike("%" + searchTerm + "%", "%" + codeSystem + "%", "%" + codeSystemVersion + "%", "%" + valueSetName + "%", pageRequest); logger.debug("Total Concept Codes: " + pagedConceptCodes.getTotalElements()); logger.debug("Total Pages: " + pagedConceptCodes.getTotalPages()); Map<String, Object> pageResultsMap = new HashMap<String, Object>(); pageResultsMap.put("conceptCodes", valueSetMgmtHelper .convertConceptCodeEntitiesToDtos(pagedConceptCodes .getContent())); pageResultsMap.put("totalNumberOfConceptCodes", pagedConceptCodes.getTotalElements()); pageResultsMap.put("totalPages", pagedConceptCodes.getTotalPages()); pageResultsMap.put("itemsPerPage", pagedConceptCodes.getSize()); pageResultsMap.put("currentPage", pagedConceptCodes.getNumber()); pageResultsMap.put("numberOfElements", pagedConceptCodes.getNumberOfElements()); return pageResultsMap; } ConceptCodeServiceImpl(int conceptCodePageSize,
			ConceptCodeRepository conceptCodeRepository,
			ValueSetRepository valueSetRepository,
			CodeSystemRepository codeSystemRepository,
			CodeSystemVersionRepository codeSystemVersionRepository,
			ConceptCodeValueSetRepository conceptCodeValueSetRepository,
			ValueSetMgmtHelper valueSetMgmtHelper); @Override @Transactional(rollbackFor = ConceptCodeNotFoundException.class) ConceptCodeDto delete(Long conceptCodeId); @Override ConceptCodeDto findById(Long id); @Override @Transactional(rollbackFor = ConceptCodeNotFoundException.class) ConceptCodeDto update(ConceptCodeDto updated); @Override List<ConceptCodeDto> findAll(); @Override Map<String, Object> findAll(int pageNumber); @Override Map<String, Object> findAllByCode(String searchTerm,
			String codeSystem, String codeSystemVersion, String valueSetName,
			int pageNumber); @Override Map<String, Object> findAllByName(String searchTerm,
			String codeSystem, String codeSystemVersion, String valueSetName,
			int pageNumber); @Override ConceptCodeVSCSDto create(); @Override @Transactional ConceptCodeDto create(ConceptCodeDto created); @Override @Transactional(rollbackFor = DataIntegrityViolationException.class) ConceptCodeDto conceptCodeBatchUpload(ConceptCodeDto conceptCodeDto,
			MultipartFile file, String codeSystemId, Long codeSystemVersionId,
			List<Long> valueSetIds); @Override List<ValueSet> findValueSetsByCodeSystem(String codeSystem,
			String codeSystemVersion); }
ConceptCodeServiceImpl implements ConceptCodeService { @Override public Map<String, Object> findAllByCode(String searchTerm, String codeSystem, String codeSystemVersion, String valueSetName, int pageNumber) { Sort sort = new Sort(new Order(Direction.ASC, "code")); PageRequest pageRequest = new PageRequest(pageNumber, CONCEPT_CODE_PAGE_SIZE, sort); Page<ConceptCode> pagedConceptCodes = conceptCodeRepository .findAllByCodeLike("%" + searchTerm + "%", "%" + codeSystem + "%", "%" + codeSystemVersion + "%", "%" + valueSetName + "%", pageRequest); logger.debug("Total Concept Codes: " + pagedConceptCodes.getTotalElements()); logger.debug("Total Pages: " + pagedConceptCodes.getTotalPages()); Map<String, Object> pageResultsMap = new HashMap<String, Object>(); pageResultsMap.put("conceptCodes", valueSetMgmtHelper .convertConceptCodeEntitiesToDtos(pagedConceptCodes .getContent())); pageResultsMap.put("totalNumberOfConceptCodes", pagedConceptCodes.getTotalElements()); pageResultsMap.put("totalPages", pagedConceptCodes.getTotalPages()); pageResultsMap.put("itemsPerPage", pagedConceptCodes.getSize()); pageResultsMap.put("currentPage", pagedConceptCodes.getNumber()); pageResultsMap.put("numberOfElements", pagedConceptCodes.getNumberOfElements()); return pageResultsMap; } ConceptCodeServiceImpl(int conceptCodePageSize,
			ConceptCodeRepository conceptCodeRepository,
			ValueSetRepository valueSetRepository,
			CodeSystemRepository codeSystemRepository,
			CodeSystemVersionRepository codeSystemVersionRepository,
			ConceptCodeValueSetRepository conceptCodeValueSetRepository,
			ValueSetMgmtHelper valueSetMgmtHelper); @Override @Transactional(rollbackFor = ConceptCodeNotFoundException.class) ConceptCodeDto delete(Long conceptCodeId); @Override ConceptCodeDto findById(Long id); @Override @Transactional(rollbackFor = ConceptCodeNotFoundException.class) ConceptCodeDto update(ConceptCodeDto updated); @Override List<ConceptCodeDto> findAll(); @Override Map<String, Object> findAll(int pageNumber); @Override Map<String, Object> findAllByCode(String searchTerm,
			String codeSystem, String codeSystemVersion, String valueSetName,
			int pageNumber); @Override Map<String, Object> findAllByName(String searchTerm,
			String codeSystem, String codeSystemVersion, String valueSetName,
			int pageNumber); @Override ConceptCodeVSCSDto create(); @Override @Transactional ConceptCodeDto create(ConceptCodeDto created); @Override @Transactional(rollbackFor = DataIntegrityViolationException.class) ConceptCodeDto conceptCodeBatchUpload(ConceptCodeDto conceptCodeDto,
			MultipartFile file, String codeSystemId, Long codeSystemVersionId,
			List<Long> valueSetIds); @Override List<ValueSet> findValueSetsByCodeSystem(String codeSystem,
			String codeSystemVersion); final int CONCEPT_CODE_PAGE_SIZE; }