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

java.lang.Object
  extended by org.kuali.kfs.gl.batch.service.impl.OrganizationReversionProcessImpl
All Implemented Interfaces:
OrganizationReversionProcess, org.springframework.beans.factory.InitializingBean

@Transactional
public class OrganizationReversionProcessImpl
extends Object
implements OrganizationReversionProcess, org.springframework.beans.factory.InitializingBean

This class actually runs the year end organization reversion process


Field Summary
 String CARRY_FORWARD_OBJECT_CODE
           
 String DEFAULT_DOCUMENT_NUMBER_PREFIX
           
 String DEFAULT_FINANCIAL_BALANCE_TYPE_CODE
           
 String DEFAULT_FINANCIAL_BALANCE_TYPE_CODE_YEAR_END
           
 String DEFAULT_FINANCIAL_DOCUMENT_TYPE_CODE
           
 String DEFAULT_FINANCIAL_SYSTEM_ORIGINATION_CODE
           
 
Constructor Summary
OrganizationReversionProcessImpl()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  void calculateBucketAmounts(Balance bal)
          Depending on the category that this balance belongs to, adds the balance to the appropriate bucket
 void calculateTotals()
          This method calculates the totals for a given unit of work's reversion
protected  void clearCalculationTotals()
          This method clears the unit of work's amounts to what they should be before each category bucket is calculated; specifically, the total available for each category is calculated, and the total available and total reversion are set to the sum of all available from each category bucket.
 void generateCarryForwards(List<OriginEntryFull> originEntriesToWrite)
          If carry forwards need to be generated for this unit of work, this method will generate the origin entries to accomplish those object codes.
 void generateCashReversions(List<OriginEntryFull> originEntriesToWrite)
          This method generates cash reversion origin entries for the current organization reversion, and adds them to the given list
 void generateMany(List<OriginEntryFull> originEntriesToWrite)
          Generates carry forward origin entries on a category by category basis (if the organization reversion record asks for that), assuming carry forwards are required for the current unit of work
 List<OriginEntryFull> generateOutputOriginEntries()
          This method determines which origin entries (reversion, cash reversion, or carry forward) need to be generated for the current unit of work, and then delegates to the origin entry generation methods to create those entries
 void generateReversions(List<OriginEntryFull> originEntriesToWrite)
          If reversions are necessary, this will generate the origin entries for those reversions
 BalanceService getBalanceService()
          Gets the balanceService attribute.
 int getBalancesRead()
          Returns the total number of balances for the previous fiscal year
 int getBalancesSelected()
          Returns the total number of balances selected for inclusion in this process
 String getBatchFileDirectoryName()
          Gets the batchFileDirectoryName attribute.
 OrganizationReversionCategoryLogic getCashOrganizationReversionCategoryLogic()
          Gets the cashOrganizationReversionCategoryLogic attribute.
 List<OrganizationReversionCategory> getCategoryList()
           
 org.kuali.rice.kns.service.KualiConfigurationService getConfigurationService()
          Gets the configurationService attribute.
 org.kuali.rice.kns.service.DateTimeService getDateTimeService()
          Gets the dateTimeService attribute.
protected  OriginEntryFull getEntry()
          This method starts the creation of an origin entry, by setting fields that are the same in every Org Rev origin entries
 FlexibleOffsetAccountService getFlexibleOffsetAccountService()
          Gets the flexibleOffsetAccountService attribute.
 List<OriginEntryFull> getGeneratedOriginEntries()
          Gets the generatedOriginEntries attribute.
 OrganizationReversionService getOrganizationReversionService()
          Gets the organizationReversionService attribute.
 OrganizationReversionUnitOfWorkService getOrgReversionUnitOfWorkService()
          Gets the orgReversionUnitOfWorkService attribute.
 OriginEntryService getOriginEntryService()
          Gets the originEntryService attribute.
 org.kuali.rice.kns.service.ParameterService getParameterService()
          Gets the parameterService attribute.
 org.kuali.rice.kns.service.PersistenceService getPersistenceService()
          Gets the persistenceService attribute.
 PriorYearAccountService getPriorYearAccountService()
          Gets the priorYearAccountService attribute.
 int getRecordsWritten()
          Returns the total number of origin entries written by this process
 OrgReversionUnitOfWork getUnitOfWork()
           
protected  void incrementCount(String countName, int increment)
          Increments one of the totals held in the count map this process uses for reported statistics by a given increment
 void initializeProcess()
          This method initializes several properties needed for the process to run correctly
 boolean isUsePriorYearInformation()
          Gets the usePriorYearInformation attribute.
 void organizationReversionProcess(Map jobParameters, Map<String,Integer> organizationReversionCounts)
          This evilly named method actually runs the organization reversion process.
 void processBalances(Iterator<Balance> balances)
          Given a list of balances, this method generates the origin entries for the organization reversion/carry forward process, and saves those to an initialized origin entry group
protected  void retrieveCurrentReversionAndAccount(Balance bal)
          Given a balance, returns the current organization reversion record and account or prior year account for the balance; it sets them to private properties
 void setBalanceService(BalanceService balanceService)
          Sets the balanceService attribute value.
 void setBatchFileDirectoryName(String batchFileDirectoryName)
          Sets the batchFileDirectoryName attribute value.
 void setCashOrganizationReversionCategoryLogic(OrganizationReversionCategoryLogic cashOrganizationReversionCategoryLogic)
          Sets the cashOrganizationReversionCategoryLogic attribute value.
 void setConfigurationService(org.kuali.rice.kns.service.KualiConfigurationService configurationService)
          Sets the configurationService attribute value.
 void setDateTimeService(org.kuali.rice.kns.service.DateTimeService dateTimeService)
          Sets the dateTimeService attribute value.
 void setFlexibleOffsetAccountService(FlexibleOffsetAccountService flexibleOffsetAccountService)
          Sets the flexibleOffsetAccountService attribute value.
 void setHoldGeneratedOriginEntries(boolean holdGeneratedOriginEntries)
          Sets the holdGeneratedOriginEntries attribute value.
 void setJobParameters(Map jobParameters)
          Sets the jobParameters attribute value.
 void setOrganizationReversionCounts(Map<String,Integer> organizationReversionCounts)
          Sets the organizationReversionCounts attribute value.
 void setOrganizationReversionService(OrganizationReversionService organizationReversionService)
          Sets the organizationReversionService attribute value.
 void setOrgReversionUnitOfWorkService(OrganizationReversionUnitOfWorkService orgReversionUnitOfWorkService)
          Sets the orgReversionUnitOfWorkService attribute value.
 void setOriginEntryService(OriginEntryService originEntryService)
          Sets the originEntryService attribute value.
 void setOutputFileName(String outputFileName)
          Used mainly for unit testing, this method allows a way to change the output group of a org reversion process run
 void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)
          Sets the parameterService attribute value.
 void setPersistenceService(org.kuali.rice.kns.service.PersistenceService persistenceService)
          Sets the persistenceService attribute value.
 void setPriorYearAccountService(PriorYearAccountService priorYearAccountService)
          Sets the priorYearAccountService attribute value.
 void setUnitOfWork(OrgReversionUnitOfWork unitOfWork)
           
 void setUsePriorYearInformation(boolean endOfYear)
          Sets the usePriorYearInformation attribute value.
protected  void summarizeOriginEntries(List<OriginEntryFull> originEntries)
          Summarizes the given origin entries to the ledger report
 void writeLedgerSummaryReport(ReportWriterService reportWriterService)
          Writes out the encapsulated origin entry ledger report to the given reportWriterService
protected  int writeOriginEntries(List<OriginEntryFull> originEntriesToWrite)
          This method writes a list of OriginEntryFulls to a given origin entry group
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CARRY_FORWARD_OBJECT_CODE

public String CARRY_FORWARD_OBJECT_CODE

DEFAULT_FINANCIAL_DOCUMENT_TYPE_CODE

public String DEFAULT_FINANCIAL_DOCUMENT_TYPE_CODE

DEFAULT_FINANCIAL_SYSTEM_ORIGINATION_CODE

public String DEFAULT_FINANCIAL_SYSTEM_ORIGINATION_CODE

DEFAULT_FINANCIAL_BALANCE_TYPE_CODE

public String DEFAULT_FINANCIAL_BALANCE_TYPE_CODE

DEFAULT_FINANCIAL_BALANCE_TYPE_CODE_YEAR_END

public String DEFAULT_FINANCIAL_BALANCE_TYPE_CODE_YEAR_END

DEFAULT_DOCUMENT_NUMBER_PREFIX

public String DEFAULT_DOCUMENT_NUMBER_PREFIX
Constructor Detail

OrganizationReversionProcessImpl

public OrganizationReversionProcessImpl()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception
See Also:
InitializingBean.afterPropertiesSet()

organizationReversionProcess

public void organizationReversionProcess(Map jobParameters,
                                         Map<String,Integer> organizationReversionCounts)
This evilly named method actually runs the organization reversion process.

Specified by:
organizationReversionProcess in interface OrganizationReversionProcess
Parameters:
jobParameters - the parameters used in the process
organizationReversionCounts - a Map of named statistics generated by running the process

processBalances

public void processBalances(Iterator<Balance> balances)
Given a list of balances, this method generates the origin entries for the organization reversion/carry forward process, and saves those to an initialized origin entry group

Specified by:
processBalances in interface OrganizationReversionProcess
Parameters:
balances - an iterator of balances to process; each balance returned by the iterator will be processed by this method

retrieveCurrentReversionAndAccount

protected void retrieveCurrentReversionAndAccount(Balance bal)
                                           throws FatalErrorException
Given a balance, returns the current organization reversion record and account or prior year account for the balance; it sets them to private properties

Parameters:
bal - the balance to find the account/prior year account and organization reversion record for
Throws:
FatalErrorException - if an organization reversion record cannot be found in the database

initializeProcess

public void initializeProcess()
This method initializes several properties needed for the process to run correctly

Specified by:
initializeProcess in interface OrganizationReversionProcess

calculateBucketAmounts

protected void calculateBucketAmounts(Balance bal)
Depending on the category that this balance belongs to, adds the balance to the appropriate bucket

Parameters:
bal - the current balance to process

generateOutputOriginEntries

public List<OriginEntryFull> generateOutputOriginEntries()
                                                  throws FatalErrorException
This method determines which origin entries (reversion, cash reversion, or carry forward) need to be generated for the current unit of work, and then delegates to the origin entry generation methods to create those entries

Specified by:
generateOutputOriginEntries in interface OrganizationReversionProcess
Returns:
a list of OriginEntries which need to be written
Throws:
FatalErrorException - thrown if object codes are missing in any of the generation methods

writeOriginEntries

protected int writeOriginEntries(List<OriginEntryFull> originEntriesToWrite)
This method writes a list of OriginEntryFulls to a given origin entry group

Parameters:
writeGroup - the origin entry group to write to
originEntriesToWrite - a list of origin entry fulls to write
Returns:
the count of origin entries that were written

getEntry

protected OriginEntryFull getEntry()
This method starts the creation of an origin entry, by setting fields that are the same in every Org Rev origin entries

Returns:
an OriginEntryFull partially filled out with constant information

generateCashReversions

public void generateCashReversions(List<OriginEntryFull> originEntriesToWrite)
                            throws FatalErrorException
This method generates cash reversion origin entries for the current organization reversion, and adds them to the given list

Specified by:
generateCashReversions in interface OrganizationReversionProcess
Parameters:
originEntriesToWrite - a list of OriginEntryFulls to stick generated origin entries into
Throws:
FatalErrorException - thrown if an origin entry's object code can't be found

generateMany

public void generateMany(List<OriginEntryFull> originEntriesToWrite)
                  throws FatalErrorException
Generates carry forward origin entries on a category by category basis (if the organization reversion record asks for that), assuming carry forwards are required for the current unit of work

Specified by:
generateMany in interface OrganizationReversionProcess
Parameters:
originEntriesToWrite - a list of origin entries to write, which any generated origin entries should be added to
Throws:
FatalErrorException - thrown if an object code cannot be found

generateCarryForwards

public void generateCarryForwards(List<OriginEntryFull> originEntriesToWrite)
                           throws FatalErrorException
If carry forwards need to be generated for this unit of work, this method will generate the origin entries to accomplish those object codes. Note: this will only be called if the organization reversion record tells the process to munge all carry forwards for all categories together; if the organization reversion record does not call for such a thing, then generateMany will be called

Specified by:
generateCarryForwards in interface OrganizationReversionProcess
Parameters:
originEntriesToWrite - a list of origin entries to write, that any generated origin entries should be added to
Throws:
FatalErrorException - thrown if the current object code can't be found in the database

generateReversions

public void generateReversions(List<OriginEntryFull> originEntriesToWrite)
                        throws FatalErrorException
If reversions are necessary, this will generate the origin entries for those reversions

Specified by:
generateReversions in interface OrganizationReversionProcess
Parameters:
originEntriesToWrite - the list of origin entries to add reversions into
Throws:
FatalErrorException - thrown if object code if the entry can't be found

calculateTotals

public void calculateTotals()
                     throws FatalErrorException
This method calculates the totals for a given unit of work's reversion

Specified by:
calculateTotals in interface OrganizationReversionProcess
Throws:
FatalErrorException

clearCalculationTotals

protected void clearCalculationTotals()
This method clears the unit of work's amounts to what they should be before each category bucket is calculated; specifically, the total available for each category is calculated, and the total available and total reversion are set to the sum of all available from each category bucket. The total carry forward is set to 0.


summarizeOriginEntries

protected void summarizeOriginEntries(List<OriginEntryFull> originEntries)
Summarizes the given origin entries to the ledger report

Parameters:
originEntries - the List of originEntries to summarize

getUnitOfWork

public OrgReversionUnitOfWork getUnitOfWork()

setUnitOfWork

public void setUnitOfWork(OrgReversionUnitOfWork unitOfWork)

getCategoryList

public List<OrganizationReversionCategory> getCategoryList()

getGeneratedOriginEntries

public List<OriginEntryFull> getGeneratedOriginEntries()
Gets the generatedOriginEntries attribute.

Specified by:
getGeneratedOriginEntries in interface OrganizationReversionProcess
Returns:
Returns the generatedOriginEntries.

setHoldGeneratedOriginEntries

public void setHoldGeneratedOriginEntries(boolean holdGeneratedOriginEntries)
Sets the holdGeneratedOriginEntries attribute value.

Specified by:
setHoldGeneratedOriginEntries in interface OrganizationReversionProcess
Parameters:
holdGeneratedOriginEntries - The holdGeneratedOriginEntries to set.

getBalancesRead

public int getBalancesRead()
Returns the total number of balances for the previous fiscal year

Specified by:
getBalancesRead in interface OrganizationReversionProcess
Returns:
the total number of balances for the previous fiscal year

getBalancesSelected

public int getBalancesSelected()
Returns the total number of balances selected for inclusion in this process

Specified by:
getBalancesSelected in interface OrganizationReversionProcess
Returns:
the total number of balances selected for inclusion in this process

getRecordsWritten

public int getRecordsWritten()
Returns the total number of origin entries written by this process

Returns:
the total number of origin entries written by this process

setOutputFileName

public void setOutputFileName(String outputFileName)
Used mainly for unit testing, this method allows a way to change the output group of a org reversion process run

Parameters:
outputGroup -

incrementCount

protected void incrementCount(String countName,
                              int increment)
Increments one of the totals held in the count map this process uses for reported statistics by a given increment

Parameters:
countName - the name of the count to increment
increment - the amount to increment

writeLedgerSummaryReport

public void writeLedgerSummaryReport(ReportWriterService reportWriterService)
Writes out the encapsulated origin entry ledger report to the given reportWriterService

Specified by:
writeLedgerSummaryReport in interface OrganizationReversionProcess
Parameters:
reportWriterService - the report to write the ledger summary report to

getOrganizationReversionService

public OrganizationReversionService getOrganizationReversionService()
Gets the organizationReversionService attribute.

Returns:
Returns the organizationReversionService.

setOrganizationReversionService

public void setOrganizationReversionService(OrganizationReversionService organizationReversionService)
Sets the organizationReversionService attribute value.

Parameters:
organizationReversionService - The organizationReversionService to set.

getBalanceService

public BalanceService getBalanceService()
Gets the balanceService attribute.

Returns:
Returns the balanceService.

setBalanceService

public void setBalanceService(BalanceService balanceService)
Sets the balanceService attribute value.

Parameters:
balanceService - The balanceService to set.

getOriginEntryService

public OriginEntryService getOriginEntryService()
Gets the originEntryService attribute.

Returns:
Returns the originEntryService.

setOriginEntryService

public void setOriginEntryService(OriginEntryService originEntryService)
Sets the originEntryService attribute value.

Parameters:
originEntryService - The originEntryService to set.

getPersistenceService

public org.kuali.rice.kns.service.PersistenceService getPersistenceService()
Gets the persistenceService attribute.

Returns:
Returns the persistenceService.

setPersistenceService

public void setPersistenceService(org.kuali.rice.kns.service.PersistenceService persistenceService)
Sets the persistenceService attribute value.

Parameters:
persistenceService - The persistenceService to set.

getDateTimeService

public org.kuali.rice.kns.service.DateTimeService getDateTimeService()
Gets the dateTimeService attribute.

Returns:
Returns the dateTimeService.

setDateTimeService

public void setDateTimeService(org.kuali.rice.kns.service.DateTimeService dateTimeService)
Sets the dateTimeService attribute value.

Parameters:
dateTimeService - The dateTimeService to set.

getPriorYearAccountService

public PriorYearAccountService getPriorYearAccountService()
Gets the priorYearAccountService attribute.

Returns:
Returns the priorYearAccountService.

setPriorYearAccountService

public void setPriorYearAccountService(PriorYearAccountService priorYearAccountService)
Sets the priorYearAccountService attribute value.

Parameters:
priorYearAccountService - The priorYearAccountService to set.

getOrgReversionUnitOfWorkService

public OrganizationReversionUnitOfWorkService getOrgReversionUnitOfWorkService()
Gets the orgReversionUnitOfWorkService attribute.

Returns:
Returns the orgReversionUnitOfWorkService.

setOrgReversionUnitOfWorkService

public void setOrgReversionUnitOfWorkService(OrganizationReversionUnitOfWorkService orgReversionUnitOfWorkService)
Sets the orgReversionUnitOfWorkService attribute value.

Parameters:
orgReversionUnitOfWorkService - The orgReversionUnitOfWorkService to set.

getFlexibleOffsetAccountService

public FlexibleOffsetAccountService getFlexibleOffsetAccountService()
Gets the flexibleOffsetAccountService attribute.

Returns:
Returns the flexibleOffsetAccountService.

setFlexibleOffsetAccountService

public void setFlexibleOffsetAccountService(FlexibleOffsetAccountService flexibleOffsetAccountService)
Sets the flexibleOffsetAccountService attribute value.

Parameters:
flexibleOffsetAccountService - The flexibleOffsetAccountService to set.

getParameterService

public org.kuali.rice.kns.service.ParameterService getParameterService()
Gets the parameterService attribute.

Returns:
Returns the parameterService.

setParameterService

public void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)
Sets the parameterService attribute value.

Parameters:
parameterService - The parameterService to set.

getConfigurationService

public org.kuali.rice.kns.service.KualiConfigurationService getConfigurationService()
Gets the configurationService attribute.

Returns:
Returns the configurationService.

setConfigurationService

public void setConfigurationService(org.kuali.rice.kns.service.KualiConfigurationService configurationService)
Sets the configurationService attribute value.

Parameters:
configurationService - The configurationService to set.

isUsePriorYearInformation

public boolean isUsePriorYearInformation()
Gets the usePriorYearInformation attribute.

Returns:
Returns the usePriorYearInformation.

setUsePriorYearInformation

public void setUsePriorYearInformation(boolean endOfYear)
Sets the usePriorYearInformation attribute value.

Parameters:
usePriorYearInformation - The usePriorYearInformation to set.

getCashOrganizationReversionCategoryLogic

public OrganizationReversionCategoryLogic getCashOrganizationReversionCategoryLogic()
Gets the cashOrganizationReversionCategoryLogic attribute.

Returns:
Returns the cashOrganizationReversionCategoryLogic.

setCashOrganizationReversionCategoryLogic

public void setCashOrganizationReversionCategoryLogic(OrganizationReversionCategoryLogic cashOrganizationReversionCategoryLogic)
Sets the cashOrganizationReversionCategoryLogic attribute value.

Parameters:
cashOrganizationReversionCategoryLogic - The cashOrganizationReversionCategoryLogic to set.

getBatchFileDirectoryName

public String getBatchFileDirectoryName()
Gets the batchFileDirectoryName attribute.

Returns:
Returns the batchFileDirectoryName.

setBatchFileDirectoryName

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

Parameters:
batchFileDirectoryName - The batchFileDirectoryName to set.

setJobParameters

public void setJobParameters(Map jobParameters)
Sets the jobParameters attribute value.

Parameters:
jobParameters - The jobParameters to set.

setOrganizationReversionCounts

public void setOrganizationReversionCounts(Map<String,Integer> organizationReversionCounts)
Sets the organizationReversionCounts attribute value.

Parameters:
organizationReversionCounts - The organizationReversionCounts to set.


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