org.kuali.kfs.gl.document
Class CorrectionDocumentUtils

java.lang.Object
  extended by org.kuali.kfs.gl.document.CorrectionDocumentUtils

public class CorrectionDocumentUtils
extends Object

This class provides utility methods for the correction document


Field Summary
static int DEFAULT_RECORD_COUNT_FUNCTIONALITY_LIMIT
           
static int DEFAULT_RECORDS_PER_PAGE
           
static int RECORD_COUNT_FUNCTIONALITY_LIMIT_IS_NONE
          The GLCP document will always be on restricted functionality mode, regardless of input group size
static int RECORD_COUNT_FUNCTIONALITY_LIMIT_IS_UNLIMITED
          The GLCP document will never be on restricted functionality mode, regardless of input group size
 
Constructor Summary
CorrectionDocumentUtils()
           
 
Method Summary
static OriginEntryFull applyCriteriaToEntry(OriginEntryFull entry, boolean matchCriteriaOnly, List<CorrectionChangeGroup> changeCriteriaGroups)
          Applies a list of change criteria groups to an origin entry.
static boolean compareStringData(CorrectionCriteria cc, String fieldTestValue, String fieldActualValueString)
          Compares string data
static boolean compareTo(int compareTo, String operatorCode)
          Returns true is compared indicator matches
static String convertToString(Object fieldActualValue, String fieldType)
          Converts the value into a string, with the appropriate formatting
static void copyStatisticsToDocument(OriginEntryStatistics statistics, GeneralLedgerCorrectionProcessDocument document)
          Sets document with the statistics data
static boolean doesEntryMatchAnyCriteriaGroups(OriginEntryFull entry, Collection<CorrectionChangeGroup> groups)
          Returns whether the entry matches any of the criteria groups
static boolean entryMatchesCriteria(CorrectionCriteria cc, OriginEntryFull oe)
          Returns whether an origin entry matches the passed in criteria.
static int getRecordCountFunctionalityLimit()
          This method returns the limit for record count functionality
static int getRecordsPerPage()
          This method returns the number of records per page
static OriginEntryStatistics getStatistics(Collection<OriginEntryFull> entries)
          Computes the statistics (credit amount, debit amount, row count) of a collection of origin entries.
static boolean isBudget(OriginEntryFull oe)
          Returns whether the origin entry represents a budget
static boolean isCredit(OriginEntryFull oe)
          Returns whether the origin entry represents a credit
static boolean isDebit(OriginEntryFull oe)
          Returns whether the origin entry represents a debit
static boolean isRestrictedFunctionalityMode(int inputGroupSize, int recordCountFunctionalityLimit)
          This method returns true if input group size is greater than or equal to record count functionality limit
static void setAllEntryIdsToNull(Collection<OriginEntryFull> originEntries)
          Sets all origin entries' entry IDs to null within the collection.
static void setSequentialEntryIds(Collection<OriginEntryFull> originEntries)
          Sets all origin entries' entry IDs to be sequential starting from 0 in the collection
static void updateStatisticsWithEntry(OriginEntryFull entry, OriginEntryStatistics statistics)
          Given an instance of statistics, it adds information from the passed in entry to the statistics
static boolean validCorrectionChangeForAdding(CorrectionChange correctionChange)
          When a correction change is about to be added to a group, this will check if it is valid, meaning that the field name is not blank
static boolean validCorrectionChangeForSaving(CorrectionChange correctionChange)
          When a document is about to be saved, this will check if it is valid, meaning that the field name and value are both blank
static boolean validCorrectionCriteriaForAdding(CorrectionCriteria correctionCriteria)
          When a correction criterion is about to be added to a group, this will check if it is valid, meaning that the field name is not blank
static boolean validCorrectionCriteriaForSaving(CorrectionCriteria correctionCriteria)
          When a document is about to be saved, this will check if it is valid, meaning that the field name and value are both blank
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RECORD_COUNT_FUNCTIONALITY_LIMIT

public static final int DEFAULT_RECORD_COUNT_FUNCTIONALITY_LIMIT
See Also:
Constant Field Values

RECORD_COUNT_FUNCTIONALITY_LIMIT_IS_NONE

public static final int RECORD_COUNT_FUNCTIONALITY_LIMIT_IS_NONE
The GLCP document will always be on restricted functionality mode, regardless of input group size

See Also:
Constant Field Values

RECORD_COUNT_FUNCTIONALITY_LIMIT_IS_UNLIMITED

public static final int RECORD_COUNT_FUNCTIONALITY_LIMIT_IS_UNLIMITED
The GLCP document will never be on restricted functionality mode, regardless of input group size

See Also:
Constant Field Values

DEFAULT_RECORDS_PER_PAGE

public static final int DEFAULT_RECORDS_PER_PAGE
See Also:
Constant Field Values
Constructor Detail

CorrectionDocumentUtils

public CorrectionDocumentUtils()
Method Detail

getRecordCountFunctionalityLimit

public static int getRecordCountFunctionalityLimit()
This method returns the limit for record count functionality

Returns:
limit for record count functionality

getRecordsPerPage

public static int getRecordsPerPage()
This method returns the number of records per page

Returns:
number of records per page

isRestrictedFunctionalityMode

public static boolean isRestrictedFunctionalityMode(int inputGroupSize,
                                                    int recordCountFunctionalityLimit)
This method returns true if input group size is greater than or equal to record count functionality limit

Parameters:
inputGroupSize - size of input groups
recordCountFunctionalityLimit - limit for record count functionality
Returns:
true if input group size is greater than or equal to record count functionality limit

validCorrectionCriteriaForAdding

public static boolean validCorrectionCriteriaForAdding(CorrectionCriteria correctionCriteria)
When a correction criterion is about to be added to a group, this will check if it is valid, meaning that the field name is not blank

Parameters:
correctionCriteria - validated correction criteria
Returns:
true if correction criteria is valid for adding

validCorrectionCriteriaForSaving

public static boolean validCorrectionCriteriaForSaving(CorrectionCriteria correctionCriteria)
When a document is about to be saved, this will check if it is valid, meaning that the field name and value are both blank

Parameters:
correctionCriteria - validated correction criteria
Returns:
true if correction criteria is valid for saving

validCorrectionChangeForAdding

public static boolean validCorrectionChangeForAdding(CorrectionChange correctionChange)
When a correction change is about to be added to a group, this will check if it is valid, meaning that the field name is not blank

Parameters:
correctionChange - validated correction change
Returns:
true is correction change is valid for adding

validCorrectionChangeForSaving

public static boolean validCorrectionChangeForSaving(CorrectionChange correctionChange)
When a document is about to be saved, this will check if it is valid, meaning that the field name and value are both blank

Parameters:
correctionCriteria - validated correction criteria
Returns:
true if correction change is valid for saving (i.e. correction change is null or correction field name and field value are blank)

setAllEntryIdsToNull

public static void setAllEntryIdsToNull(Collection<OriginEntryFull> originEntries)
Sets all origin entries' entry IDs to null within the collection.

Parameters:
originEntries - collection of origin entries

setSequentialEntryIds

public static void setSequentialEntryIds(Collection<OriginEntryFull> originEntries)
Sets all origin entries' entry IDs to be sequential starting from 0 in the collection

Parameters:
originEntries - collection of origin entries

entryMatchesCriteria

public static boolean entryMatchesCriteria(CorrectionCriteria cc,
                                           OriginEntryFull oe)
Returns whether an origin entry matches the passed in criteria. If both the criteria and actual value are both String types and are empty, null, or whitespace only, then they will match.

Parameters:
cc - correction criteria to test against origin entry
oe - origin entry to test
Returns:
true if origin entry matches the passed in criteria

compareStringData

public static boolean compareStringData(CorrectionCriteria cc,
                                        String fieldTestValue,
                                        String fieldActualValueString)
Compares string data

Parameters:
cc - criteria
fieldTestValue - test value
fieldActualValueString - actual value
Returns:
flag true if matches with criteria

compareTo

public static boolean compareTo(int compareTo,
                                String operatorCode)
Returns true is compared indicator matches

Parameters:
compareTo -
operatorCode -
Returns:

convertToString

public static String convertToString(Object fieldActualValue,
                                     String fieldType)
Converts the value into a string, with the appropriate formatting

Parameters:
fieldActualValue - actual field value
fieldType - field type (i.e. "String", "Integer", "Date")
Returns:
String object value as a string

applyCriteriaToEntry

public static OriginEntryFull applyCriteriaToEntry(OriginEntryFull entry,
                                                   boolean matchCriteriaOnly,
                                                   List<CorrectionChangeGroup> changeCriteriaGroups)
Applies a list of change criteria groups to an origin entry. Note that the returned value, if not null, is a reference to the same instance as the origin entry passed in (i.e. intentional side effect)

Parameters:
entry - origin entry
matchCriteriaOnly - if true and no criteria match, then this method will return null
changeCriteriaGroups - list of change criteria groups to apply
Returns:
the passed in entry instance, or null (see above)

doesEntryMatchAnyCriteriaGroups

public static boolean doesEntryMatchAnyCriteriaGroups(OriginEntryFull entry,
                                                      Collection<CorrectionChangeGroup> groups)
Returns whether the entry matches any of the criteria groups

Parameters:
entry - origin entry
groups - collection of correction change group
Returns:
true if origin entry matches any of the criteria groups

getStatistics

public static OriginEntryStatistics getStatistics(Collection<OriginEntryFull> entries)
Computes the statistics (credit amount, debit amount, row count) of a collection of origin entries.

Parameters:
entries - list of orgin entry entries
Returns:
OriginEntryStatistics statistics (credit amount, debit amount, row count) of a collection of origin entries.

isDebit

public static boolean isDebit(OriginEntryFull oe)
Returns whether the origin entry represents a debit

Parameters:
oe - origin entry
Returns:
true if origin entry represents a debit

isBudget

public static boolean isBudget(OriginEntryFull oe)
Returns whether the origin entry represents a budget

Parameters:
oe - origin entry
Returns:
true if origin entry represents a budget

isCredit

public static boolean isCredit(OriginEntryFull oe)
Returns whether the origin entry represents a credit

Parameters:
oe - origin entry
Returns:
true if origin entry represents a credit

updateStatisticsWithEntry

public static void updateStatisticsWithEntry(OriginEntryFull entry,
                                             OriginEntryStatistics statistics)
Given an instance of statistics, it adds information from the passed in entry to the statistics

Parameters:
entry - origin entry
statistics - adds statistics from the passed in origin entry to the passed in statistics

copyStatisticsToDocument

public static void copyStatisticsToDocument(OriginEntryStatistics statistics,
                                            GeneralLedgerCorrectionProcessDocument document)
Sets document with the statistics data

Parameters:
statistics - origin entry statistics that are being used to set document
document - document with statistic information being set


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