01: /*
02: * Copyright 2005-2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.financial.rules;
17:
18: import org.kuali.kfs.bo.AccountingLine;
19: import org.kuali.kfs.document.AccountingDocument;
20: import org.kuali.kfs.rules.AccountingDocumentRuleBase;
21:
22: /**
23: * This class holds document specific business rules for the Distribution of Income and Expense. It overrides methods in the base
24: * rule class to apply specific checks.
25: */
26: public class DistributionOfIncomeAndExpenseDocumentRule extends
27: AccountingDocumentRuleBase implements
28: DistributionOfIncomeAndExpenseDocumentRuleConstants {
29:
30: /**
31: * Return true if account line is debit
32: *
33: * @param financialDocument submitted accounting document
34: * @param accountingLine accounting line from accounting document
35: * @return true is account line is debit
36: *
37: * @see IsDebitUtils#isDebitConsideringSectionAndTypePositiveOnly(FinancialDocumentRuleBase, FinancialDocument, AccountingLine)
38: * @see org.kuali.core.rule.AccountingLineRule#isDebit(org.kuali.core.document.FinancialDocument,
39: * org.kuali.core.bo.AccountingLine)
40: */
41: public boolean isDebit(AccountingDocument financialDocument,
42: AccountingLine accountingLine) {
43: return IsDebitUtils
44: .isDebitConsideringSectionAndTypePositiveOnly(this ,
45: financialDocument, accountingLine);
46: }
47:
48: /**
49: * The DI allows one sided documents for correcting - so if one side is empty, the other side must have at least two lines in
50: * it. The balancing rules take care of validation of amounts.
51: *
52: * @param financialDocument submitted accounting document
53: * @return true number of accounting lines required for routing is met
54: *
55: * @see org.kuali.module.financial.rules.FinancialDocumentRuleBase#isAccountingLinesRequiredNumberForRoutingMet(org.kuali.core.document.FinancialDocument)
56: */
57: @Override
58: protected boolean isAccountingLinesRequiredNumberForRoutingMet(
59: AccountingDocument financialDocument) {
60: return isOptionalOneSidedDocumentAccountingLinesRequiredNumberForRoutingMet(financialDocument);
61: }
62: }
|