/** @see org.kuali.kfs.module.bc.service.PayrateImportService#importFile(java.io.InputStream) */ @Transactional public boolean importFile( InputStream fileImportStream, List<ExternalizedMessageWrapper> messageList, String principalId) { Map payRateHoldingPersonUniversalIdentifierKey = new HashMap(); payRateHoldingPersonUniversalIdentifierKey.put( KFSPropertyConstants.PERSON_UNIVERSAL_IDENTIFIER, principalId); this.businessObjectService.deleteMatching( BudgetConstructionPayRateHolding.class, payRateHoldingPersonUniversalIdentifierKey); BufferedReader fileReader = new BufferedReader(new InputStreamReader(fileImportStream)); this.importCount = 0; try { while (fileReader.ready()) { BudgetConstructionPayRateHolding budgetConstructionPayRateHolding = new BudgetConstructionPayRateHolding(); String line = fileReader.readLine(); ObjectUtil.convertLineToBusinessObject( budgetConstructionPayRateHolding, line, DefaultImportFileFormat.fieldLengths, Arrays.asList(DefaultImportFileFormat.fieldNames)); budgetConstructionPayRateHolding.setPrincipalId(principalId); budgetConstructionPayRateHolding.setAppointmentRequestedPayRate( budgetConstructionPayRateHolding.getAppointmentRequestedPayRate().movePointLeft(2)); businessObjectService.save(budgetConstructionPayRateHolding); this.importCount++; } } catch (Exception e) { this.businessObjectService.deleteMatching( BudgetConstructionPayRateHolding.class, payRateHoldingPersonUniversalIdentifierKey); messageList.add(new ExternalizedMessageWrapper(BCKeyConstants.ERROR_PAYRATE_IMPORT_ABORTED)); return false; } if (importCount == 0) messageList.add( new ExternalizedMessageWrapper(BCKeyConstants.MSG_PAYRATE_IMPORT_NO_IMPORT_RECORDS)); else messageList.add( new ExternalizedMessageWrapper( BCKeyConstants.MSG_PAYRATE_IMPORT_COUNT, String.valueOf(importCount))); return true; }