org.kuali.kfs.sys.document.authorization
Class AccountingLineAuthorizerBase

java.lang.Object
  extended by org.kuali.kfs.sys.document.authorization.AccountingLineAuthorizerBase
All Implemented Interfaces:
AccountingLineAuthorizer
Direct Known Subclasses:
AdvanceDepositAccountingLineAuthorizer, AssetPaymentAccountingLineAuthorizer, BudgetAdjustmentAccountingLineAuthorizer, DisbursementVoucherAccountingLineAuthorizer, FinancialProcessingAccountingLineAuthorizer, LaborExpenseTransferAccountingLineAuthorizer, PurapAccountingLineAuthorizer

public class AccountingLineAuthorizerBase
extends Object
implements AccountingLineAuthorizer

The default implementation of AccountingLineAuthorizer


Constructor Summary
AccountingLineAuthorizerBase()
           
 
Method Summary
protected  boolean approvedForUnqualifiedEditing(AccountingDocument accountingDocument, AccountingLine accountingLine, String accountingLineCollectionProperty, boolean currentUserIsDocumentInitiator)
          Determines if the given line is editable, no matter what a KIM check would say about line editability.
 boolean determineEditPermissionOnField(AccountingDocument accountingDocument, AccountingLine accountingLine, String accountingLineCollectionProperty, String fieldName, boolean editablePage)
          Allows the overriding of whether a field on an accounting line is editable or not
 boolean determineEditPermissionOnLine(AccountingDocument accountingDocument, AccountingLine accountingLine, String accountingLineCollectionProperty, boolean currentUserIsDocumentInitiator, boolean pageIsEditable)
          A hook to decide, pre-KIM check, if there's an edit permission on the given accounting line
protected  String getActionInfixForExtantAccountingLine(AccountingLine accountingLine, String accountingLinePropertyName)
          Gets the "action infix" for the given accounting line which already exists on the document, so that the action knows it is supposed to add to source vs.
protected  String getActionInfixForNewAccountingLine(AccountingLine accountingLine, String accountingLinePropertyName)
          Gets the "action infix" for the given accounting line, so that the action knows it is supposed to add to source vs.
protected  String getActionLabel(String messageKey, Object... values)
          get a label for an action with the specified message key and values
protected  Map<String,AccountingLineViewAction> getActionMap(AccountingLineRenderingContext accountingLineRenderingContext, String accountingLinePropertyName, Integer accountingLineIndex, String groupTitle)
          collection the actions that are allowed for the given accounting line
 List<AccountingLineViewAction> getActions(AccountingDocument accountingDocument, AccountingLineRenderingContext accountingLineRenderingContext, String accountingLinePropertyName, Integer accountingLineIndex, org.kuali.rice.kim.bo.Person currentUser, String groupTitle)
          Returns the basic actions - add for new lines, delete and balance inquiry for existing lines
protected  AccountingLineViewAction getAddAction(AccountingLine accountingLine, String accountingLinePropertyName, String groupTitle)
          construct the add action for the given accounting line, typically, a new accounting line
protected  String getAddMethod(AccountingLine accountingLine, String accountingLineProperty)
          Builds the action method name of the method that adds accounting lines for this group
protected  AccountingLineViewAction getBalanceInquiryAction(AccountingLine accountingLine, String accountingLinePropertyName, Integer accountingLineIndex, String groupTitle)
          construct the balance inquiry action for the given accounting line
protected  String getBalanceInquiryMethod(AccountingLine accountingLine, String accountingLineProperty, Integer accountingLineIndex)
          Builds the action method name of the method that performs a balance inquiry on accounting lines for this group
protected  AccountingLineViewAction getDeleteAction(AccountingLine accountingLine, String accountingLinePropertyName, Integer accountingLineIndex, String groupTitle)
          construct the delete action for the given accounting line
protected  String getDeleteLineMethod(AccountingLine accountingLine, String accountingLineProperty, Integer accountingLineIndex)
          Builds the action method name of the method that deletes accounting lines for this group
protected  String getFieldName(AccountingLineViewField field)
          get the full property name of the given field
protected  String getKFSImagePath()
           
protected  String getKimHappyPropertyNameForField(String convertedName)
           
protected  String getRiceImagePath()
           
 Set<String> getUnviewableBlocks(AccountingDocument accountingDocument, AccountingLine accountingLine, boolean newLine, org.kuali.rice.kim.bo.Person currentUser)
          Returns a new empty HashSet
 boolean hasEditPermissionOnAccountingLine(AccountingDocument accountingDocument, AccountingLine accountingLine, String accountingLineCollectionProperty, org.kuali.rice.kim.bo.Person currentUser, boolean pageIsEditable)
          Determine whether the current user has permission to edit the given accounting line as a whole
 boolean hasEditPermissionOnField(AccountingDocument accountingDocument, AccountingLine accountingLine, String accountingLineCollectionProperty, String fieldName, boolean editableLine, boolean editablePage, org.kuali.rice.kim.bo.Person currentUser)
          determine whether the current user has permission to edit the given field in the given accounting line
protected  boolean isErrorMapContainingErrorsOnLine(String accountingLinePropertyName)
          Determines if the error map contains any errors which exist on the currently rendered accounting line
 boolean isGroupEditable(AccountingDocument accountingDocument, List<? extends AccountingLineRenderingContext> accountingLineRenderingContexts, org.kuali.rice.kim.bo.Person currentUser)
          Determines if any entire group is rendered as editable, which means that a new line will appear
 boolean renderNewLine(AccountingDocument accountingDocument, String accountingGroupProperty)
          Determines if new lines should be rendered for the given accounting line group (identified by its property name)
protected  String replaceCollectionElementsWithPlurals(String name)
          Replaces references to collection elements to their respective plural names WARNING: this method is totally lame and I for one wished it didn't have to exist
protected  String stripDocumentPrefixFromName(String name)
          Strips "document." and everything before from the property name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccountingLineAuthorizerBase

public AccountingLineAuthorizerBase()
Method Detail

getActions

public final List<AccountingLineViewAction> getActions(AccountingDocument accountingDocument,
                                                       AccountingLineRenderingContext accountingLineRenderingContext,
                                                       String accountingLinePropertyName,
                                                       Integer accountingLineIndex,
                                                       org.kuali.rice.kim.bo.Person currentUser,
                                                       String groupTitle)
Returns the basic actions - add for new lines, delete and balance inquiry for existing lines

Specified by:
getActions in interface AccountingLineAuthorizer
Parameters:
accountingDocument - the accounting document the line to authorize is owned by
accountingLineRenderingContext - a renderable context wrapping the accounting line that is being authorized against
accountingLinePropertyName - the name of the property that represents the accounting line
accountingLineIndex - value, as Integer, of the index of the given accounting line within the group's collection of accounting lines; if null, then it is assumed that this is a new line
groupTitle - title of the group from the data dictionary
Returns:
a List of the Actions that are available for this line
See Also:
org.kuali.kfs.sys.document.authorization.AccountingLineAuthorizer#getActions(org.kuali.kfs.sys.document.AccountingDocument, org.kuali.kfs.sys.businessobject.AccountingLine, java.lang.String, java.lang.Integer, org.kuali.rice.kim.bo.Person, java.lang.String)

isErrorMapContainingErrorsOnLine

protected boolean isErrorMapContainingErrorsOnLine(String accountingLinePropertyName)
Determines if the error map contains any errors which exist on the currently rendered accounting line

Parameters:
accountingLinePropertyName - the property name of the accounting line
Returns:
true if there are errors on the line, false otherwise

getUnviewableBlocks

public Set<String> getUnviewableBlocks(AccountingDocument accountingDocument,
                                       AccountingLine accountingLine,
                                       boolean newLine,
                                       org.kuali.rice.kim.bo.Person currentUser)
Returns a new empty HashSet

Specified by:
getUnviewableBlocks in interface AccountingLineAuthorizer
Parameters:
accountingDocument - the accounting document the line to authorize is owned by
accountingLine - the accounting line that is being authorized against
newLine - whether the line is a new line or not
Returns:
a Set of the names of blocks that should not being in any way rendered
See Also:
org.kuali.kfs.sys.document.authorization.AccountingLineAuthorizer#getUnviewableBlocks(org.kuali.kfs.sys.document.AccountingDocument, org.kuali.kfs.sys.businessobject.AccountingLine, java.lang.String, boolean)

renderNewLine

public boolean renderNewLine(AccountingDocument accountingDocument,
                             String accountingGroupProperty)
Description copied from interface: AccountingLineAuthorizer
Determines if new lines should be rendered for the given accounting line group (identified by its property name)

Specified by:
renderNewLine in interface AccountingLineAuthorizer
Parameters:
accountingDocument - the document that has accounting lines being authorized
accountingGroupProperty - the property of this accounting group
Returns:
true if new lines should be displayed, false otherwise
See Also:
AccountingLineAuthorizer.renderNewLine(org.kuali.kfs.sys.document.AccountingDocument, java.lang.String)

isGroupEditable

public boolean isGroupEditable(AccountingDocument accountingDocument,
                               List<? extends AccountingLineRenderingContext> accountingLineRenderingContexts,
                               org.kuali.rice.kim.bo.Person currentUser)
Description copied from interface: AccountingLineAuthorizer
Determines if any entire group is rendered as editable, which means that a new line will appear

Specified by:
isGroupEditable in interface AccountingLineAuthorizer
Parameters:
accountingDocument - the accounting document which the collection of line are on
accountingLineRenderingContexts - the accounting lines of the group, wrapped in AccountingLineRenderingContext implementations
currentUser - the current user
Returns:
true if the group can be edited, false otherwise
See Also:
org.kuali.kfs.sys.document.authorization.AccountingLineAuthorizer#isGroupEditable(org.kuali.kfs.sys.document.AccountingDocument, java.lang.String, org.kuali.rice.kim.bo.Person)

getActionMap

protected Map<String,AccountingLineViewAction> getActionMap(AccountingLineRenderingContext accountingLineRenderingContext,
                                                            String accountingLinePropertyName,
                                                            Integer accountingLineIndex,
                                                            String groupTitle)
collection the actions that are allowed for the given accounting line

Parameters:
accountingLine - the given accounting line
accountingLinePropertyName - the property name of the given account line, typically, the form name
accountingLineIndex - the index of the given accounting line in its accounting line group
groupTitle - the title of the accounting line group
Returns:
the actions that are allowed for the given accounting line

hasEditPermissionOnField

public final boolean hasEditPermissionOnField(AccountingDocument accountingDocument,
                                              AccountingLine accountingLine,
                                              String accountingLineCollectionProperty,
                                              String fieldName,
                                              boolean editableLine,
                                              boolean editablePage,
                                              org.kuali.rice.kim.bo.Person currentUser)
determine whether the current user has permission to edit the given field in the given accounting line

Specified by:
hasEditPermissionOnField in interface AccountingLineAuthorizer
Parameters:
accountingDocument - the given accounting document
accountingLine - the given accounting line in the document
fieldName - the name of a field in the given accounting line
editableLine - whether the parent line of this field is editable
editablePage - whether the parent page of this field is editable
currentUser - the current user
accountingLineCollectionProperty - the property of the collection the given accounting line is in
Returns:
true if the the current user has permission to edit the given field in the given accounting line; otherwsie, false

determineEditPermissionOnField

public boolean determineEditPermissionOnField(AccountingDocument accountingDocument,
                                              AccountingLine accountingLine,
                                              String accountingLineCollectionProperty,
                                              String fieldName,
                                              boolean editablePage)
Allows the overriding of whether a field on an accounting line is editable or not

Parameters:
accountingDocument - the accounting document the line to test is on
accountingLine - the accounting line to test
accountingLineCollectionProperty - the property that the accounting line lives in
fieldName - the name of the field we are testing
editableLine - whether the parent line of this field is editable
editablePage - whether the parent page of this field is editable
Returns:
true if the field can be edited (subject to subsequence KIM check); false otherwise

hasEditPermissionOnAccountingLine

public final boolean hasEditPermissionOnAccountingLine(AccountingDocument accountingDocument,
                                                       AccountingLine accountingLine,
                                                       String accountingLineCollectionProperty,
                                                       org.kuali.rice.kim.bo.Person currentUser,
                                                       boolean pageIsEditable)
Determine whether the current user has permission to edit the given accounting line as a whole

Specified by:
hasEditPermissionOnAccountingLine in interface AccountingLineAuthorizer
Parameters:
accountingDocument - the given accounting document
accountingLine - the given accounting line in the document
currentUser - the current user
accountingLineCollectionProperty - the property of the group that holds these accounting lines
pageIsEditable - whether the current page is editable by the current user or not
Returns:
true if the the current user has permission to edit the given accounting line; otherwsie, false

determineEditPermissionOnLine

public boolean determineEditPermissionOnLine(AccountingDocument accountingDocument,
                                             AccountingLine accountingLine,
                                             String accountingLineCollectionProperty,
                                             boolean currentUserIsDocumentInitiator,
                                             boolean pageIsEditable)
A hook to decide, pre-KIM check, if there's an edit permission on the given accounting line

Parameters:
accountingDocument - the accounting document the line is or wants to be associated with
accountingLine - the accounting line itself
accountingLineCollectionProperty - the collection the accounting line is or would be part of
currentUserIsDocumentInitiator - is the current user the initiator of the document?
Returns:
true if the line as a whole can be edited, false otherwise

approvedForUnqualifiedEditing

protected boolean approvedForUnqualifiedEditing(AccountingDocument accountingDocument,
                                                AccountingLine accountingLine,
                                                String accountingLineCollectionProperty,
                                                boolean currentUserIsDocumentInitiator)
Determines if the given line is editable, no matter what a KIM check would say about line editability. In the default case, any accounting line is editable - minus KIM check - when the document is PreRoute, or if the line is a new line

Parameters:
accountingDocument - the accounting document the line is or wants to be associated with
accountingLine - the accounting line itself
accountingLineCollectionProperty - the collection the accounting line is or would be part of
currentUserIsDocumentInitiator - is the current user the initiator of the document?
Returns:
true if the line as a whole can be edited without the KIM check, false otherwise

getKimHappyPropertyNameForField

protected String getKimHappyPropertyNameForField(String convertedName)
Parameters:
field - AccountingLineViewField to find KIM-happy property name for
Returns:
a property name that KIM will like

getFieldName

protected String getFieldName(AccountingLineViewField field)
get the full property name of the given field

Parameters:
field - the field to get the name from
Returns:
the full property name of the given field, typically, a combination of property prefix and simple property name

stripDocumentPrefixFromName

protected String stripDocumentPrefixFromName(String name)
Strips "document." and everything before from the property name

Parameters:
name - the property name to strip the document portion off of
Returns:
the stripped name

replaceCollectionElementsWithPlurals

protected String replaceCollectionElementsWithPlurals(String name)
Replaces references to collection elements to their respective plural names WARNING: this method is totally lame and I for one wished it didn't have to exist

Parameters:
name - the property name with perhaps collection elements in
Returns:
the corrected name

getBalanceInquiryAction

protected AccountingLineViewAction getBalanceInquiryAction(AccountingLine accountingLine,
                                                           String accountingLinePropertyName,
                                                           Integer accountingLineIndex,
                                                           String groupTitle)
construct the balance inquiry action for the given accounting line

Parameters:
accountingLine - the given accounting line
accountingLinePropertyName - the property name of the given account line, typically, the form name
accountingLineIndex - the index of the given accounting line in its accounting line group
groupTitle - the title of the accounting line group
Returns:
the balance inquiry action for the given accounting line

getDeleteAction

protected AccountingLineViewAction getDeleteAction(AccountingLine accountingLine,
                                                   String accountingLinePropertyName,
                                                   Integer accountingLineIndex,
                                                   String groupTitle)
construct the delete action for the given accounting line

Parameters:
accountingLine - the given accounting line
accountingLinePropertyName - the property name of the given account line, typically, the form name
accountingLineIndex - the index of the given accounting line in its accounting line group
groupTitle - the title of the accounting line group
Returns:
the delete action for the given accounting line

getAddAction

protected AccountingLineViewAction getAddAction(AccountingLine accountingLine,
                                                String accountingLinePropertyName,
                                                String groupTitle)
construct the add action for the given accounting line, typically, a new accounting line

Parameters:
accountingLine - the given accounting line
accountingLinePropertyName - the property name of the given account line, typically, the form name
accountingLineIndex - the index of the given accounting line in its accounting line group
groupTitle - the title of the accounting line group
Returns:
the add action for the given accounting line

getActionLabel

protected String getActionLabel(String messageKey,
                                Object... values)
get a label for an action with the specified message key and values

Parameters:
messageKey - the given message key that points to the label
values - the given values that would be displayed in label
Returns:
a label for an action with the specified message key and values

getAddMethod

protected String getAddMethod(AccountingLine accountingLine,
                              String accountingLineProperty)
Builds the action method name of the method that adds accounting lines for this group

Parameters:
accountingLine - the accounting line an action is being checked for
accountingLinePropertyName - the property name of the accounting line
Returns:
the action method name of the method that adds accounting lines for this group

getDeleteLineMethod

protected String getDeleteLineMethod(AccountingLine accountingLine,
                                     String accountingLineProperty,
                                     Integer accountingLineIndex)
Builds the action method name of the method that deletes accounting lines for this group

Parameters:
accountingLine - the accounting line an action is being checked for
accountingLinePropertyName - the property name of the accounting line
accountingLineIndex - the index of the given accounting line within the the group being rendered
Returns:
the action method name of the method that deletes accounting lines for this group

getBalanceInquiryMethod

protected String getBalanceInquiryMethod(AccountingLine accountingLine,
                                         String accountingLineProperty,
                                         Integer accountingLineIndex)
Builds the action method name of the method that performs a balance inquiry on accounting lines for this group

Parameters:
accountingLine - the accounting line an action is being checked for
accountingLinePropertyName - the property name of the accounting line
accountingLineIndex - the index of the given accounting line within the the group being rendered
Returns:
the action method name of the method that performs a balance inquiry on accounting lines for this group

getActionInfixForNewAccountingLine

protected String getActionInfixForNewAccountingLine(AccountingLine accountingLine,
                                                    String accountingLinePropertyName)
Gets the "action infix" for the given accounting line, so that the action knows it is supposed to add to source vs. target

Parameters:
accountingLine - the accounting line an action is being checked for
accountingLinePropertyName - the property name of the accounting line
Returns:
the name of the action infix

getActionInfixForExtantAccountingLine

protected String getActionInfixForExtantAccountingLine(AccountingLine accountingLine,
                                                       String accountingLinePropertyName)
Gets the "action infix" for the given accounting line which already exists on the document, so that the action knows it is supposed to add to source vs. target

Parameters:
accountingLine - the accounting line an action is being checked for
accountingLinePropertyName - the property name of the accounting line
Returns:
the name of the action infix

getRiceImagePath

protected String getRiceImagePath()
Returns:
the path to rice images

getKFSImagePath

protected String getKFSImagePath()
Returns:
the path to KFS images


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