@Test(expected = IllegalArgumentException.class) public void getApplicationsByCandidateIdShouldThrowIllegalArgumentExceptionWhenCandidateDTOIsNull() { applicationsService.getApplicationsByCandidateId(null, PAGE_NUMBER_ZERO, PAGE_SIZE_TEN); }
@Transactional(readOnly = true) @Override public PagingResponse<CandidateApplicationDTO> getApplicationsByCandidateId( Long candidateId, int page, int size) { Assert.notNull(candidateId); CandidateEntity candidateEntity = candidateRepository.findOne(candidateId); Pageable pageRequest = new PageRequest(page, size); final Page<ApplicationEntity> pageResult = applicationsRepository.findByCandidateEntityAndDeletedFalse(candidateEntity, pageRequest); List<CandidateApplicationDTO> candidateApplicationDTOs = converterService.convert(pageResult.getContent(), CandidateApplicationDTO.class); candidateApplicationDTOs = candidateApplicationDTOs.stream() .sorted((m1, m2) -> m2.getModificationDate().compareTo(m1.getModificationDate())) .collect(Collectors.toList()); return new PagingResponse<>(pageResult.getTotalElements(), candidateApplicationDTOs); }
ApplicationsServiceImpl extends AbstractLogicallyDeletableService<ApplicationDTO, ApplicationEntity> implements ApplicationsService { @Transactional(readOnly = true) @Override public PagingResponse<CandidateApplicationDTO> getApplicationsByCandidateId( Long candidateId, int page, int size) { Assert.notNull(candidateId); CandidateEntity candidateEntity = candidateRepository.findOne(candidateId); Pageable pageRequest = new PageRequest(page, size); final Page<ApplicationEntity> pageResult = applicationsRepository.findByCandidateEntityAndDeletedFalse(candidateEntity, pageRequest); List<CandidateApplicationDTO> candidateApplicationDTOs = converterService.convert(pageResult.getContent(), CandidateApplicationDTO.class); candidateApplicationDTOs = candidateApplicationDTOs.stream() .sorted((m1, m2) -> m2.getModificationDate().compareTo(m1.getModificationDate())) .collect(Collectors.toList()); return new PagingResponse<>(pageResult.getTotalElements(), candidateApplicationDTOs); } }
ApplicationsServiceImpl extends AbstractLogicallyDeletableService<ApplicationDTO, ApplicationEntity> implements ApplicationsService { @Transactional(readOnly = true) @Override public PagingResponse<CandidateApplicationDTO> getApplicationsByCandidateId( Long candidateId, int page, int size) { Assert.notNull(candidateId); CandidateEntity candidateEntity = candidateRepository.findOne(candidateId); Pageable pageRequest = new PageRequest(page, size); final Page<ApplicationEntity> pageResult = applicationsRepository.findByCandidateEntityAndDeletedFalse(candidateEntity, pageRequest); List<CandidateApplicationDTO> candidateApplicationDTOs = converterService.convert(pageResult.getContent(), CandidateApplicationDTO.class); candidateApplicationDTOs = candidateApplicationDTOs.stream() .sorted((m1, m2) -> m2.getModificationDate().compareTo(m1.getModificationDate())) .collect(Collectors.toList()); return new PagingResponse<>(pageResult.getTotalElements(), candidateApplicationDTOs); } @Autowired  ApplicationsServiceImpl(
      ApplicationsRepository applicationRepository,
      StatesHistoryService statesHistoryService,
      CandidateRepository candidateRepository,
      ConverterService converterService); }
ApplicationsServiceImpl extends AbstractLogicallyDeletableService<ApplicationDTO, ApplicationEntity> implements ApplicationsService { @Transactional(readOnly = true) @Override public PagingResponse<CandidateApplicationDTO> getApplicationsByCandidateId( Long candidateId, int page, int size) { Assert.notNull(candidateId); CandidateEntity candidateEntity = candidateRepository.findOne(candidateId); Pageable pageRequest = new PageRequest(page, size); final Page<ApplicationEntity> pageResult = applicationsRepository.findByCandidateEntityAndDeletedFalse(candidateEntity, pageRequest); List<CandidateApplicationDTO> candidateApplicationDTOs = converterService.convert(pageResult.getContent(), CandidateApplicationDTO.class); candidateApplicationDTOs = candidateApplicationDTOs.stream() .sorted((m1, m2) -> m2.getModificationDate().compareTo(m1.getModificationDate())) .collect(Collectors.toList()); return new PagingResponse<>(pageResult.getTotalElements(), candidateApplicationDTOs); } @Autowired  ApplicationsServiceImpl(
      ApplicationsRepository applicationRepository,
      StatesHistoryService statesHistoryService,
      CandidateRepository candidateRepository,
      ConverterService converterService); @Transactional(readOnly = true) @Override List<ApplicationDTO> getApplicationsByCandidateDTO(CandidateDTO candidateDTO); @Transactional(readOnly = true) @Override PagingResponse<CandidateApplicationDTO> getApplicationsByCandidateId(
      Long candidateId,
      int page,
      int size); @Transactional @Override void deleteApplicationsByCandidateDTO(CandidateDTO candidateDTO); @Transactional(readOnly = true) @Override ApplicationDTO getApplicationDtoById(Long applicationId); @Transactional @Override Long saveOrUpdate(ApplicationDTO applicationDTO); @Transactional @Override Long saveApplication(ApplicationDTO applicationDTO, StateHistoryDTO stateHistoryDTO); }
ApplicationsServiceImpl extends AbstractLogicallyDeletableService<ApplicationDTO, ApplicationEntity> implements ApplicationsService { @Transactional(readOnly = true) @Override public PagingResponse<CandidateApplicationDTO> getApplicationsByCandidateId( Long candidateId, int page, int size) { Assert.notNull(candidateId); CandidateEntity candidateEntity = candidateRepository.findOne(candidateId); Pageable pageRequest = new PageRequest(page, size); final Page<ApplicationEntity> pageResult = applicationsRepository.findByCandidateEntityAndDeletedFalse(candidateEntity, pageRequest); List<CandidateApplicationDTO> candidateApplicationDTOs = converterService.convert(pageResult.getContent(), CandidateApplicationDTO.class); candidateApplicationDTOs = candidateApplicationDTOs.stream() .sorted((m1, m2) -> m2.getModificationDate().compareTo(m1.getModificationDate())) .collect(Collectors.toList()); return new PagingResponse<>(pageResult.getTotalElements(), candidateApplicationDTOs); } @Autowired  ApplicationsServiceImpl(
      ApplicationsRepository applicationRepository,
      StatesHistoryService statesHistoryService,
      CandidateRepository candidateRepository,
      ConverterService converterService); @Transactional(readOnly = true) @Override List<ApplicationDTO> getApplicationsByCandidateDTO(CandidateDTO candidateDTO); @Transactional(readOnly = true) @Override PagingResponse<CandidateApplicationDTO> getApplicationsByCandidateId(
      Long candidateId,
      int page,
      int size); @Transactional @Override void deleteApplicationsByCandidateDTO(CandidateDTO candidateDTO); @Transactional(readOnly = true) @Override ApplicationDTO getApplicationDtoById(Long applicationId); @Transactional @Override Long saveOrUpdate(ApplicationDTO applicationDTO); @Transactional @Override Long saveApplication(ApplicationDTO applicationDTO, StateHistoryDTO stateHistoryDTO);  }