org.kuali.kfs.gl.batch.service.impl
Class CollectorHelperServiceImpl

java.lang.Object
  extended by org.kuali.kfs.gl.batch.service.impl.CollectorHelperServiceImpl
All Implemented Interfaces:
CollectorHelperService

public class CollectorHelperServiceImpl
extends Object
implements CollectorHelperService

The base implementation of CollectorHelperService

See Also:
CollectorService

Constructor Summary
CollectorHelperServiceImpl()
           
 
Method Summary
protected  String attemptToParseEmailAfterParseError(String fileName)
          After a parse error, tries to go through the file to see if the email address can be determined.
protected  boolean checkDetailKeys(CollectorBatch batch, org.kuali.rice.kns.util.MessageMap MessageMap)
          Verifies each detail (id billing) record key has an corresponding gl entry in the same batch.
protected  boolean checkForMixedBalanceTypes(CollectorBatch batch, org.kuali.rice.kns.util.MessageMap MessageMap)
          Iterates through the origin entries and builds a map on the balance types.
protected  boolean checkForMixedDocumentTypes(CollectorBatch batch, org.kuali.rice.kns.util.MessageMap MessageMap)
          Iterates through the origin entries and builds a map on the document types.
 boolean checkTrailerTotals(CollectorBatch batch, CollectorReportData collectorReportData)
          Checks the batch total line count and amounts against the trailer.
protected  boolean checkTrailerTotals(CollectorBatch batch, CollectorReportData collectorReportData, org.kuali.rice.kns.util.MessageMap MessageMap)
          Checks the batch total line count and amounts against the trailer.
protected  List<CollectorBatch> doCollectorFileParse(String fileName, org.kuali.rice.kns.util.MessageMap messageMap, BatchInputFileType collectorInputFileType, CollectorReportData collectorReportData)
          Calls batch input service to parse the xml contents into an object.
protected  boolean duplicateHeaderCheck(CollectorBatch batch, org.kuali.rice.kns.util.MessageMap messageMap)
          Checks header against previously loaded batch headers for a duplicate submission.
protected  String extractAccountNumber(Object originEntryOrDetail)
           
protected  String extractChartOfAccountsCode(Object originEntryOrDetail)
           
protected  String generateCollectorDetailMatchingKey(CollectorDetail collectorDetail, String delimiter)
          Generates a String representation of the CollectorDetail's primary key
protected  String generateOriginEntryMatchingKey(OriginEntryFull entry, String delimiter)
          Generates a String representation of the OriginEntryFull's primary key
protected  String getBalanceTypeCode(CollectorDetail collectorDetail, CollectorBatch batch)
          Returns the balance type code for the interDepartmentalBilling record.
 String getStagingDirectory()
          Returns the name of the directory where Collector files are saved
protected  boolean loadCollectorBatch(CollectorBatch batch, String fileName, int batchIndex, CollectorReportData collectorReportData, List<CollectorScrubberStatus> collectorScrubberStatuses, BatchInputFileType collectorInputFileType, PrintStream originEntryOutputPs)
           
 boolean loadCollectorFile(String fileName, CollectorReportData collectorReportData, List<CollectorScrubberStatus> collectorScrubberStatuses, BatchInputFileType collectorInputFileType, PrintStream originEntryOutputPs)
          Parses the given file, validates the batch, stores the entries, and sends email.
protected  void negateAmountIfNecessary(CollectorDetail collectorDetail, BalanceType balanceTyp, ObjectType objectType, CollectorBatch batch)
          Negates the amount of the internal departmental billing detail record if necessary.
protected  boolean performCollectorHeaderValidation(CollectorBatch batch, org.kuali.rice.kns.util.MessageMap messageMap)
           
protected  void performUppercasing(CollectorBatch batch)
          Uppercases sub-account, sub-object, and project fields
 boolean performValidation(CollectorBatch batch)
          Validates the contents of a parsed file.
protected  boolean performValidation(CollectorBatch batch, org.kuali.rice.kns.util.MessageMap MessageMap)
          Performs the following checks on the collector batch: Any errors will be contained in GlobalVariables.MessageMap
protected  void prescrubParsedCollectorBatch(CollectorBatch collectorBatch, CollectorReportData collectorReportData)
           
protected  void processInterDepartmentalBillingAmounts(CollectorBatch batch)
          Modifies the amounts in the ID Billing Detail rows, depending on specific business rules.
 void setAccountService(AccountService accountService)
          Sets the accountService attribute value.
 void setBatchFileDirectoryName(String batchFileDirectoryName)
          Sets the batchFileDirectoryName attribute value.
 void setBatchInputFileService(BatchInputFileService batchInputFileService)
           
protected  void setChartOfAccountsCode(Object originEntryOrDetail, String chartOfAccountsCode)
           
 void setCollectorDetailService(CollectorDetailService collectorDetailService)
           
 void setCollectorScrubberService(CollectorScrubberService collectorScrubberService)
          Sets the collectorScrubberService attribute value.
 void setConfigurationService(org.kuali.rice.kns.service.KualiConfigurationService configurationService)
           
 void setDateTimeService(org.kuali.rice.kns.service.DateTimeService dateTimeService)
           
 void setOriginEntryGroupService(OriginEntryGroupService originEntryGroupService)
           
 void setOriginEntryService(OriginEntryService originEntryService)
           
 void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)
           
 void setPreScrubberService(PreScrubberService preScrubberService)
          Sets the preScrubberService attribute value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectorHelperServiceImpl

public CollectorHelperServiceImpl()
Method Detail

loadCollectorFile

public boolean loadCollectorFile(String fileName,
                                 CollectorReportData collectorReportData,
                                 List<CollectorScrubberStatus> collectorScrubberStatuses,
                                 BatchInputFileType collectorInputFileType,
                                 PrintStream originEntryOutputPs)
Parses the given file, validates the batch, stores the entries, and sends email.

Specified by:
loadCollectorFile in interface CollectorHelperService
Parameters:
fileName - - name of file to load (including path)
group - the group into which to persist the origin entries for the collector batch/file
collectorReportData - the object used to store all of the collector status information for reporting
collectorScrubberStatuses - if the collector scrubber is able to be invoked upon this collector batch, then the status info of the collector status run is added to the end of this list
the - output stream to which to store origin entries that properly pass validation
Returns:
boolean - true if load was successful, false if errors were encountered
See Also:
org.kuali.kfs.gl.batch.service.CollectorService#loadCollectorFile(java.lang.String)

loadCollectorBatch

protected boolean loadCollectorBatch(CollectorBatch batch,
                                     String fileName,
                                     int batchIndex,
                                     CollectorReportData collectorReportData,
                                     List<CollectorScrubberStatus> collectorScrubberStatuses,
                                     BatchInputFileType collectorInputFileType,
                                     PrintStream originEntryOutputPs)

attemptToParseEmailAfterParseError

protected String attemptToParseEmailAfterParseError(String fileName)
After a parse error, tries to go through the file to see if the email address can be determined. This method will not throw an exception. It's not doing much right now, just returning null

Parameters:
fileName - the name of the file that a parsing error occurred on
Returns:
the email from the file

doCollectorFileParse

protected List<CollectorBatch> doCollectorFileParse(String fileName,
                                                    org.kuali.rice.kns.util.MessageMap messageMap,
                                                    BatchInputFileType collectorInputFileType,
                                                    CollectorReportData collectorReportData)
Calls batch input service to parse the xml contents into an object. Any errors will be contained in GlobalVariables.MessageMap

Parameters:
fileName - the name of the file to parse
MessageMap - a map of errors resultant from the parsing
Returns:
the CollectorBatch of details parsed from the file

prescrubParsedCollectorBatch

protected void prescrubParsedCollectorBatch(CollectorBatch collectorBatch,
                                            CollectorReportData collectorReportData)

extractChartOfAccountsCode

protected String extractChartOfAccountsCode(Object originEntryOrDetail)

extractAccountNumber

protected String extractAccountNumber(Object originEntryOrDetail)

setChartOfAccountsCode

protected void setChartOfAccountsCode(Object originEntryOrDetail,
                                      String chartOfAccountsCode)

performValidation

public boolean performValidation(CollectorBatch batch)
Validates the contents of a parsed file.

Specified by:
performValidation in interface CollectorHelperService
Parameters:
batch - - batch to validate
Returns:
boolean - true if validation was OK, false if there were errors
See Also:
CollectorHelperService.performValidation(org.kuali.kfs.gl.batch.CollectorBatch)

performValidation

protected boolean performValidation(CollectorBatch batch,
                                    org.kuali.rice.kns.util.MessageMap MessageMap)
Performs the following checks on the collector batch: Any errors will be contained in GlobalVariables.MessageMap

Parameters:
batch - - batch to validate
MessageMap - the map into which to put errors encountered during validation
Returns:
boolean - true if validation was successful, false it not

performUppercasing

protected void performUppercasing(CollectorBatch batch)
Uppercases sub-account, sub-object, and project fields

Parameters:
batch - CollectorBatch with data to uppercase

performCollectorHeaderValidation

protected boolean performCollectorHeaderValidation(CollectorBatch batch,
                                                   org.kuali.rice.kns.util.MessageMap messageMap)

processInterDepartmentalBillingAmounts

protected void processInterDepartmentalBillingAmounts(CollectorBatch batch)
Modifies the amounts in the ID Billing Detail rows, depending on specific business rules. For this default implementation, see the #negateAmountIfNecessary(InterDepartmentalBilling, BalanceTyp, ObjectType, CollectorBatch) method to see how the billing detail amounts are modified.

Parameters:
batch - a CollectorBatch to process

negateAmountIfNecessary

protected void negateAmountIfNecessary(CollectorDetail collectorDetail,
                                       BalanceType balanceTyp,
                                       ObjectType objectType,
                                       CollectorBatch batch)
Negates the amount of the internal departmental billing detail record if necessary. For this default implementation, if the balance type's offset indicator is yes and the object type has a debit indicator, then the amount is negated.

Parameters:
collectorDetail - the collector detail
balanceTyp - the balance type
objectType - the object type
batch - the patch to which the interDepartmentalBilling parameter belongs

getBalanceTypeCode

protected String getBalanceTypeCode(CollectorDetail collectorDetail,
                                    CollectorBatch batch)
Returns the balance type code for the interDepartmentalBilling record. This default implementation will look into the system parameters to determine the balance type

Parameters:
interDepartmentalBilling - a inter departmental billing detail record
batch - the batch to which the interDepartmentalBilling billing belongs
Returns:
the balance type code for the billing detail

duplicateHeaderCheck

protected boolean duplicateHeaderCheck(CollectorBatch batch,
                                       org.kuali.rice.kns.util.MessageMap messageMap)
Checks header against previously loaded batch headers for a duplicate submission.

Parameters:
batch - - batch to check
Returns:
true if header if OK, false if header was used previously

checkForMixedDocumentTypes

protected boolean checkForMixedDocumentTypes(CollectorBatch batch,
                                             org.kuali.rice.kns.util.MessageMap MessageMap)
Iterates through the origin entries and builds a map on the document types. Then checks there was only one document type found.

Parameters:
batch - - batch to check document types
Returns:
true if there is only one document type, false if multiple document types were found.

checkForMixedBalanceTypes

protected boolean checkForMixedBalanceTypes(CollectorBatch batch,
                                            org.kuali.rice.kns.util.MessageMap MessageMap)
Iterates through the origin entries and builds a map on the balance types. Then checks there was only one balance type found.

Parameters:
batch - - batch to check balance types
Returns:
true if there is only one balance type, false if multiple balance types were found

checkDetailKeys

protected boolean checkDetailKeys(CollectorBatch batch,
                                  org.kuali.rice.kns.util.MessageMap MessageMap)
Verifies each detail (id billing) record key has an corresponding gl entry in the same batch. The key is built by joining the values of chart of accounts code, account number, sub account number, object code, and sub object code.

Parameters:
batch - - batch to validate
Returns:
true if all detail records had matching keys, false otherwise

generateOriginEntryMatchingKey

protected String generateOriginEntryMatchingKey(OriginEntryFull entry,
                                                String delimiter)
Generates a String representation of the OriginEntryFull's primary key

Parameters:
entry - origin entry to get key from
delimiter - the String delimiter to separate parts of the key
Returns:
the key as a String

generateCollectorDetailMatchingKey

protected String generateCollectorDetailMatchingKey(CollectorDetail collectorDetail,
                                                    String delimiter)
Generates a String representation of the CollectorDetail's primary key

Parameters:
collectorDetail - collector detail to get key from
delimiter - the String delimiter to separate parts of the key
Returns:
the key as a String

checkTrailerTotals

public boolean checkTrailerTotals(CollectorBatch batch,
                                  CollectorReportData collectorReportData)
Checks the batch total line count and amounts against the trailer. Any errors will be contained in GlobalVariables.MessageMap

Specified by:
checkTrailerTotals in interface CollectorHelperService
Parameters:
batch - batch to check totals for
collectorReportData - collector report data (optional)
Returns:
boolean - true if trailer check was OK, false if totals did not match
See Also:
CollectorHelperService.checkTrailerTotals(org.kuali.kfs.gl.batch.CollectorBatch, org.kuali.kfs.gl.report.CollectorReportData)

checkTrailerTotals

protected boolean checkTrailerTotals(CollectorBatch batch,
                                     CollectorReportData collectorReportData,
                                     org.kuali.rice.kns.util.MessageMap MessageMap)
Checks the batch total line count and amounts against the trailer. Any errors will be contained in GlobalVariables.MessageMap

Parameters:
batch - - batch to check totals for
Returns:
boolean - true if validation was successful, false it not

setCollectorDetailService

public void setCollectorDetailService(CollectorDetailService collectorDetailService)

setOriginEntryGroupService

public void setOriginEntryGroupService(OriginEntryGroupService originEntryGroupService)

setOriginEntryService

public void setOriginEntryService(OriginEntryService originEntryService)

getStagingDirectory

public String getStagingDirectory()
Returns the name of the directory where Collector files are saved

Returns:
the name of the staging directory

setDateTimeService

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

setBatchInputFileService

public void setBatchInputFileService(BatchInputFileService batchInputFileService)

setCollectorScrubberService

public void setCollectorScrubberService(CollectorScrubberService collectorScrubberService)
Sets the collectorScrubberService attribute value.

Parameters:
collectorScrubberService - The collectorScrubberService to set.

setConfigurationService

public void setConfigurationService(org.kuali.rice.kns.service.KualiConfigurationService configurationService)

setParameterService

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

setBatchFileDirectoryName

public void setBatchFileDirectoryName(String batchFileDirectoryName)
Sets the batchFileDirectoryName attribute value.

Parameters:
batchFileDirectoryName - The batchFileDirectoryName to set.

setAccountService

public void setAccountService(AccountService accountService)
Sets the accountService attribute value.

Parameters:
accountService - The accountService to set.

setPreScrubberService

public void setPreScrubberService(PreScrubberService preScrubberService)
Sets the preScrubberService attribute value.

Parameters:
preScrubberService - The preScrubberService to set.


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