1 /*
2 * Copyright 2010 The Kuali Foundation.
3 *
4 * Licensed under the Educational Community License, Version 1.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/ecl1.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.Map;
19 import java.util.Set;
20
21 import org.kuali.rice.krad.bo.PersistableBusinessObject;
22 import org.kuali.rice.krad.service.PersistenceStructureService;
23
24 /**
25 * Provides facilities to obtain chartofAccountsCode-accountNumber foreign key fields
26 * and the corresponding account or account-involved reference objects.
27 */
28 public interface AccountPersistenceStructureService extends PersistenceStructureService {
29
30 /**
31 * Decides if the specified class is an account related class, i.e. whether it contains chartOfAccountsCode and accountNumber as part of the primary keys.
32 * @param clazz the specified class
33 * @return true if the class contains chartOfAccountsCode and accountNumber as part of the primary keys; false otherwise.
34 */
35 public boolean isAccountRelatedClass(Class clazz);
36
37 /**
38 * Determines the list of collection accounts (or other account-involved BOs) contained within the specified parent object.
39 * For example, an Award object contains awardAccounts.
40 * Note: these do not include the following cases
41 * - nested collection accounts
42 * - non-maintainable collection accounts
43 *
44 * @param bo BusinessObject (or subclass) instance that would like to be analyzed for collection accounts.
45 * @return Map containing the collection account names (key) and class type (value) or empty map if the BO contains no collection accounts.
46 */
47 public Map<String, Class> listCollectionAccountFields(PersistableBusinessObject bo);
48
49 /**
50 * Determines the list of chartOfAccountsCode fields as one of the primary keys in the collection accounts
51 * (or other account-involved BOs) contained within the specified parent object.
52 * For example, an Award object contains awardAccounts with chartOfAccountsCode as one of the primary keys.
53 * Note: these do not include the following cases
54 * - nested collection accounts
55 * - non-maintainable collection accounts
56 *
57 * @param bo BusinessObject (or subclass) instance that would like to be analyzed for collection accounts.
58 * @return Set containing the chartOfAccountsCode field names in collection accounts or empty set if the BO contains no collection accounts.
59 */
60 public Set<String> listCollectionChartOfAccountsCodeNames(PersistableBusinessObject bo);
61
62 /**
63 * Determines the list of reference accounts (or other account-involved BOs) contained within the specified parent object.
64 * For example, an Account object contains reportsToAccount etc.
65 * Note: these do not include the following cases:
66 * - nested reference accounts
67 * - reference accounts in collections
68 * - reference accounts whose PKs are also PKs of the BO
69 * - reference accounts whose PKs don't exist in the BO as foreign keys but are referred by the maintenance page in a nested way
70 * - non-existing reference accounts whose PKs exist in the BO as foreign keys (this should never happen)
71 * - non-maintainable reference accounts
72 *
73 * @param bo BusinessObject (or subclass) instance that would like to be analyzed for reference accounts.
74 * @return Map containing the reference account names (key) and class type (value) or empty map if the BO contains no reference accounts.
75 */
76 public Map<String, Class> listReferenceAccountFields(PersistableBusinessObject bo);
77
78 /**
79 * Determines the list of chartOfAccountsCode-accountNumber pairs as (part of) the foreign keys of the reference accounts
80 * (or other account-involved BOs) contained within the specified parent object.
81 * For example, an Account object contains reportsToAccount with reportsToChartOfAccountsCode-reportsToAccountNumber as the foreign keys.
82 * Note: these do not include the following cases:
83 * - nested reference accounts
84 * - reference accounts in collections
85 * - reference accounts whose PKs are also PKs of the BO
86 * - reference accounts whose PKs don't exist in the BO as foreign keys but are referred by the maintainance page in a nested way
87 * - non-existing reference accounts whose PKs exist in the BO as foreign keys (this should never happen)
88 * - non-maintainable reference accounts
89 *
90 * @param bo BusinessObject (or subclass) instance that would like to be analyzed for reference accounts.
91 * @return Map containing the chartOfAccountsCode-accountNumber (key-value) foreign key pairs for all reference accounts or empty map if the BO contains no reference accounts.
92 */
93 public Map<String, String> listChartCodeAccountNumberPairs(PersistableBusinessObject bo);
94
95 /**
96 * Determines the list of accountNumber-chartOfAccountsCode pairs as (part of) the foreign keys of the reference accounts
97 * (or other account-involved BOs) contained within the specified parent object.
98 * For example, an Account object contains reportsToAccount with reportsToAccountNumber-reportsToChartOfAccountsCode as the foreign keys.
99 * Note: these do not include the following cases:
100 * - nested reference accounts
101 * - reference accounts in collections
102 * - reference accounts whose PKs are also PKs of the BO
103 * - reference accounts whose PKs don't exist in the BO as foreign keys but are referred by the maintainance page in a nested way
104 * - non-existing reference accounts whose PKs exist in the BO as foreign keys (this should never happen)
105 * - non-maintainable reference accounts
106 *
107 * @param bo BusinessObject (or subclass) instance that would like to be analyzed for reference accounts.
108 * @return Map containing the accountNumber-chartOfAccountsCode (key-value) foreign key pairs for all reference accounts or empty map if the BO contains no reference accounts.
109 */
110 public Map<String, String> listAccountNumberChartCodePairs(PersistableBusinessObject bo);
111
112 /**
113 * Determines the list of chartOfAccountsCode fields as one of the foreign keys of the reference accounts
114 * (or other account-involved BOs) contained within the specified parent object.
115 * For example, an Account object contains reportsToAccount with reportsToChartOfAccountsCode as one of the foreign keys.
116 * Note: these do not include the following cases:
117 * - nested reference accounts
118 * - reference accounts in collections
119 * - reference accounts whose PKs are also PKs of the BO
120 * - reference accounts whose PKs don't exist in the BO as foreign keys but are referred by the maintainance page in a nested way
121 * - non-existing reference accounts whose PKs exist in the BO as foreign keys (this should never happen)
122 * - non-maintainable reference accounts
123 *
124 * @param bo BusinessObject (or subclass) instance that would like to be analyzed for reference accounts.
125 * @return Set containing the chartOfAccountsCode foreign key names for all reference accounts or empty set if the BO contains no reference accounts.
126 */
127 public Set<String> listChartOfAccountsCodeNames(PersistableBusinessObject bo);
128
129 /**
130 * Determines the list of accountNumber fields as one of the foreign keys of the reference accounts
131 * (or other account-involved BOs) contained within the specified parent object.
132 * For example, an Account object contains reportsToAccount with reportsToAccountNumber as one of the foreign keys.
133 * Note: these do not include the following cases:
134 * - nested reference accounts
135 * - reference accounts in collections
136 * - reference accounts whose PKs are also PKs of the BO
137 * - reference accounts whose PKs don't exist in the BO as foreign keys but are referred by the maintainance page in a nested way
138 * - non-existing reference accounts whose PKs exist in the BO as foreign keys (this should never happen)
139 * - non-maintainable reference accounts
140 *
141 * @param bo BusinessObject (or subclass) instance that would like to be analyzed for reference accounts.
142 * @return Set containing the accountNumber foreign key names for all reference accounts or empty set if the BO contains no reference accounts.
143 */
144 public Set<String> listAccountNumberNames(PersistableBusinessObject bo);
145
146 /**
147 * Gets the name of the chartOfAccountsCode field as one foreign key, paired with the specified accountNumber field
148 * as the other, of the reference account (or other account-involved BO) contained within the specified parent object.
149 * For example, an Account object contains reportsToAccount with reportsToChartOfAccountsCode and reportsToAccountNumber as the foreign key pair.
150 *
151 * @param bo BusinessObject (or subclass) instance that would like to be analyzed for reference accounts.
152 * @param accountNumberFieldName the name of the foreign key corresponding to the primary key accountNumber of the reference account.
153 * @return the chartOfAccountsCode field name of the reference account identified by foreign key accountNumberFieldName, or empty string if the BO contains no such reference account.
154 */
155 public String getChartOfAccountsCodeName(PersistableBusinessObject bo, String accountNumberFieldName);
156
157 /**
158 * Gets the name of the accountNumber field as one foreign key, paired with the specified chartOfAccountsCode field
159 * as the other, of the reference account (or other account-involved BO) contained within the specified parent object.
160 * For example, an Account object contains reportsToAccount with reportsToAccountNumber and reportsToChartOfAccountsCode as the foreign key pair.
161 *
162 * @param bo BusinessObject (or subclass) instance that would like to be analyzed for reference accounts.
163 * @param chartOfAccountsCodeFieldName the name of the foreign key corresponding to the primary key chartOfAccountsCode of the reference account.
164 * @return the accountNumber field name of the reference account identified by foreign key chartOfAccountsCode, or empty string if the BO contains no such reference account.
165 */
166 public String getAccountNumberName(PersistableBusinessObject bo, String chartOfAccountsCodeFieldName);
167
168 }
169