use of org.kuali.kfs.sys.document.AccountingDocument in project cu-kfs by CU-CommunityApps.
the class CreateAccountingDocumentServiceImplTest method buildExpectedDocumentsAndAppendToLists.
private void buildExpectedDocumentsAndAppendToLists(Consumer<AccountingXmlDocumentEntryFixture> fixtureListAppender, Consumer<AccountingDocument> documentListAppender, AccountingXmlDocumentEntryFixture... fixtures) {
MutableInt idCounter = new MutableInt(DOCUMENT_NUMBER_START);
Stream.of(fixtures).filter(this::isDocumentExpectedToReachInitiationPoint).map((fixture) -> buildDocumentIdToFixtureMapping(idCounter, fixture)).filter((mapping) -> isDocumentExpectedToPassBusinessRulesValidation(mapping.getValue())).peek((mapping) -> fixtureListAppender.accept(mapping.getValue())).map(this::buildExpectedDocument).forEach(documentListAppender);
}
use of org.kuali.kfs.sys.document.AccountingDocument in project cu-kfs by CU-CommunityApps.
the class CreateAccountingDocumentServiceImplTest method assertDocumentsWereCreatedAndRoutedCorrectly.
private void assertDocumentsWereCreatedAndRoutedCorrectly(AccountingXmlDocumentEntryFixture... fixtures) {
List<AccountingXmlDocumentEntryFixture> expectedRoutableFixtures = new ArrayList<>(fixtures.length);
List<AccountingDocument> expectedAccountingDocuments = new ArrayList<>(fixtures.length);
buildExpectedDocumentsAndAppendToLists(expectedRoutableFixtures::add, expectedAccountingDocuments::add, fixtures);
assertEquals("Wrong number of routed documents", expectedAccountingDocuments.size(), routedAccountingDocuments.size());
for (int i = 0; i < expectedAccountingDocuments.size(); i++) {
AccountingXmlDocumentEntryFixture fixture = expectedRoutableFixtures.get(i);
Class<? extends AccountingDocument> expectedDocumentClass = AccountingDocumentClassMappingUtils.getDocumentClassByDocumentType(fixture.documentTypeCode);
assertAccountingDocumentIsCorrect(expectedDocumentClass, expectedAccountingDocuments.get(i), routedAccountingDocuments.get(i));
}
}
use of org.kuali.kfs.sys.document.AccountingDocument in project cu-kfs by CU-CommunityApps.
the class MockDocumentUtils method performInitializationFromSkippedConstructor.
private static void performInitializationFromSkippedConstructor(Document document) {
document.setDocumentHeader(new FinancialSystemDocumentHeader());
document.setAdHocRoutePersons(new ArrayList<>());
document.setAdHocRouteWorkgroups(new ArrayList<>());
document.setNotes(new ArrayList<>());
if (document instanceof AccountingDocument) {
AccountingDocument accountingDocument = (AccountingDocument) document;
accountingDocument.setSourceAccountingLines(new ArrayList<>());
accountingDocument.setTargetAccountingLines(new ArrayList<>());
accountingDocument.setNextSourceLineNumber(Integer.valueOf(1));
accountingDocument.setNextTargetLineNumber(Integer.valueOf(1));
}
if (document instanceof InternalBillingDocument) {
InternalBillingDocument internalBillingDocument = (InternalBillingDocument) document;
internalBillingDocument.setItems(new ArrayList<>());
internalBillingDocument.setNextItemLineNumber(Integer.valueOf(1));
}
}
use of org.kuali.kfs.sys.document.AccountingDocument in project cu-kfs by CU-CommunityApps.
the class CuPreEncumbranceAction method setTabStates.
protected void setTabStates(ActionForm form) {
KualiAccountingDocumentFormBase kualiForm = (KualiAccountingDocumentFormBase) form;
AccountingDocument accountingDocument = kualiForm.getFinancialDocument();
Map<String, String> tabStates = kualiForm.getTabStates();
setAutomaticPartialDisEncumbrancesTabsOpen(accountingDocument, tabStates);
setGeneralLedgerPendingEntriesTabOpenWhenGLPEsExist(accountingDocument, tabStates);
kualiForm.setTabStates(tabStates);
}
use of org.kuali.kfs.sys.document.AccountingDocument in project cu-kfs by CU-CommunityApps.
the class KualiAccountingDocumentActionBase method handleSalesTaxRequiredAllLines.
/**
* This method is called from the createDocument and processes through all the accouting lines and checks to see if they need
* sales tax fields
*
* @param kualiDocumentFormBase
* @param baselineSourceLines
*/
protected void handleSalesTaxRequiredAllLines(KualiDocumentFormBase kualiDocumentFormBase, List<AccountingLine> baselineAcctingLines) {
AccountingDocument accoutingDocument = (AccountingDocument) kualiDocumentFormBase.getDocument();
int index = 0;
for (AccountingLine accountingLine : baselineAcctingLines) {
boolean source = false;
if (accountingLine.isSourceAccountingLine()) {
source = true;
}
handleSalesTaxRequired(accoutingDocument, accountingLine, source, false, index);
index++;
}
}
Aggregations