org.kuali.kfs.module.ar.batch.service.impl
Class CustomerLoadServiceImpl

java.lang.Object
  extended by org.kuali.kfs.module.ar.batch.service.impl.CustomerLoadServiceImpl
All Implemented Interfaces:
CustomerLoadService

public class CustomerLoadServiceImpl
extends Object
implements CustomerLoadService


Constructor Summary
CustomerLoadServiceImpl()
           
 
Method Summary
protected  void addBatchErrorstoCustomerLoadResult(CustomerLoadBatchErrors batchErrors, CustomerLoadResult result)
           
protected  void addBatchErrorsToGlobalVariables(CustomerLoadBatchErrors batchErrors)
           
protected  void addError(CustomerLoadBatchErrors batchErrors, String customerName, String propertyName, Class<?> propertyClass, String origValue, String description)
           
protected  org.kuali.rice.kns.document.MaintenanceDocument createRealMaintDoc(org.kuali.rice.kns.document.MaintenanceDocument document)
           
protected  org.kuali.rice.kns.document.MaintenanceDocument createTransientMaintDoc()
           
protected  Customer customerAlreadyExists(Customer customer)
           
protected  void dontBlankOutFieldsOnUpdate(Customer batchCustomer, Customer existingCustomer, String propertyName)
          This messy thing attempts to compare a property on the batch customer (new) and existing customer, and if the new is blank, but the old is there, to overwrite the new-value with the old-value, thus preventing batch uploads from blanking out certain fields.
protected  boolean extractGlobalVariableErrors(CustomerLoadBatchErrors batchErrors, String customerName)
           
protected  String getCustomerMaintenanceDocumentTypeName()
           
protected  List<String> getListOfFilesToProcess()
           
protected  void getPdfWriter(com.lowagie.text.Document pdfDoc)
           
 boolean loadFile(String fileName)
          Validates and parses the file identified by the given files name.
 boolean loadFile(String fileName, CustomerLoadFileResult reporter)
           
 boolean loadFiles()
          Validates and parses all files ready to go in the batch staging area.
protected  void processBeforeValidating(Customer customer, Customer existingCustomer, boolean isUpdate)
          pre-processing for existing and new customer
protected  void removeDoneFiles(List<String> dataFileNames)
          Clears out associated .done files for the processed data files.
protected  byte[] safelyLoadFileBytes(String fileName)
          Accepts a file name and returns a byte-array of the file name contents, if possible.
protected  boolean sendDocumentIntoWorkflow(org.kuali.rice.kns.document.MaintenanceDocument readyTransientDoc, List<String> routedDocumentNumbers, List<String> failedDocumentNumbers, CustomerLoadFileResult reporter)
           
protected  boolean sendDocumentsIntoWorkflow(List<org.kuali.rice.kns.document.MaintenanceDocument> readyTransientDocs, List<String> routedDocumentNumbers, List<String> failedDocumentNumbers, CustomerLoadFileResult reporter)
           
 void setBatchInputFileService(BatchInputFileService batchInputFileService)
           
 void setBatchInputFileType(BatchInputFileType batchInputFileType)
           
 void setBoService(org.kuali.rice.kns.service.BusinessObjectService boService)
           
 void setConfigService(org.kuali.rice.kns.service.KualiConfigurationService configService)
           
 void setCustomerService(CustomerService customerService)
           
 void setDateTimeService(org.kuali.rice.kns.service.DateTimeService dateTimeService)
           
 void setDocService(org.kuali.rice.kns.service.DocumentService docService)
           
 void setOrgService(OrganizationService orgService)
           
 void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)
           
 void setReportsDirectory(String reportsDirectory)
           
 void setSysInfoService(SystemInformationService sysInfoService)
           
protected  void upperCaseKeyFields(Customer customer)
           
 boolean validate(List<CustomerDigesterVO> customerUploads)
          The results of this method follow the same rules as the batch step result rules: The execution of this method may have 3 possible outcomes: 1.
 boolean validateAndPrepare(List<CustomerDigesterVO> customerUploads, List<org.kuali.rice.kns.document.MaintenanceDocument> customerMaintDocs, boolean useGlobalErrorMap)
          Performs specific validation on the parsed file contents.
protected  boolean validateCustomers(List<CustomerDigesterVO> customerUploads, List<org.kuali.rice.kns.document.MaintenanceDocument> customerMaintDocs, CustomerLoadFileResult reporter, boolean useGlobalErrorMap)
          Validate the customers lists
protected  boolean validateSingle(org.kuali.rice.kns.document.MaintenanceDocument maintDoc, CustomerLoadBatchErrors batchErrors, String customerName)
           
protected  void writeCustomerSectionResult(com.lowagie.text.Document pdfDoc, String resultLine)
           
protected  void writeCustomerSectionTitle(com.lowagie.text.Document pdfDoc, String customerNameLine)
           
protected  void writeFileNameSectionTitle(com.lowagie.text.Document pdfDoc, String filenameLine)
           
protected  void writeMessageEntryLines(com.lowagie.text.Document pdfDoc, List<String[]> messageLines)
           
protected  void writeReportPDF(List<CustomerLoadFileResult> fileResults)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomerLoadServiceImpl

public CustomerLoadServiceImpl()
Method Detail

loadFiles

public boolean loadFiles()
Description copied from interface: CustomerLoadService
Validates and parses all files ready to go in the batch staging area.

Specified by:
loadFiles in interface CustomerLoadService
Returns:

getListOfFilesToProcess

protected List<String> getListOfFilesToProcess()

removeDoneFiles

protected void removeDoneFiles(List<String> dataFileNames)
Clears out associated .done files for the processed data files.

Parameters:
dataFileNames -

loadFile

public boolean loadFile(String fileName)
Description copied from interface: CustomerLoadService
Validates and parses the file identified by the given files name. If successful, parsed entries are stored.

Specified by:
loadFile in interface CustomerLoadService
Returns:
True if the file load and store was successful, false otherwise.
See Also:
CustomerLoadService.loadFile(java.lang.String)

loadFile

public boolean loadFile(String fileName,
                        CustomerLoadFileResult reporter)

sendDocumentsIntoWorkflow

protected boolean sendDocumentsIntoWorkflow(List<org.kuali.rice.kns.document.MaintenanceDocument> readyTransientDocs,
                                            List<String> routedDocumentNumbers,
                                            List<String> failedDocumentNumbers,
                                            CustomerLoadFileResult reporter)

sendDocumentIntoWorkflow

protected boolean sendDocumentIntoWorkflow(org.kuali.rice.kns.document.MaintenanceDocument readyTransientDoc,
                                           List<String> routedDocumentNumbers,
                                           List<String> failedDocumentNumbers,
                                           CustomerLoadFileResult reporter)

getCustomerMaintenanceDocumentTypeName

protected String getCustomerMaintenanceDocumentTypeName()

addError

protected void addError(CustomerLoadBatchErrors batchErrors,
                        String customerName,
                        String propertyName,
                        Class<?> propertyClass,
                        String origValue,
                        String description)

addBatchErrorsToGlobalVariables

protected void addBatchErrorsToGlobalVariables(CustomerLoadBatchErrors batchErrors)

addBatchErrorstoCustomerLoadResult

protected void addBatchErrorstoCustomerLoadResult(CustomerLoadBatchErrors batchErrors,
                                                  CustomerLoadResult result)

safelyLoadFileBytes

protected byte[] safelyLoadFileBytes(String fileName)
Accepts a file name and returns a byte-array of the file name contents, if possible. Throws RuntimeExceptions if FileNotFound or IOExceptions occur.

Parameters:
fileName - String containing valid path & filename (relative or absolute) of file to load.
Returns:
A Byte Array of the contents of the file.

validate

public boolean validate(List<CustomerDigesterVO> customerUploads)
The results of this method follow the same rules as the batch step result rules: The execution of this method may have 3 possible outcomes: 1. returns true, meaning that everything has succeeded, and dependent steps can continue running. No errors should be added to GlobalVariables.getMessageMap(). 2. returns false, meaning that some (but not necessarily all) steps have succeeded, and dependent steps can continue running. Details can be found in the GlobalVariables.getMessageMap(). 3. throws an exception, meaning that the step has failed, that the rest of the steps in a job should not be run, and that the job has failed. There may be errors in the GlobalVariables.getMessageMap().

Specified by:
validate in interface CustomerLoadService
Parameters:
customerUploads - A List of CustomerDigesterVO objects, that are the processed results of the uploaded files.
Returns:
True if no errors were encountered, False otherwise.
See Also:
CustomerLoadService.validate(java.util.List)

validateAndPrepare

public boolean validateAndPrepare(List<CustomerDigesterVO> customerUploads,
                                  List<org.kuali.rice.kns.document.MaintenanceDocument> customerMaintDocs,
                                  boolean useGlobalErrorMap)
Description copied from interface: CustomerLoadService
Performs specific validation on the parsed file contents. If errors were found, method will return false and GlobalVariables.errorMap will contain the error message. If no errors were encountered the method will return true.

Specified by:
validateAndPrepare in interface CustomerLoadService
Parameters:
customerUploads - A List of CustomerDigesterVO objects, that are the processed results of the uploaded files.
customerMaintDocs - A list of the customerMaintDocs that are returned by the validateAndPrepare method. A valid list should be passed in, and MaintDocs will be added to it.
Returns:
True if no errors were encountered, False otherwise.
See Also:
CustomerLoadService.validateAndPrepare(java.util.List, java.util.List, boolean)

validateCustomers

protected boolean validateCustomers(List<CustomerDigesterVO> customerUploads,
                                    List<org.kuali.rice.kns.document.MaintenanceDocument> customerMaintDocs,
                                    CustomerLoadFileResult reporter,
                                    boolean useGlobalErrorMap)
Validate the customers lists

Parameters:
customerUploads -
customerMaintDocs -
reporter -
useGlobalErrorMap -
Returns:

processBeforeValidating

protected void processBeforeValidating(Customer customer,
                                       Customer existingCustomer,
                                       boolean isUpdate)
pre-processing for existing and new customer

Parameters:
customer -
existingCustomer -
isUpdate -

upperCaseKeyFields

protected void upperCaseKeyFields(Customer customer)

dontBlankOutFieldsOnUpdate

protected void dontBlankOutFieldsOnUpdate(Customer batchCustomer,
                                          Customer existingCustomer,
                                          String propertyName)
This messy thing attempts to compare a property on the batch customer (new) and existing customer, and if the new is blank, but the old is there, to overwrite the new-value with the old-value, thus preventing batch uploads from blanking out certain fields.

Parameters:
batchCustomer -
existingCustomer -
propertyName -

validateSingle

protected boolean validateSingle(org.kuali.rice.kns.document.MaintenanceDocument maintDoc,
                                 CustomerLoadBatchErrors batchErrors,
                                 String customerName)

extractGlobalVariableErrors

protected boolean extractGlobalVariableErrors(CustomerLoadBatchErrors batchErrors,
                                              String customerName)

createTransientMaintDoc

protected org.kuali.rice.kns.document.MaintenanceDocument createTransientMaintDoc()

createRealMaintDoc

protected org.kuali.rice.kns.document.MaintenanceDocument createRealMaintDoc(org.kuali.rice.kns.document.MaintenanceDocument document)

customerAlreadyExists

protected Customer customerAlreadyExists(Customer customer)

writeReportPDF

protected void writeReportPDF(List<CustomerLoadFileResult> fileResults)

writeFileNameSectionTitle

protected void writeFileNameSectionTitle(com.lowagie.text.Document pdfDoc,
                                         String filenameLine)

writeCustomerSectionTitle

protected void writeCustomerSectionTitle(com.lowagie.text.Document pdfDoc,
                                         String customerNameLine)

writeCustomerSectionResult

protected void writeCustomerSectionResult(com.lowagie.text.Document pdfDoc,
                                          String resultLine)

writeMessageEntryLines

protected void writeMessageEntryLines(com.lowagie.text.Document pdfDoc,
                                      List<String[]> messageLines)

getPdfWriter

protected void getPdfWriter(com.lowagie.text.Document pdfDoc)

setBatchInputFileService

public void setBatchInputFileService(BatchInputFileService batchInputFileService)

setCustomerService

public void setCustomerService(CustomerService customerService)

setConfigService

public void setConfigService(org.kuali.rice.kns.service.KualiConfigurationService configService)

setDocService

public void setDocService(org.kuali.rice.kns.service.DocumentService docService)

setBatchInputFileType

public void setBatchInputFileType(BatchInputFileType batchInputFileType)

setParameterService

public void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)

setOrgService

public void setOrgService(OrganizationService orgService)

setSysInfoService

public void setSysInfoService(SystemInformationService sysInfoService)

setBoService

public void setBoService(org.kuali.rice.kns.service.BusinessObjectService boService)

setDateTimeService

public void setDateTimeService(org.kuali.rice.kns.service.DateTimeService dateTimeService)

setReportsDirectory

public void setReportsDirectory(String reportsDirectory)


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.