View Javadoc
1   /*
2    * Copyright 2009 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.coa.service;
17  
18  import java.util.Iterator;
19  import java.util.List;
20  
21  import org.kuali.ole.coa.businessobject.AccountDelegate;
22  import org.kuali.ole.coa.document.AccountDelegateGlobalMaintainableImpl;
23  import org.kuali.ole.coa.document.AccountDelegateMaintainableImpl;
24  import org.kuali.ole.sys.document.FinancialSystemMaintainable;
25  import org.kuali.rice.krad.bo.PersistableBusinessObject;
26  
27  /**
28   * An interface of services to support account delegate logic
29   */
30  public interface AccountDelegateService {
31      
32      /**
33       * 
34       * This method checks for any MaintenanceLocks that would block the creation of this document
35       * @param global The AccountDelegateGlobalMaintainableImpl to check against.
36       * @param docNumber The document number of the AccountDelegateGlobalMaintainableImpl in question.
37       * @return the documentNumber of the locking record or null if none.
38       */
39      
40      public String getLockingDocumentId(AccountDelegateGlobalMaintainableImpl global, String docNumber);
41      
42      /**
43       * 
44       * This method checks for any MaintenanceLocks that would block the creation of this document
45       * @param delegate The AccountDelegateMaintainableImpl to check against.
46       * @param docNumber The document number of the AccountDelegateMaintainableImpl in question.
47       * @return the documentNumber of the locking record or null if none.
48       */
49      public String getLockingDocumentId(AccountDelegateMaintainableImpl delegate, String docNumber);
50      
51      /**
52       * Builds an appropriate maintainable with the given account delegate as the business object
53       * @param delegate the account delegate to wrap in a maintainable
54       * @return an appropriate maintainable
55       */
56      public abstract FinancialSystemMaintainable buildMaintainableForAccountDelegate(AccountDelegate delegate);
57      
58      /**
59       * Retrieves all active account delegations which delegate to the given Person
60       * @param principalId a principal id of the person to find account delegations for
61       * @param primary whether the account delegates returned should be primary or not
62       * @return a List of AccountDelegate business objects, representing that person's delegations
63       */
64      public abstract Iterator<AccountDelegate> retrieveAllActiveDelegationsForPerson(String principalId, boolean primary);
65  
66      /**
67       * Determines if the given principal is an active delegate for any non-closed account
68       * @param principalId the principal ID to check primary account delegations for
69       * @return true if the principal is a primary account delegate, false otherwise
70       */
71      public abstract boolean isPrincipalInAnyWayShapeOrFormPrimaryAccountDelegate(String principalId);
72      
73      /**
74       * 
75       * Determines if the given principal is an active delegate for any non-closed account
76       * @param principalId the principal ID to check secondary account delegations for
77       * @return true if the principal is a secondary account delegate, false otherwise
78       */
79      public abstract boolean isPrincipalInAnyWayShapeOrFormSecondaryAccountDelegate(String principalId);
80      
81      /**
82       * Saves the given account delegate to the persistence store
83       * @param accountDelegate the account delegate to save
84       */
85      public abstract void saveForMaintenanceDocument(AccountDelegate accountDelegate);
86      
87      /**
88       * Persists the given account delegate global maintenance document inactivations
89       * @param delegatesToInactivate the List of delegates to inactivate
90       */
91      public abstract void saveInactivationsForGlobalMaintenanceDocument(List<PersistableBusinessObject> delegatesToInactivate);
92      
93      /**
94       * Persists the given account delegate global maintenance document changes
95       * @param delegatesToChange the List of delegates to change
96       */
97      public abstract void saveChangesForGlobalMaintenanceDocument(List<PersistableBusinessObject> delegatesToChange);
98      
99      /**
100      * Updates the role that this delegate is part of, to account for the changes in this delegate
101      */
102     public abstract void updateDelegationRole();
103     
104 }