org.kuali.kfs.sys.businessobject
Class AccountingLineOverride

java.lang.Object
  extended by org.kuali.kfs.sys.businessobject.AccountingLineOverride

public class AccountingLineOverride
extends Object

This class helps implement AccountingLine overrides. It is not persisted itself, but it simplifies working with the persisted codes. Instances break the code into components. Static methods help with the AccountingLine.


Nested Class Summary
static class AccountingLineOverride.CODE
          These codes are the way the override is persisted in the AccountingLine.
static class AccountingLineOverride.COMPONENT
          These are the somewhat independent components of an override.
 
Field Summary
static List<String> REFRESH_FIELDS
          The names of the AccountingLine properties that the processForOutput() and determineNeededOverrides() methods use.
 
Method Summary
static AccountingLineOverride determineNeededOverrides(AccountingLine line)
          Determines what overrides the given line needs.
 String getCode()
          Gets the code of this override.
 boolean hasComponent(Integer component)
          Checks whether this override contains the given component.
static boolean isValidCode(String code)
          Returns whether the given String is a valid override code.
static boolean isValidComponentSet(Integer[] components)
          Returns whether the given Integers are a valid set of components.
 boolean isValidMask(AccountingLineOverride mask)
          Returns whether this override, when masked by the given override, is valid.
 AccountingLineOverride mask(AccountingLineOverride mask)
          Returns the AccountingLineOverride that has the components of this AccountingLineOverride minus any components not in the given mask.
static boolean needsExpiredAccountOverride(Account account)
          Returns whether the given account needs an expired account override.
static boolean needsNonFringAccountOverride(Account account)
          Returns whether the given account needs an expired account override.
static boolean needsObjectBudgetOverride(Account account, ObjectCode objectCode)
          Returns whether the given object code needs an object budget override
static void populateFromInput(AccountingLine line)
          On the given AccountingLine, converts override input checkboxes from a Struts Form into a persistable override code.
static void processForOutput(AccountingLine line)
          Prepares the given AccountingLine in a Struts Action for display by a JSP.
 String toString()
           
static AccountingLineOverride valueOf(Integer[] components)
          Factory method from components.
static AccountingLineOverride valueOf(Set components)
           
static AccountingLineOverride valueOf(String code)
          Factory method from code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REFRESH_FIELDS

public static final List<String> REFRESH_FIELDS
The names of the AccountingLine properties that the processForOutput() and determineNeededOverrides() methods use. Callers of those methods may need to refresh these fields from OJB.

Method Detail

hasComponent

public boolean hasComponent(Integer component)
Checks whether this override contains the given component.

Parameters:
component -
Returns:
whether this override contains the given component.

getCode

public String getCode()
Gets the code of this override.

Returns:
the code of this override.

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

mask

public AccountingLineOverride mask(AccountingLineOverride mask)
Returns the AccountingLineOverride that has the components of this AccountingLineOverride minus any components not in the given mask. This is like &(a bit-wise and), if the components were bits.

Parameters:
mask -
Returns:
the AccountingLineOverride that has the components of this AccountingLineOverride minus any components not in the given mask.
Throws:
IllegalArgumentException - if there is no such valid combination of components

isValidMask

public boolean isValidMask(AccountingLineOverride mask)
Returns whether this override, when masked by the given override, is valid. Some combinations of components have no override code defined.

Parameters:
mask -
Returns:
whether this override, when masked by the given override, is valid.

isValidCode

public static boolean isValidCode(String code)
Returns whether the given String is a valid override code.

Parameters:
code -
Returns:
whether the given String is a valid override code.

isValidComponentSet

public static boolean isValidComponentSet(Integer[] components)
Returns whether the given Integers are a valid set of components. Some combinations of components are invalid and have no code defined.

Parameters:
components -
Returns:
whether the given Integers are a valid set of components.

valueOf

public static AccountingLineOverride valueOf(String code)
Factory method from code.

Parameters:
code - the override code
Returns:
the AccountingLineOverride instance corresponding to the given code.
Throws:
IllegalArgumentException - if the given code is not valid

valueOf

public static AccountingLineOverride valueOf(Integer[] components)
Factory method from components.

Parameters:
components - the override components, treated as a set
Returns:
the AccountingLineOverride instance corresponding to the given component set.
Throws:
IllegalArgumentException - if the given set of components is not valid

valueOf

public static AccountingLineOverride valueOf(Set components)

populateFromInput

public static void populateFromInput(AccountingLine line)
On the given AccountingLine, converts override input checkboxes from a Struts Form into a persistable override code.

Parameters:
line -

processForOutput

public static void processForOutput(AccountingLine line)
Prepares the given AccountingLine in a Struts Action for display by a JSP. This means converting the override code to checkboxes for display and input, as well as analysing the accounting line and determining which override checkboxes are needed.

Parameters:
line -

determineNeededOverrides

public static AccountingLineOverride determineNeededOverrides(AccountingLine line)
Determines what overrides the given line needs.

Parameters:
line -
Returns:
what overrides the given line needs.

needsExpiredAccountOverride

public static boolean needsExpiredAccountOverride(Account account)
Returns whether the given account needs an expired account override.

Parameters:
account -
Returns:
whether the given account needs an expired account override.

needsNonFringAccountOverride

public static boolean needsNonFringAccountOverride(Account account)
Returns whether the given account needs an expired account override.

Parameters:
account -
Returns:
whether the given account needs an expired account override.

needsObjectBudgetOverride

public static boolean needsObjectBudgetOverride(Account account,
                                                ObjectCode objectCode)
Returns whether the given object code needs an object budget override

Parameters:
account -
Returns:
whether the given object code needs an object budget override


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