@Test public void testShouldPersistSevaRequestOnSave() { final ServiceRequest complaint = getComplaint(); final org.egov.pgrrest.common.contract.web.ServiceRequest serviceRequest = getServiceRequest(); final SevaRequest sevaRequest = new SevaRequest(new RequestInfo(), serviceRequest); when(sevaNumberGeneratorService.generate("default")).thenReturn(CRN); when(userRepository.getUserByUserName("anonymous", "tenantId")).thenReturn(populateUser()); serviceRequestService.save(complaint, sevaRequest); verify(complaintRepository).save(sevaRequest); }
public void save(ServiceRequest serviceRequest, SevaRequest contractSevaRequest) { validate(serviceRequest); enrichWithServiceType(serviceRequest); enrichWithCRN(serviceRequest); contractSevaRequest.update(serviceRequest); setUserIdForAnonymousUser(contractSevaRequest); enrichWithComputedFields(serviceRequest, contractSevaRequest, serviceRequest.getServiceStatus()); serviceRequestRepository.save(contractSevaRequest); deleteDraft(serviceRequest); }
ServiceRequestService { public void save(ServiceRequest serviceRequest, SevaRequest contractSevaRequest) { validate(serviceRequest); enrichWithServiceType(serviceRequest); enrichWithCRN(serviceRequest); contractSevaRequest.update(serviceRequest); setUserIdForAnonymousUser(contractSevaRequest); enrichWithComputedFields(serviceRequest, contractSevaRequest, serviceRequest.getServiceStatus()); serviceRequestRepository.save(contractSevaRequest); deleteDraft(serviceRequest); } }
ServiceRequestService { public void save(ServiceRequest serviceRequest, SevaRequest contractSevaRequest) { validate(serviceRequest); enrichWithServiceType(serviceRequest); enrichWithCRN(serviceRequest); contractSevaRequest.update(serviceRequest); setUserIdForAnonymousUser(contractSevaRequest); enrichWithComputedFields(serviceRequest, contractSevaRequest, serviceRequest.getServiceStatus()); serviceRequestRepository.save(contractSevaRequest); deleteDraft(serviceRequest); } @Autowired  ServiceRequestService(ServiceRequestRepository serviceRequestRepository,
                                 SevaNumberGeneratorService sevaNumberGeneratorService,
                                 UserRepository userRepository,
                                 ServiceRequestTypeService serviceRequestTypeService,
                                 List<ServiceRequestValidator> validators,
                                 ServiceRequestCustomFieldService customFieldService,
                                 DraftService draftService, @Value("${postgres.enabled}") boolean postgresEnabled); }
ServiceRequestService { public void save(ServiceRequest serviceRequest, SevaRequest contractSevaRequest) { validate(serviceRequest); enrichWithServiceType(serviceRequest); enrichWithCRN(serviceRequest); contractSevaRequest.update(serviceRequest); setUserIdForAnonymousUser(contractSevaRequest); enrichWithComputedFields(serviceRequest, contractSevaRequest, serviceRequest.getServiceStatus()); serviceRequestRepository.save(contractSevaRequest); deleteDraft(serviceRequest); } @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 void save(ServiceRequest serviceRequest, SevaRequest contractSevaRequest) { validate(serviceRequest); enrichWithServiceType(serviceRequest); enrichWithCRN(serviceRequest); contractSevaRequest.update(serviceRequest); setUserIdForAnonymousUser(contractSevaRequest); enrichWithComputedFields(serviceRequest, contractSevaRequest, serviceRequest.getServiceStatus()); serviceRequestRepository.save(contractSevaRequest); deleteDraft(serviceRequest); } @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);  }