@Test public void testNumberOfUnhandledFragaSvarForCareUnits() { List<GroupableItem> queryResult = new ArrayList<>(); when(fragasvarRepositoryMock.getUnhandledWithEnhetIdsAndIntygstyper(anyList(), anySet())).thenReturn(queryResult); Map<String, Long> resultMap = new HashMap<>(); resultMap.put("HSA1", 2L); when(statisticsGroupByUtil.toSekretessFilteredMap(queryResult)).thenReturn(resultMap); Map<String, Long> result = service.getNbrOfUnhandledFragaSvarForCareUnits(Arrays.asList( "HSA1", "HSA2"), Stream.of("fk7263").collect(Collectors.toSet())); verify(fragasvarRepositoryMock, times(1)).getUnhandledWithEnhetIdsAndIntygstyper(anyList(), anySet()); verify(statisticsGroupByUtil, times(1)).toSekretessFilteredMap(queryResult); assertEquals(1, result.size()); assertEquals(2L, result.get("HSA1").longValue()); }
@Override public Map<String, Long> getNbrOfUnhandledFragaSvarForCareUnits(List<String> vardenheterIds, Set<String> intygsTyper) { Map<String, Long> resultsMap = new HashMap<>(); if (vardenheterIds == null || vardenheterIds.isEmpty()) { LOGGER.warn("No ids for Vardenheter was supplied"); return resultsMap; } if (intygsTyper == null || intygsTyper.isEmpty()) { LOGGER.warn("No intygsTyper for querying FragaSvar was supplied"); return resultsMap; } List<GroupableItem> results = fragaSvarRepository.getUnhandledWithEnhetIdsAndIntygstyper(vardenheterIds, intygsTyper); return statisticsGroupByUtil.toSekretessFilteredMap(results); }
FragaSvarServiceImpl implements FragaSvarService { @Override public Map<String, Long> getNbrOfUnhandledFragaSvarForCareUnits(List<String> vardenheterIds, Set<String> intygsTyper) { Map<String, Long> resultsMap = new HashMap<>(); if (vardenheterIds == null || vardenheterIds.isEmpty()) { LOGGER.warn("No ids for Vardenheter was supplied"); return resultsMap; } if (intygsTyper == null || intygsTyper.isEmpty()) { LOGGER.warn("No intygsTyper for querying FragaSvar was supplied"); return resultsMap; } List<GroupableItem> results = fragaSvarRepository.getUnhandledWithEnhetIdsAndIntygstyper(vardenheterIds, intygsTyper); return statisticsGroupByUtil.toSekretessFilteredMap(results); } }
FragaSvarServiceImpl implements FragaSvarService { @Override public Map<String, Long> getNbrOfUnhandledFragaSvarForCareUnits(List<String> vardenheterIds, Set<String> intygsTyper) { Map<String, Long> resultsMap = new HashMap<>(); if (vardenheterIds == null || vardenheterIds.isEmpty()) { LOGGER.warn("No ids for Vardenheter was supplied"); return resultsMap; } if (intygsTyper == null || intygsTyper.isEmpty()) { LOGGER.warn("No intygsTyper for querying FragaSvar was supplied"); return resultsMap; } List<GroupableItem> results = fragaSvarRepository.getUnhandledWithEnhetIdsAndIntygstyper(vardenheterIds, intygsTyper); return statisticsGroupByUtil.toSekretessFilteredMap(results); }  }
FragaSvarServiceImpl implements FragaSvarService { @Override public Map<String, Long> getNbrOfUnhandledFragaSvarForCareUnits(List<String> vardenheterIds, Set<String> intygsTyper) { Map<String, Long> resultsMap = new HashMap<>(); if (vardenheterIds == null || vardenheterIds.isEmpty()) { LOGGER.warn("No ids for Vardenheter was supplied"); return resultsMap; } if (intygsTyper == null || intygsTyper.isEmpty()) { LOGGER.warn("No intygsTyper for querying FragaSvar was supplied"); return resultsMap; } List<GroupableItem> results = fragaSvarRepository.getUnhandledWithEnhetIdsAndIntygstyper(vardenheterIds, intygsTyper); return statisticsGroupByUtil.toSekretessFilteredMap(results); }  @Override FragaSvar processIncomingQuestion(FragaSvar fragaSvar); @Override FragaSvar processIncomingAnswer(Long internId, String svarsText, LocalDateTime svarSigneringsDatum); @Override @Transactional(readOnly = true) List<FragaSvarView> getFragaSvar(String intygId); @Override FragaSvar saveSvar(Long fragaSvarsId, String svarsText); @Override List<FragaSvarView> answerKomplettering(final String intygsId, final String svarsText); @Override FragaSvar saveNewQuestion(String intygId, String typ, Amne amne, String frageText); @Override List<FragaSvar> setVidareBefordrad(final String intygsId); @Override FragaSvar closeQuestionAsHandled(Long frageSvarId); @Override void closeCompletionsAsHandled(String intygId); @Override void closeAllNonClosedQuestions(String intygsId); @Override FragaSvar openQuestionAsUnhandled(Long frageSvarId); @Override @Transactional(readOnly = true) QueryFragaSvarResponse filterFragaSvar(Filter filter); @Override @Transactional(readOnly = true) List<Lakare> getFragaSvarHsaIdByEnhet(String enhetsId); @Override Map<String, Long> getNbrOfUnhandledFragaSvarForCareUnits(List<String> vardenheterIds, Set<String> intygsTyper); }
FragaSvarServiceImpl implements FragaSvarService { @Override public Map<String, Long> getNbrOfUnhandledFragaSvarForCareUnits(List<String> vardenheterIds, Set<String> intygsTyper) { Map<String, Long> resultsMap = new HashMap<>(); if (vardenheterIds == null || vardenheterIds.isEmpty()) { LOGGER.warn("No ids for Vardenheter was supplied"); return resultsMap; } if (intygsTyper == null || intygsTyper.isEmpty()) { LOGGER.warn("No intygsTyper for querying FragaSvar was supplied"); return resultsMap; } List<GroupableItem> results = fragaSvarRepository.getUnhandledWithEnhetIdsAndIntygstyper(vardenheterIds, intygsTyper); return statisticsGroupByUtil.toSekretessFilteredMap(results); }  @Override FragaSvar processIncomingQuestion(FragaSvar fragaSvar); @Override FragaSvar processIncomingAnswer(Long internId, String svarsText, LocalDateTime svarSigneringsDatum); @Override @Transactional(readOnly = true) List<FragaSvarView> getFragaSvar(String intygId); @Override FragaSvar saveSvar(Long fragaSvarsId, String svarsText); @Override List<FragaSvarView> answerKomplettering(final String intygsId, final String svarsText); @Override FragaSvar saveNewQuestion(String intygId, String typ, Amne amne, String frageText); @Override List<FragaSvar> setVidareBefordrad(final String intygsId); @Override FragaSvar closeQuestionAsHandled(Long frageSvarId); @Override void closeCompletionsAsHandled(String intygId); @Override void closeAllNonClosedQuestions(String intygsId); @Override FragaSvar openQuestionAsUnhandled(Long frageSvarId); @Override @Transactional(readOnly = true) QueryFragaSvarResponse filterFragaSvar(Filter filter); @Override @Transactional(readOnly = true) List<Lakare> getFragaSvarHsaIdByEnhet(String enhetsId); @Override Map<String, Long> getNbrOfUnhandledFragaSvarForCareUnits(List<String> vardenheterIds, Set<String> intygsTyper);  }