@Test public final void testAdd() { when(boundaryContractRepository.findByLocalityCodes(any(String.class), any(String.class), any(RequestInfoWrapper.class))) .thenReturn(getBoundaryResponse()); when(boundaryContractRepository.findByAdminWardCodes(any(String.class), any(String.class), any(RequestInfoWrapper.class))) .thenReturn(getBoundaryResponse()); when(boundaryContractRepository.findByRevenueWardCodes(any(String.class), any(String.class), any(RequestInfoWrapper.class))) .thenReturn(getBoundaryResponse()); when(categoryContractRepository.findByCategoryCode(any(TradeLicense.class), any(RequestInfoWrapper.class))) .thenReturn(getCategoyResponse()); when(categoryContractRepository.findBySubCategoryCode(any(TradeLicense.class), any(RequestInfoWrapper.class))) .thenReturn(getSubCategoyResponse()); when(categoryContractRepository.findBySubCategoryUomCode(any(TradeLicense.class), any(RequestInfoWrapper.class))) .thenReturn(getSubCategoyResponse()); when(documentTypeContractRepository.findByIdAndTlValues(any(TradeLicense.class), any(SupportDocument.class), any(RequestInfoWrapper.class))).thenReturn(getDocumentTypeV2Response()); tradeLicenses.add(getTradeLicense()); tradeLicenseService.add(tradeLicenses, requestInfo, errors); }
@Transactional public List<TradeLicense> add(List<TradeLicense> tradeLicenses, RequestInfo requestInfo, BindingResult errors) { tradeLicenseServiceValidator.validateCreateTradeLicenseRelated(tradeLicenses, requestInfo); for (TradeLicense license : tradeLicenses) { setLicenseCreationAuditDetails(license, requestInfo); license.setId(tradeLicenseRepository.getNextSequence()); license.getApplication().setLicenseId(license.getId()); license.getApplication().setId(licenseApplicationRepository.getNextSequence()); setIdsForLicenseApplicationSupportDocuments(license); setIdsForLicenseTradePartners(license); setIdsForLicenseTradeShifts(license); licenseUserService.createUser(license, requestInfo); if (license.getIsLegacy()) { setIdsForLicenseApplicationFeeDetails(license); if(!license.getIsDataPorting()){ setLicenseStatus(license, requestInfo); } else if(license.getIsDataPorting() && license.getExpiryDate() != null){ setLicenseStatus(license, requestInfo); } license.setLicenseNumber(licenseNumberGenerationService.generate(license.getTenantId(), requestInfo)); } else { setCreateNewLicenseApplicationStatus(license, requestInfo); populateWorkFlowDetails(license, requestInfo); if (license.getApplication().getApplicationNumber() == null || (license.getApplication().getApplicationNumber() != null && license.getApplication().getApplicationNumber().isEmpty())) { license.getApplication().setApplicationNumber( applNumberGenrationService.generate(license.getTenantId(), requestInfo)); } if (license.getApplication().getApplicationDate() == null) { license.getApplication().setApplicationDate(System.currentTimeMillis()); } } } return tradeLicenses; }
TradeLicenseService { @Transactional public List<TradeLicense> add(List<TradeLicense> tradeLicenses, RequestInfo requestInfo, BindingResult errors) { tradeLicenseServiceValidator.validateCreateTradeLicenseRelated(tradeLicenses, requestInfo); for (TradeLicense license : tradeLicenses) { setLicenseCreationAuditDetails(license, requestInfo); license.setId(tradeLicenseRepository.getNextSequence()); license.getApplication().setLicenseId(license.getId()); license.getApplication().setId(licenseApplicationRepository.getNextSequence()); setIdsForLicenseApplicationSupportDocuments(license); setIdsForLicenseTradePartners(license); setIdsForLicenseTradeShifts(license); licenseUserService.createUser(license, requestInfo); if (license.getIsLegacy()) { setIdsForLicenseApplicationFeeDetails(license); if(!license.getIsDataPorting()){ setLicenseStatus(license, requestInfo); } else if(license.getIsDataPorting() && license.getExpiryDate() != null){ setLicenseStatus(license, requestInfo); } license.setLicenseNumber(licenseNumberGenerationService.generate(license.getTenantId(), requestInfo)); } else { setCreateNewLicenseApplicationStatus(license, requestInfo); populateWorkFlowDetails(license, requestInfo); if (license.getApplication().getApplicationNumber() == null || (license.getApplication().getApplicationNumber() != null && license.getApplication().getApplicationNumber().isEmpty())) { license.getApplication().setApplicationNumber( applNumberGenrationService.generate(license.getTenantId(), requestInfo)); } if (license.getApplication().getApplicationDate() == null) { license.getApplication().setApplicationDate(System.currentTimeMillis()); } } } return tradeLicenses; } }
TradeLicenseService { @Transactional public List<TradeLicense> add(List<TradeLicense> tradeLicenses, RequestInfo requestInfo, BindingResult errors) { tradeLicenseServiceValidator.validateCreateTradeLicenseRelated(tradeLicenses, requestInfo); for (TradeLicense license : tradeLicenses) { setLicenseCreationAuditDetails(license, requestInfo); license.setId(tradeLicenseRepository.getNextSequence()); license.getApplication().setLicenseId(license.getId()); license.getApplication().setId(licenseApplicationRepository.getNextSequence()); setIdsForLicenseApplicationSupportDocuments(license); setIdsForLicenseTradePartners(license); setIdsForLicenseTradeShifts(license); licenseUserService.createUser(license, requestInfo); if (license.getIsLegacy()) { setIdsForLicenseApplicationFeeDetails(license); if(!license.getIsDataPorting()){ setLicenseStatus(license, requestInfo); } else if(license.getIsDataPorting() && license.getExpiryDate() != null){ setLicenseStatus(license, requestInfo); } license.setLicenseNumber(licenseNumberGenerationService.generate(license.getTenantId(), requestInfo)); } else { setCreateNewLicenseApplicationStatus(license, requestInfo); populateWorkFlowDetails(license, requestInfo); if (license.getApplication().getApplicationNumber() == null || (license.getApplication().getApplicationNumber() != null && license.getApplication().getApplicationNumber().isEmpty())) { license.getApplication().setApplicationNumber( applNumberGenrationService.generate(license.getTenantId(), requestInfo)); } if (license.getApplication().getApplicationDate() == null) { license.getApplication().setApplicationDate(System.currentTimeMillis()); } } } return tradeLicenses; }  }
TradeLicenseService { @Transactional public List<TradeLicense> add(List<TradeLicense> tradeLicenses, RequestInfo requestInfo, BindingResult errors) { tradeLicenseServiceValidator.validateCreateTradeLicenseRelated(tradeLicenses, requestInfo); for (TradeLicense license : tradeLicenses) { setLicenseCreationAuditDetails(license, requestInfo); license.setId(tradeLicenseRepository.getNextSequence()); license.getApplication().setLicenseId(license.getId()); license.getApplication().setId(licenseApplicationRepository.getNextSequence()); setIdsForLicenseApplicationSupportDocuments(license); setIdsForLicenseTradePartners(license); setIdsForLicenseTradeShifts(license); licenseUserService.createUser(license, requestInfo); if (license.getIsLegacy()) { setIdsForLicenseApplicationFeeDetails(license); if(!license.getIsDataPorting()){ setLicenseStatus(license, requestInfo); } else if(license.getIsDataPorting() && license.getExpiryDate() != null){ setLicenseStatus(license, requestInfo); } license.setLicenseNumber(licenseNumberGenerationService.generate(license.getTenantId(), requestInfo)); } else { setCreateNewLicenseApplicationStatus(license, requestInfo); populateWorkFlowDetails(license, requestInfo); if (license.getApplication().getApplicationNumber() == null || (license.getApplication().getApplicationNumber() != null && license.getApplication().getApplicationNumber().isEmpty())) { license.getApplication().setApplicationNumber( applNumberGenrationService.generate(license.getTenantId(), requestInfo)); } if (license.getApplication().getApplicationDate() == null) { license.getApplication().setApplicationDate(System.currentTimeMillis()); } } } return tradeLicenses; }  @Transactional List<TradeLicense> add(List<TradeLicense> tradeLicenses, RequestInfo requestInfo, BindingResult errors); @Transactional List<TradeLicense> update(List<TradeLicense> tradeLicenses, RequestInfo requestInfo, BindingResult errors); void addToQue(TradeLicenseRequest request, Boolean isNewRecord); @Transactional TradeLicense save(TradeLicense tradeLicense, RequestInfo requestInfo); @Transactional TradeLicense update(TradeLicense tradeLicense, RequestInfo requestInfo); void generateApplicationDemand(TradeLicense tradeLicense, RequestInfo requestInfo); List<TradeLicense> search(LicenseSearch domain); ResponseInfo createResponseInfoFromRequestInfo(RequestInfo requestInfo, Boolean success); RequestInfo createRequestInfoFromResponseInfo(ResponseInfo responseInfo); @Transactional void updateTradeLicenseAfterCollection(DemandResponse demandResponse); TradeLicense findLicense(LicenseSearch domain); }
TradeLicenseService { @Transactional public List<TradeLicense> add(List<TradeLicense> tradeLicenses, RequestInfo requestInfo, BindingResult errors) { tradeLicenseServiceValidator.validateCreateTradeLicenseRelated(tradeLicenses, requestInfo); for (TradeLicense license : tradeLicenses) { setLicenseCreationAuditDetails(license, requestInfo); license.setId(tradeLicenseRepository.getNextSequence()); license.getApplication().setLicenseId(license.getId()); license.getApplication().setId(licenseApplicationRepository.getNextSequence()); setIdsForLicenseApplicationSupportDocuments(license); setIdsForLicenseTradePartners(license); setIdsForLicenseTradeShifts(license); licenseUserService.createUser(license, requestInfo); if (license.getIsLegacy()) { setIdsForLicenseApplicationFeeDetails(license); if(!license.getIsDataPorting()){ setLicenseStatus(license, requestInfo); } else if(license.getIsDataPorting() && license.getExpiryDate() != null){ setLicenseStatus(license, requestInfo); } license.setLicenseNumber(licenseNumberGenerationService.generate(license.getTenantId(), requestInfo)); } else { setCreateNewLicenseApplicationStatus(license, requestInfo); populateWorkFlowDetails(license, requestInfo); if (license.getApplication().getApplicationNumber() == null || (license.getApplication().getApplicationNumber() != null && license.getApplication().getApplicationNumber().isEmpty())) { license.getApplication().setApplicationNumber( applNumberGenrationService.generate(license.getTenantId(), requestInfo)); } if (license.getApplication().getApplicationDate() == null) { license.getApplication().setApplicationDate(System.currentTimeMillis()); } } } return tradeLicenses; }  @Transactional List<TradeLicense> add(List<TradeLicense> tradeLicenses, RequestInfo requestInfo, BindingResult errors); @Transactional List<TradeLicense> update(List<TradeLicense> tradeLicenses, RequestInfo requestInfo, BindingResult errors); void addToQue(TradeLicenseRequest request, Boolean isNewRecord); @Transactional TradeLicense save(TradeLicense tradeLicense, RequestInfo requestInfo); @Transactional TradeLicense update(TradeLicense tradeLicense, RequestInfo requestInfo); void generateApplicationDemand(TradeLicense tradeLicense, RequestInfo requestInfo); List<TradeLicense> search(LicenseSearch domain); ResponseInfo createResponseInfoFromRequestInfo(RequestInfo requestInfo, Boolean success); RequestInfo createRequestInfoFromResponseInfo(ResponseInfo responseInfo); @Transactional void updateTradeLicenseAfterCollection(DemandResponse demandResponse); TradeLicense findLicense(LicenseSearch domain); static final String NEW_LICENSE_MODULE_TYPE; static final String LICENSE_MODULE_TYPE; static final String NEW_TRADE_LICENSE_WF_TYPE; static final String NEW_TRADE_LICENSE_BUSINESSKEY; }