001 /* 002 * Copyright 2011 The Kuali Foundation. 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.kfs.module.bc.document.service; 017 018 import org.kuali.kfs.coa.businessobject.Account; 019 import org.kuali.kfs.coa.businessobject.Chart; 020 import org.kuali.kfs.coa.businessobject.ObjectCode; 021 import org.kuali.kfs.coa.businessobject.SubAccount; 022 import org.kuali.kfs.coa.businessobject.SubObjectCode; 023 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionIntendedIncumbent; 024 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionPosition; 025 import org.kuali.kfs.module.bc.businessobject.PendingBudgetConstructionAppointmentFunding; 026 import org.kuali.kfs.module.bc.document.BudgetConstructionDocument; 027 import org.kuali.rice.kns.util.ErrorMap; 028 import org.kuali.rice.kns.util.MessageMap; 029 030 /** 031 * define a set of validations methods for buddget construction 032 */ 033 public interface BudgetConstructionRuleHelperService { 034 035 /** 036 * test if the given appointment funding is associted with a labor detail allowed object 037 * 038 * @param appointmentFunding the given appointment funding 039 * @param errorMap the error map that contains errors if any 040 * @return true if the given appointment funding is associted with a labor detail allowed object; otherwise, false 041 */ 042 public boolean hasDetailPositionRequiredObjectCode(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 043 044 /** 045 * test if the given appointment funding is associted with a valid account 046 * 047 * @param appointmentFunding the given appointment funding 048 * @param errorMap the error map that contains errors if any 049 * @return true if the given appointment funding is associted with a valid account; otherwise, false 050 */ 051 public boolean hasValidAccount(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 052 053 /** 054 * test if the given appointment funding is associted with a valid chart of accounts 055 * 056 * @param appointmentFunding the given appointment funding 057 * @param errorMap the error map that contains errors if any 058 * @return true if the given appointment funding is associted with a valid chart of accounts; otherwise, false 059 */ 060 public boolean hasValidChart(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 061 062 /** 063 * test if the given appointment funding is associted with a valid incumbent 064 * 065 * @param appointmentFunding the given appointment funding 066 * @param errorMap the error map that contains errors if any 067 * @return true if the given appointment funding is associted with a valid incumbent; otherwise, false 068 */ 069 public boolean hasValidIncumbent(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 070 071 /** 072 * test if the given appointment funding is associted with a valid financial object 073 * 074 * @param appointmentFunding the given appointment funding 075 * @param errorMap the error map that contains errors if any 076 * @return true if the given appointment funding is associted with a valid financial object; otherwise, false 077 */ 078 public boolean hasValidObjectCode(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 079 080 /** 081 * test if the given appointment funding is associted with a valid budget position 082 * 083 * @param appointmentFunding the given appointment funding 084 * @param errorMap the error map that contains errors if any 085 * @return true if the given appointment funding is associted with a valid budget position; otherwise, false 086 */ 087 public boolean hasValidPosition(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 088 089 /** 090 * test if the given appointment funding is associted with a valid sub account 091 * 092 * @param appointmentFunding the given appointment funding 093 * @param errorMap the error map that contains errors if any 094 * @return true if the given appointment funding is associted with a valid sub account; otherwise, false 095 */ 096 public boolean hasValidSubAccount(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 097 098 /** 099 * test if the given appointment funding is associted with a valid sub object 100 * 101 * @param appointmentFunding the given appointment funding 102 * @param errorMap the error map that contains errors if any 103 * @return true if the given appointment funding is associted with a valid sub object; otherwise, false 104 */ 105 public boolean hasValidSubObjectCode(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 106 107 /** 108 * determine whether the given appoinment funding can be associated with a valid budget contruction document 109 * 110 * @param appointmentFunding the given appointment funding 111 * @param errorMap the given error map that can hold the error message if any 112 * @param errorPropertyName the specified property name that is tested 113 * @return true if the given appoinment funding can be associated with a valid budget contruction document; otherwise, false 114 */ 115 public boolean isAssociatedWithValidDocument(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap, String errorPropertyName); 116 117 /** 118 * determine wether the given budget document is allowed to be budgeted 119 * 120 * @param budgetConstructionDocument the given budget document 121 * @param errorMap the given error map that can hold the error message if any 122 * @param errorPropertyName the specified property name that is tested 123 * @return true if the given budget document can be budgeted; otherwise, false 124 */ 125 public boolean isBudgetableDocument(BudgetConstructionDocument budgetConstructionDocument, MessageMap errorMap, String errorPropertyName); 126 127 /** 128 * determine whether the given object requires a detail position 129 * 130 * @param financialObject the given financial object 131 * @param currentValue the given current value 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 object requires a detail position; otherwise, false 135 */ 136 public boolean isDetailPositionRequiredObjectCode(ObjectCode financialObject, String currentValue, MessageMap errorMap, String errorPropertyName); 137 138 /** 139 * determine if the fields in the given appointment funding line are in the correct formats defined in the data dictionary 140 * 141 * @param appointmentFunding the given appointment funding 142 * @param errorMap the given error map that can hold the error message if any 143 * @return true if the fields in the given appointment funding line are in the correct formats defined in the data dictionary; 144 * otherwise, false 145 */ 146 public boolean isFieldFormatValid(PendingBudgetConstructionAppointmentFunding appointmentFunding, MessageMap errorMap); 147 148 /** 149 * determine whether the given account is valid 150 * 151 * @param account the given account 152 * @param currentValue the given current value 153 * @param errorMap the given error map that can hold the error message if any 154 * @param errorPropertyName the specified property name that is tested 155 * @return true if the given account is valid; otherwise, false 156 */ 157 public boolean isValidAccount(Account account, String currentValue, MessageMap errorMap, String errorPropertyName); 158 159 /** 160 * determine whether the given chart is valid 161 * 162 * @param chart the given chart 163 * @param invalidValue 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 chart is valid; otherwise, false 167 */ 168 public boolean isValidChart(Chart chart, String currentValue, MessageMap errorMap, String errorPropertyName); 169 170 /** 171 * determine whether the given budget contruction intended incumbent is valid 172 * 173 * @param intendedIncumbent the given budget contruction intended incumbent 174 * @param currentValue 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 budget contruction intended incumbent is valid; otherwise, false 178 */ 179 public boolean isValidIncumbent(BudgetConstructionIntendedIncumbent intendedIncumbent, String currentValue, MessageMap errorMap, String errorPropertyName); 180 181 /** 182 * Runs existence and active tests on the ObjectCode reference This method is differenct than the one in 183 * AccountingLineRuleHelper in that it adds the bad value to the errormessage This method signature should probably be added to 184 * AccountingLineRuleHelper 185 * 186 * @param objectCode the given object code 187 * @param currentValue the given current value 188 * @param errorMap the given error map that can hold the error message if any 189 * @param errorPropertyName the specified property name that is tested 190 * @return true if the given object code is valid; otherwise, false 191 */ 192 public boolean isValidObjectCode(ObjectCode objectCode, String currentValue, MessageMap errorMap, String errorPropertyName); 193 194 /** 195 * determine whether the given budget contruction position is valid 196 * 197 * @param position the given budget contruction position 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 budget contruction position is valid; otherwise, false 202 */ 203 public boolean isValidPosition(BudgetConstructionPosition position, String currentValue, MessageMap errorMap, String errorPropertyName); 204 205 /** 206 * determine whether the given sub account is valid 207 * 208 * @param subAccount the given sub account 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 sub account is valid; otherwise, false 213 */ 214 public boolean isValidSubAccount(SubAccount subAccount, String currentValue, MessageMap errorMap, String errorPropertyName); 215 216 /** 217 * Runs existence and active tests on the SubObjectCode reference This method is differenct than the one in 218 * AccountingLineRuleHelper in that it adds the bad value to the errormessage This method signature should probably be added to 219 * AccountingLineRuleHelper 220 * 221 * @param subObjectCode the given sub object 222 * @param currentValue the given current value 223 * @param errorMap the given error map that can hold the error message if any 224 * @param errorPropertyName the specified property name that is tested 225 * @return true if the given sub object is valid; otherwise, false 226 */ 227 public boolean isValidSubObjectCode(SubObjectCode subObjectCode, String currentValue, MessageMap errorMap, String errorPropertyName); 228 }