1 /* 2 * The Kuali Financial System, a comprehensive financial management system for higher education. 3 * 4 * Copyright 2005-2014 The Kuali Foundation 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU Affero General Public License as 8 * published by the Free Software Foundation, either version 3 of the 9 * License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU Affero General Public License for more details. 15 * 16 * You should have received a copy of the GNU Affero General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 package org.kuali.kfs.module.bc.document.service; 20 21 import org.kuali.kfs.coa.businessobject.Account; 22 import org.kuali.kfs.coa.businessobject.Chart; 23 import org.kuali.kfs.coa.businessobject.ObjectCode; 24 import org.kuali.kfs.coa.businessobject.SubAccount; 25 import org.kuali.kfs.coa.businessobject.SubObjectCode; 26 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionIntendedIncumbent; 27 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionPosition; 28 import org.kuali.kfs.module.bc.businessobject.PendingBudgetConstructionAppointmentFunding; 29 import org.kuali.kfs.module.bc.document.BudgetConstructionDocument; 30 import org.kuali.rice.krad.util.MessageMap; 31 32 /** 33 * define a set of validations methods for buddget construction 34 */ 35 public interface BudgetConstructionRuleHelperService { 36 37 /** 38 * test if the given appointment funding is associated with a labor detail allowed object 39 * 40 * @param appointmentFunding the given appointment funding 41 * @param errorMap the error map that contains errors if any 42 * @return true if the given appointment funding is associated with a labor detail allowed object; otherwise, false 43 */ 44 public boolean hasDetailPositionRequiredObjectCode(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 45 46 /** 47 * test if the given appointment funding is associated with a valid account 48 * 49 * @param appointmentFunding the given appointment funding 50 * @param errorMap the error map that contains errors if any 51 * @return true if the given appointment funding is associated with a valid account; otherwise, false 52 */ 53 public boolean hasValidAccount(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 54 55 /** 56 * test if the given appointment funding is associated with a valid chart of accounts 57 * 58 * @param appointmentFunding the given appointment funding 59 * @param errorMap the error map that contains errors if any 60 * @return true if the given appointment funding is associated with a valid chart of accounts; otherwise, false 61 */ 62 public boolean hasValidChart(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 63 64 /** 65 * test if the given appointment funding is associated with a valid incumbent 66 * 67 * @param appointmentFunding the given appointment funding 68 * @param errorMap the error map that contains errors if any 69 * @return true if the given appointment funding is associated with a valid incumbent; otherwise, false 70 */ 71 public boolean hasValidIncumbent(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 72 73 /** 74 * separate quick salary setting test if the given appointment funding is associated with a valid incumbent 75 * 76 * @param appointmentFunding 77 * @param errorMap 78 * @return 79 */ 80 public boolean hasValidIncumbentQuickSalarySetting(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 81 82 /** 83 * test if the given appointment funding is associated with a valid financial object 84 * 85 * @param appointmentFunding the given appointment funding 86 * @param errorMap the error map that contains errors if any 87 * @return true if the given appointment funding is associated with a valid financial object; otherwise, false 88 */ 89 public boolean hasValidObjectCode(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 90 91 /** 92 * test if the given appointment funding is associated with a valid budget position 93 * 94 * @param appointmentFunding the given appointment funding 95 * @param errorMap the error map that contains errors if any 96 * @return true if the given appointment funding is associated with a valid budget position; otherwise, false 97 */ 98 public boolean hasValidPosition(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 99 100 /** 101 * test if the given appointment funding is associated with a valid sub account 102 * 103 * @param appointmentFunding the given appointment funding 104 * @param errorMap the error map that contains errors if any 105 * @return true if the given appointment funding is associated with a valid sub account; otherwise, false 106 */ 107 public boolean hasValidSubAccount(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 108 109 /** 110 * test if the given appointment funding is associated with a valid sub object 111 * 112 * @param appointmentFunding the given appointment funding 113 * @param errorMap the error map that contains errors if any 114 * @return true if the given appointment funding is associated with a valid sub object; otherwise, false 115 */ 116 public boolean hasValidSubObjectCode(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 117 118 /** 119 * determine whether the given appointment funding can be associated with a valid budget construction document 120 * 121 * @param appointmentFunding the given appointment funding 122 * @param errorMap the given error map that can hold the error message if any 123 * @param errorPropertyName the specified property name that is tested 124 * @return true if the given appointment funding can be associated with a valid budget construction document; otherwise, false 125 */ 126 public boolean isAssociatedWithValidDocument(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap, String errorPropertyName); 127 128 /** 129 * determine wether the given budget document is allowed to be budgeted 130 * 131 * @param budgetConstructionDocument the given budget document 132 * @param errorMap the given error map that can hold the error message if any 133 * @param errorPropertyName the specified property name that is tested 134 * @return true if the given budget document can be budgeted; otherwise, false 135 */ 136 public boolean isBudgetableDocument(BudgetConstructionDocument budgetConstructionDocument, MessageMap errorMap, String errorPropertyName); 137 138 /** 139 * determine whether the given object requires a detail position 140 * 141 * @param financialObject the given financial object 142 * @param currentValue the given current value 143 * @param errorMap the given error map that can hold the error message if any 144 * @param errorPropertyName the specified property name that is tested 145 * @return true if the given object requires a detail position; otherwise, false 146 */ 147 public boolean isDetailPositionRequiredObjectCode(ObjectCode financialObject, String currentValue, MessageMap errorMap, String errorPropertyName); 148 149 /** 150 * determine if the fields in the given appointment funding line are in the correct formats defined in the data dictionary 151 * 152 * @param appointmentFunding the given appointment funding 153 * @param errorMap the given error map that can hold the error message if any 154 * @return true if the fields in the given appointment funding line are in the correct formats defined in the data dictionary; 155 * otherwise, false 156 */ 157 public boolean isFieldFormatValid(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 158 159 /** 160 * determine whether the given account is valid 161 * 162 * @param account the given account 163 * @param currentValue the given current value 164 * @param errorMap the given error map that can hold the error message if any 165 * @param errorPropertyName the specified property name that is tested 166 * @return true if the given account is valid; otherwise, false 167 */ 168 public boolean isValidAccount(Account account, String currentValue, MessageMap errorMap, String errorPropertyName); 169 170 /** 171 * determine whether the given chart is valid 172 * 173 * @param chart the given chart 174 * @param invalidValue the given current value 175 * @param errorMap the given error map that can hold the error message if any 176 * @param errorPropertyName the specified property name that is tested 177 * @return true if the given chart is valid; otherwise, false 178 */ 179 public boolean isValidChart(Chart chart, String currentValue, MessageMap errorMap, String errorPropertyName); 180 181 /** 182 * determine whether the given budget construction intended incumbent is valid 183 * 184 * @param intendedIncumbent the given budget construction intended incumbent 185 * @param currentValue the given current value 186 * @param errorMap the given error map that can hold the error message if any 187 * @param errorPropertyName the specified property name that is tested 188 * @return true if the given budget construction intended incumbent is valid; otherwise, false 189 */ 190 public boolean isValidIncumbent(BudgetConstructionIntendedIncumbent intendedIncumbent, String currentValue, MessageMap errorMap, String errorPropertyName); 191 192 /** 193 * Runs existence and active tests on the ObjectCode reference This method is different than the one in 194 * AccountingLineRuleHelper in that it adds the bad value to the errormessage This method signature should probably be added to 195 * AccountingLineRuleHelper 196 * 197 * @param objectCode the given object code 198 * @param currentValue the given current value 199 * @param errorMap the given error map that can hold the error message if any 200 * @param errorPropertyName the specified property name that is tested 201 * @return true if the given object code is valid; otherwise, false 202 */ 203 public boolean isValidObjectCode(ObjectCode objectCode, String currentValue, MessageMap errorMap, String errorPropertyName); 204 205 /** 206 * determine whether the given budget construction position is valid 207 * 208 * @param position the given budget construction position 209 * @param currentValue the given current value 210 * @param errorMap the given error map that can hold the error message if any 211 * @param errorPropertyName the specified property name that is tested 212 * @return true if the given budget construction position is valid; otherwise, false 213 */ 214 public boolean isValidPosition(BudgetConstructionPosition position, String currentValue, MessageMap errorMap, String errorPropertyName); 215 216 /** 217 * determine whether the given sub account is valid 218 * 219 * @param subAccount the given sub account 220 * @param currentValue the given current value 221 * @param errorMap the given error map that can hold the error message if any 222 * @param errorPropertyName the specified property name that is tested 223 * @return true if the given sub account is valid; otherwise, false 224 */ 225 public boolean isValidSubAccount(SubAccount subAccount, String currentValue, MessageMap errorMap, String errorPropertyName); 226 227 /** 228 * Runs existence and active tests on the SubObjectCode reference This method is different than the one in 229 * AccountingLineRuleHelper in that it adds the bad value to the errormessage This method signature should probably be added to 230 * AccountingLineRuleHelper 231 * 232 * @param subObjectCode the given sub object 233 * @param currentValue the given current value 234 * @param errorMap the given error map that can hold the error message if any 235 * @param errorPropertyName the specified property name that is tested 236 * @return true if the given sub object is valid; otherwise, false 237 */ 238 public boolean isValidSubObjectCode(SubObjectCode subObjectCode, String currentValue, MessageMap errorMap, String errorPropertyName); 239 }