@Test public void testShouldFindAllComplaintsBySearchCriteria() { final ServiceRequestSearchCriteria searchCriteria = ServiceRequestSearchCriteria.builder().build(); final ServiceRequest expectedComplaint = getComplaint(); when(complaintRepository.find(searchCriteria)).thenReturn(Collections.singletonList(expectedComplaint)); final List<ServiceRequest> actualComplaints = serviceRequestService.findAll(searchCriteria); assertEquals(1, actualComplaints.size()); assertEquals(expectedComplaint, actualComplaints.get(0)); }
public List<ServiceRequest> findAll(ServiceRequestSearchCriteria serviceRequestSearchCriteria) { List<ServiceRequest> serviceRequestList; serviceRequestList = postgresEnabled ? serviceRequestRepository.findFromDb(serviceRequestSearchCriteria) : getRecordFromES(serviceRequestSearchCriteria); maskCitizenDetailsForAnonymousRequest(serviceRequestSearchCriteria, serviceRequestList); if(serviceRequestSearchCriteria.getFromIndex() != null && serviceRequestSearchCriteria.getPageSize() != null){ return getPageData(serviceRequestList, serviceRequestSearchCriteria); } return serviceRequestList; }
ServiceRequestService { public List<ServiceRequest> findAll(ServiceRequestSearchCriteria serviceRequestSearchCriteria) { List<ServiceRequest> serviceRequestList; serviceRequestList = postgresEnabled ? serviceRequestRepository.findFromDb(serviceRequestSearchCriteria) : getRecordFromES(serviceRequestSearchCriteria); maskCitizenDetailsForAnonymousRequest(serviceRequestSearchCriteria, serviceRequestList); if(serviceRequestSearchCriteria.getFromIndex() != null && serviceRequestSearchCriteria.getPageSize() != null){ return getPageData(serviceRequestList, serviceRequestSearchCriteria); } return serviceRequestList; } }
ServiceRequestService { public List<ServiceRequest> findAll(ServiceRequestSearchCriteria serviceRequestSearchCriteria) { List<ServiceRequest> serviceRequestList; serviceRequestList = postgresEnabled ? serviceRequestRepository.findFromDb(serviceRequestSearchCriteria) : getRecordFromES(serviceRequestSearchCriteria); maskCitizenDetailsForAnonymousRequest(serviceRequestSearchCriteria, serviceRequestList); if(serviceRequestSearchCriteria.getFromIndex() != null && serviceRequestSearchCriteria.getPageSize() != null){ return getPageData(serviceRequestList, serviceRequestSearchCriteria); } return serviceRequestList; } @Autowired  ServiceRequestService(ServiceRequestRepository serviceRequestRepository,
                                 SevaNumberGeneratorService sevaNumberGeneratorService,
                                 UserRepository userRepository,
                                 ServiceRequestTypeService serviceRequestTypeService,
                                 List<ServiceRequestValidator> validators,
                                 ServiceRequestCustomFieldService customFieldService,
                                 DraftService draftService, @Value("${postgres.enabled}") boolean postgresEnabled); }
ServiceRequestService { public List<ServiceRequest> findAll(ServiceRequestSearchCriteria serviceRequestSearchCriteria) { List<ServiceRequest> serviceRequestList; serviceRequestList = postgresEnabled ? serviceRequestRepository.findFromDb(serviceRequestSearchCriteria) : getRecordFromES(serviceRequestSearchCriteria); maskCitizenDetailsForAnonymousRequest(serviceRequestSearchCriteria, serviceRequestList); if(serviceRequestSearchCriteria.getFromIndex() != null && serviceRequestSearchCriteria.getPageSize() != null){ return getPageData(serviceRequestList, serviceRequestSearchCriteria); } return serviceRequestList; } @Autowired  ServiceRequestService(ServiceRequestRepository serviceRequestRepository,
                                 SevaNumberGeneratorService sevaNumberGeneratorService,
                                 UserRepository userRepository,
                                 ServiceRequestTypeService serviceRequestTypeService,
                                 List<ServiceRequestValidator> validators,
                                 ServiceRequestCustomFieldService customFieldService,
                                 DraftService draftService, @Value("${postgres.enabled}") boolean postgresEnabled); List<ServiceRequest> findAll(ServiceRequestSearchCriteria serviceRequestSearchCriteria); Long getCount(ServiceRequestSearchCriteria searchCriteria); void save(ServiceRequest serviceRequest, SevaRequest contractSevaRequest); void update(ServiceRequest serviceRequest, SevaRequest contractSevaRequest); List<String> getCrnByAttributes(String receivingMode, Long locationId, String keyword); }
ServiceRequestService { public List<ServiceRequest> findAll(ServiceRequestSearchCriteria serviceRequestSearchCriteria) { List<ServiceRequest> serviceRequestList; serviceRequestList = postgresEnabled ? serviceRequestRepository.findFromDb(serviceRequestSearchCriteria) : getRecordFromES(serviceRequestSearchCriteria); maskCitizenDetailsForAnonymousRequest(serviceRequestSearchCriteria, serviceRequestList); if(serviceRequestSearchCriteria.getFromIndex() != null && serviceRequestSearchCriteria.getPageSize() != null){ return getPageData(serviceRequestList, serviceRequestSearchCriteria); } return serviceRequestList; } @Autowired  ServiceRequestService(ServiceRequestRepository serviceRequestRepository,
                                 SevaNumberGeneratorService sevaNumberGeneratorService,
                                 UserRepository userRepository,
                                 ServiceRequestTypeService serviceRequestTypeService,
                                 List<ServiceRequestValidator> validators,
                                 ServiceRequestCustomFieldService customFieldService,
                                 DraftService draftService, @Value("${postgres.enabled}") boolean postgresEnabled); List<ServiceRequest> findAll(ServiceRequestSearchCriteria serviceRequestSearchCriteria); Long getCount(ServiceRequestSearchCriteria searchCriteria); void save(ServiceRequest serviceRequest, SevaRequest contractSevaRequest); void update(ServiceRequest serviceRequest, SevaRequest contractSevaRequest); List<String> getCrnByAttributes(String receivingMode, Long locationId, String keyword);  }