org.kuali.kfs.module.ld.batch.service.impl
Class LaborScrubberProcess

java.lang.Object
  extended by org.kuali.kfs.module.ld.batch.service.impl.LaborScrubberProcess

public class LaborScrubberProcess
extends Object

This class has the logic for the scrubber. It is required because the scrubber process needs instance variables. Instance variables in a spring service are shared between all code calling the service. This will make sure each run of the scrubber has it's own instance variables instead of being shared.


Constructor Summary
LaborScrubberProcess(FlexibleOffsetAccountService flexibleOffsetAccountService, LaborAccountingCycleCachingService laborAccountingCycleCachingService, LaborOriginEntryService laborOriginEntryService, OriginEntryGroupService originEntryGroupService, org.kuali.rice.kns.service.DateTimeService dateTimeService, OffsetDefinitionService offsetDefinitionService, ObjectCodeService objectCodeService, org.kuali.rice.kns.service.KualiConfigurationService kualiConfigurationService, UniversityDateDao universityDateDao, org.kuali.rice.kns.service.PersistenceService persistenceService, ScrubberValidator scrubberValidator, String batchFileDirectoryName, DocumentNumberAwareReportWriterService laborMainReportWriterService, DocumentNumberAwareReportWriterService laborLedgerReportWriterService, ReportWriterService laborBadBalanceTypeReportWriterService, ReportWriterService laborErrorListingReportWriterService, DocumentNumberAwareReportWriterService laborGeneratedTransactionsReportWriterService, ReportWriterService laborDemergerReportWriterService, PreScrubberService laborPreScrubberService, DocumentNumberAwareReportWriterService laborPreScrubberReportWriterService, org.kuali.rice.kns.service.ParameterService parameterService)
          These parameters are all the dependencies.
 
Method Summary
protected  void buildScrubbedEntry(LaborOriginEntry unscrubbedEntry, LaborOriginEntry scrubbedEntry)
           
 Date calculateRunDate(Date currentDate)
          This method modifies the run date if it is before the cutoff time specified by calling the setCutoffTimeForPreviousDay method.
protected  boolean checkEntry(LaborOriginEntry validEntry, LaborOriginEntry errorEntry, String documentTypeCode)
           
protected  void createOutputEntry(LaborOriginEntry entry, PrintStream ps)
           
protected  void createOutputEntry(String line, PrintStream ps)
           
protected  void generateScrubberBadBalanceTypeListingReport()
          Generates a transaction listing report for labor origin entries with bad balance types
protected  void generateScrubberErrorListingReport(String errorFileName)
          Generates a transaction listing report for labor origin entries with errors
protected  void generateScrubberTransactionsOnline()
          Generates a transaction listing report for labor origin entries that were valid
protected  String getOffsetMessage()
          Generate the offset message with the flag at the end
protected  String getTransactionType(LaborOriginEntry transaction)
          Determine the type of the transaction by looking at attributes
protected  void initCutoffTime()
           
protected  boolean isCurrentDateBeforeCutoff(Calendar currentCal)
           
protected  boolean isFatal(List<Message> errors)
           
 void performDemerger()
          The demerger process reads all of the documents in the error group, then moves all of the original entries for that document from the valid group to the error group.
protected  void processGroup()
          This will process a group of origin entries.
 void scrubEntries()
           
 void scrubEntries(boolean reportOnlyMode, String documentNumber)
          Scrub all entries that need it in origin entry.
 void scrubGroupReportOnly(String fileName, String documentNumber)
          Scrub this single group read only.
protected  void setCutoffTime(String cutoffTime)
           
protected  void setCutoffTimeForPreviousDay(int hourOfDay, int minuteOfDay, int secondOfDay)
           
protected  void setDescriptions()
          Get all the transaction descriptions from the param table
protected  void setOffsetString()
          Generate the flag for the end of specific descriptions.
 void unsetCutoffTimeForPreviousDay()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LaborScrubberProcess

public LaborScrubberProcess(FlexibleOffsetAccountService flexibleOffsetAccountService,
                            LaborAccountingCycleCachingService laborAccountingCycleCachingService,
                            LaborOriginEntryService laborOriginEntryService,
                            OriginEntryGroupService originEntryGroupService,
                            org.kuali.rice.kns.service.DateTimeService dateTimeService,
                            OffsetDefinitionService offsetDefinitionService,
                            ObjectCodeService objectCodeService,
                            org.kuali.rice.kns.service.KualiConfigurationService kualiConfigurationService,
                            UniversityDateDao universityDateDao,
                            org.kuali.rice.kns.service.PersistenceService persistenceService,
                            ScrubberValidator scrubberValidator,
                            String batchFileDirectoryName,
                            DocumentNumberAwareReportWriterService laborMainReportWriterService,
                            DocumentNumberAwareReportWriterService laborLedgerReportWriterService,
                            ReportWriterService laborBadBalanceTypeReportWriterService,
                            ReportWriterService laborErrorListingReportWriterService,
                            DocumentNumberAwareReportWriterService laborGeneratedTransactionsReportWriterService,
                            ReportWriterService laborDemergerReportWriterService,
                            PreScrubberService laborPreScrubberService,
                            DocumentNumberAwareReportWriterService laborPreScrubberReportWriterService,
                            org.kuali.rice.kns.service.ParameterService parameterService)
These parameters are all the dependencies.

Method Detail

scrubGroupReportOnly

public void scrubGroupReportOnly(String fileName,
                                 String documentNumber)
Scrub this single group read only. This will only output the scrubber report. It won't output any other groups.

Parameters:
group -

scrubEntries

public void scrubEntries()

scrubEntries

public void scrubEntries(boolean reportOnlyMode,
                         String documentNumber)
Scrub all entries that need it in origin entry. Put valid scrubbed entries in a scrubber valid group, put errors in a scrubber error group, and transactions with an expired account in the scrubber expired account group.


getTransactionType

protected String getTransactionType(LaborOriginEntry transaction)
Determine the type of the transaction by looking at attributes

Parameters:
transaction - Transaction to identify
Returns:
CE (Cost share encumbrance, O (Offset), C (apitalization), L (Liability), T (Transfer), CS (Cost Share), X (Other)

processGroup

protected void processGroup()
This will process a group of origin entries. The COBOL code was refactored a lot to get this so there isn't a 1 to 1 section of Cobol relating to this.

Parameters:
originEntryGroup - Group to process

isFatal

protected boolean isFatal(List<Message> errors)

setDescriptions

protected void setDescriptions()
Get all the transaction descriptions from the param table


setOffsetString

protected void setOffsetString()
Generate the flag for the end of specific descriptions. This will be used in the demerger step


getOffsetMessage

protected String getOffsetMessage()
Generate the offset message with the flag at the end

Returns:
Offset message

setCutoffTimeForPreviousDay

protected void setCutoffTimeForPreviousDay(int hourOfDay,
                                           int minuteOfDay,
                                           int secondOfDay)

setCutoffTime

protected void setCutoffTime(String cutoffTime)

unsetCutoffTimeForPreviousDay

public void unsetCutoffTimeForPreviousDay()

calculateRunDate

public Date calculateRunDate(Date currentDate)
This method modifies the run date if it is before the cutoff time specified by calling the setCutoffTimeForPreviousDay method. See KULRNE-70 This method is public to facilitate unit testing

Parameters:
currentDate -
Returns:

isCurrentDateBeforeCutoff

protected boolean isCurrentDateBeforeCutoff(Calendar currentCal)

initCutoffTime

protected void initCutoffTime()

buildScrubbedEntry

protected void buildScrubbedEntry(LaborOriginEntry unscrubbedEntry,
                                  LaborOriginEntry scrubbedEntry)

performDemerger

public void performDemerger()
The demerger process reads all of the documents in the error group, then moves all of the original entries for that document from the valid group to the error group. It does not move generated entries to the error group. Those are deleted. It also modifies the doc number and origin code of cost share transfers.

Parameters:
errorGroup -
validGroup -

createOutputEntry

protected void createOutputEntry(LaborOriginEntry entry,
                                 PrintStream ps)
                          throws IOException
Throws:
IOException

createOutputEntry

protected void createOutputEntry(String line,
                                 PrintStream ps)
                          throws IOException
Throws:
IOException

checkEntry

protected boolean checkEntry(LaborOriginEntry validEntry,
                             LaborOriginEntry errorEntry,
                             String documentTypeCode)

generateScrubberTransactionsOnline

protected void generateScrubberTransactionsOnline()
Generates a transaction listing report for labor origin entries that were valid


generateScrubberBadBalanceTypeListingReport

protected void generateScrubberBadBalanceTypeListingReport()
Generates a transaction listing report for labor origin entries with bad balance types


generateScrubberErrorListingReport

protected void generateScrubberErrorListingReport(String errorFileName)
Generates a transaction listing report for labor origin entries with errors



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