org.kuali.kfs.module.purap.document.authorization
Class PurapAccountingLineAuthorizer

java.lang.Object
  extended by org.kuali.kfs.sys.document.authorization.AccountingLineAuthorizerBase
      extended by org.kuali.kfs.module.purap.document.authorization.PurapAccountingLineAuthorizer
All Implemented Interfaces:
AccountingLineAuthorizer
Direct Known Subclasses:
PurchaseOrderAccountingLineAuthorizer, RequisitionAccountingLineAuthorizer

public class PurapAccountingLineAuthorizer
extends AccountingLineAuthorizerBase

Authorizer which deals with financial processing document issues, specifically sales tax lines on documents This class utilizes the new accountingLine model.


Constructor Summary
PurapAccountingLineAuthorizer()
           
 
Method Summary
protected  boolean allowAccountingLinesAreEditable(AccountingDocument accountingDocument, AccountingLine accountingLine)
          This method checks whether the accounting lines are editable for a specific item type.
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  PurApItem findTheItemForAccountingLine(AccountingDocument accountingDocument, AccountingLine accountingLine)
          Find the item to which an accounting line belongs.
protected  String getAddMethod(AccountingLine accountingLine, String accountingLineProperty)
          Overrides the method in AccountingLineAuthorizerBase so that the add button would have the line item number in addition to the rest of the insertxxxx String for methodToCall when the user clicks on the add button.
protected  String getBalanceInquiryMethod(AccountingLine accountingLine, String accountingLineProperty, Integer accountingLineIndex)
          Overrides the method in AccountingLineAuthorizerBase so that the balance inquiry button would have both the line item number and the accounting line number for methodToCall when the user clicks on the balance inquiry button.
protected  String getDeleteLineMethod(AccountingLine accountingLine, String accountingLineProperty, Integer accountingLineIndex)
          Overrides the method in AccountingLineAuthorizerBase so that the delete button would have both the line item number and the accounting line number for methodToCall when the user clicks on the delete button.
 Set<String> getUnviewableBlocks(AccountingDocument accountingDocument, AccountingLine accountingLine, boolean newLine, org.kuali.rice.kim.bo.Person currentUser)
          Returns a new empty HashSet
 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
 
Methods inherited from class org.kuali.kfs.sys.document.authorization.AccountingLineAuthorizerBase
getActionInfixForExtantAccountingLine, getActionInfixForNewAccountingLine, getActionLabel, getActionMap, getActions, getAddAction, getBalanceInquiryAction, getDeleteAction, getFieldName, getKFSImagePath, getKimHappyPropertyNameForField, getRiceImagePath, hasEditPermissionOnAccountingLine, hasEditPermissionOnField, isErrorMapContainingErrorsOnLine, renderNewLine, replaceCollectionElementsWithPlurals, stripDocumentPrefixFromName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PurapAccountingLineAuthorizer

public PurapAccountingLineAuthorizer()
Method Detail

getAddMethod

protected String getAddMethod(AccountingLine accountingLine,
                              String accountingLineProperty)
Overrides the method in AccountingLineAuthorizerBase so that the add button would have the line item number in addition to the rest of the insertxxxx String for methodToCall when the user clicks on the add button.

Overrides:
getAddMethod in class AccountingLineAuthorizerBase
Parameters:
accountingLine -
accountingLineProperty -
Returns:

getDeleteLineMethod

protected String getDeleteLineMethod(AccountingLine accountingLine,
                                     String accountingLineProperty,
                                     Integer accountingLineIndex)
Overrides the method in AccountingLineAuthorizerBase so that the delete button would have both the line item number and the accounting line number for methodToCall when the user clicks on the delete button.

Overrides:
getDeleteLineMethod in class AccountingLineAuthorizerBase
Parameters:
accountingLine - the accounting line an action is being checked for
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
See Also:
AccountingLineAuthorizerBase.getDeleteLineMethod(org.kuali.kfs.sys.businessobject.AccountingLine, java.lang.String, java.lang.Integer)

getBalanceInquiryMethod

protected String getBalanceInquiryMethod(AccountingLine accountingLine,
                                         String accountingLineProperty,
                                         Integer accountingLineIndex)
Overrides the method in AccountingLineAuthorizerBase so that the balance inquiry button would have both the line item number and the accounting line number for methodToCall when the user clicks on the balance inquiry button.

Overrides:
getBalanceInquiryMethod in class AccountingLineAuthorizerBase
Parameters:
accountingLine - the accounting line an action is being checked for
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
See Also:
AccountingLineAuthorizerBase.getBalanceInquiryMethod(org.kuali.kfs.sys.businessobject.AccountingLine, java.lang.String, java.lang.Integer)

getUnviewableBlocks

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

Specified by:
getUnviewableBlocks in interface AccountingLineAuthorizer
Overrides:
getUnviewableBlocks in class AccountingLineAuthorizerBase
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:
AccountingLineAuthorizerBase.getUnviewableBlocks(org.kuali.kfs.sys.document.AccountingDocument, org.kuali.kfs.sys.businessobject.AccountingLine, boolean, org.kuali.rice.kim.bo.Person)

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
Overrides:
isGroupEditable in class AccountingLineAuthorizerBase
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)

determineEditPermissionOnField

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

Overrides:
determineEditPermissionOnField in class AccountingLineAuthorizerBase
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
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

determineEditPermissionOnLine

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

Overrides:
determineEditPermissionOnLine in class AccountingLineAuthorizerBase
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

allowAccountingLinesAreEditable

protected boolean allowAccountingLinesAreEditable(AccountingDocument accountingDocument,
                                                  AccountingLine accountingLine)
This method checks whether the accounting lines are editable for a specific item type.


findTheItemForAccountingLine

protected PurApItem findTheItemForAccountingLine(AccountingDocument accountingDocument,
                                                 AccountingLine accountingLine)
Find the item to which an accounting line belongs. Convenience/Utility method. Some methods that require an accounting line with a purApItem attached were getting accounting lines passed in that did not yet have a purApItem. I needed a way to match the accounting line to the proper item.

Parameters:
accountingDocument - the document holding both the accounting line and the item to which the accounting line is attached
accountingLine - the accounting line of interest, for which a containing item should be found
Returns:
the item to which the incoming accounting line is attached

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 This overriding implementation is required because the Purap module has a new restriction that requires that an accounting line for a Trade-In item cannot be manually editable, even if not yet saved ("not yet saved" means it has no sequence number). Therefore, the base implementation that determines editability on the sequence number alone has to be preceded by a check that declares ineligible for editing if it is a trade-in.

Overrides:
approvedForUnqualifiedEditing in class AccountingLineAuthorizerBase
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
See Also:
allowAccountingLinesAreEditable(AccountingDocument, AccountingLine)


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