use of edu.cornell.kfs.coa.businessobject.ReversionCategory in project cu-kfs by CU-CommunityApps.
the class AccountReversionServiceImpl method isCategoryActiveByName.
/**
* @see org.kuali.kfs.coa.service.OrganizationReversionService#isCategoryActiveByName(java.lang.String)
*/
public boolean isCategoryActiveByName(String categoryName) {
Map<String, Object> fieldMap = new HashMap<String, Object>();
fieldMap.put("reversionCategoryName", categoryName);
final Collection categories = businessObjectService.findMatching(ReversionCategory.class, fieldMap);
final Iterator categoriesIterator = categories.iterator();
ReversionCategory category = null;
while (categoriesIterator.hasNext()) {
category = (ReversionCategory) categoriesIterator.next();
}
if (category == null)
return false;
return category.isActive();
}
use of edu.cornell.kfs.coa.businessobject.ReversionCategory in project cu-kfs by CU-CommunityApps.
the class ReversionCategoryValuesFinder method getKeyValues.
/**
* Creates a list of {@link MandatoryTransferEliminationCode}s using their code as their key, and their name as the display
* value
*
* @see org.kuali.kfs.kns.lookup.keyvalues.KeyValuesFinder#getKeyValues()
*/
public List getKeyValues() {
Collection<ReversionCategory> codes = SpringContext.getBean(KeyValuesService.class).findAll(ReversionCategory.class);
List<KeyValue> labels = new ArrayList<KeyValue>();
labels.add(new ConcreteKeyValue("", ""));
for (ReversionCategory reversionCategory : codes) {
if (reversionCategory.isActive()) {
labels.add(new ConcreteKeyValue(reversionCategory.getReversionCategoryCode(), reversionCategory.getReversionCategoryName()));
}
}
return labels;
}
use of edu.cornell.kfs.coa.businessobject.ReversionCategory in project cu-kfs by CU-CommunityApps.
the class AccountReversionServiceImplTest method testGetCategories.
public void testGetCategories() {
ReversionCategory goodReversionCategory = ReversionCategoryFixture.A1_CATEGORY.createReversionCategory();
Map<String, ReversionCategoryLogic> results = accountReversionService.getCategories();
assertTrue("categories should not be empty", results.size() > 0);
assertTrue(results.containsKey(goodReversionCategory.getReversionCategoryCode()));
assertEquals(goodReversionCategory.getReversionCategoryName(), results.get(goodReversionCategory.getReversionCategoryCode()).getName());
}
use of edu.cornell.kfs.coa.businessobject.ReversionCategory in project cu-kfs by CU-CommunityApps.
the class ReversionProcessBase method generateMany.
public void generateMany(List<OriginEntryFull> originEntriesToWrite) throws FatalErrorException {
int originEntriesCreated = 0;
for (Iterator<ReversionCategory> iter = categoryList.iterator(); iter.hasNext(); ) {
ReversionCategory cat = iter.next();
ReversionCategoryInfo detail = cfReversionProcessInfo.getReversionDetail(cat.getReversionCategoryCode());
ReversionUnitOfWorkCategoryAmount amount = unitOfWork.amounts.get(cat.getReversionCategoryCode());
if (!amount.getCarryForward().isZero()) {
KualiDecimal commonAmount = amount.getCarryForward();
String commonObject = detail.getReversionObjectCode();
OriginEntryFull entry = getEntry();
entry.setUniversityFiscalYear((Integer) jobParameters.get(KFSConstants.UNIV_FISCAL_YR) + 1);
entry.setChartOfAccountsCode(unitOfWork.chartOfAccountsCode);
entry.setAccountNumber(unitOfWork.accountNumber);
entry.setSubAccountNumber(unitOfWork.subAccountNumber);
entry.setFinancialObjectCode((String) jobParameters.get(KFSConstants.BEG_BUD_CASH_OBJECT_CD));
entry.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
entry.setFinancialBalanceTypeCode(KFSConstants.BALANCE_TYPE_CURRENT_BUDGET);
getPersistenceService().retrieveReferenceObject(entry, KFSPropertyConstants.FINANCIAL_OBJECT);
if (ObjectUtils.isNull(entry.getFinancialObject())) {
throw new FatalErrorException("Object Code for Entry not found: " + entry);
}
ObjectCode objectCode = entry.getFinancialObject();
entry.setFinancialObjectTypeCode(objectCode.getFinancialObjectTypeCode());
entry.setUniversityFiscalPeriodCode(KFSConstants.MONTH1);
entry.setDocumentNumber(DEFAULT_DOCUMENT_NUMBER_PREFIX + unitOfWork.accountNumber);
entry.setTransactionLedgerEntryDescription(FUND_CARRIED_MESSAGE + (Integer) jobParameters.get(KFSConstants.UNIV_FISCAL_YR));
entry.setTransactionLedgerEntryAmount(commonAmount);
// 3259 MOVE TRN-LDGR-ENTR-AMT TO WS-AMT-W-PERIOD
// 3260 WS-AMT-N.
// 3261 MOVE WS-AMT-X TO TRN-AMT-RED-X.
originEntriesToWrite.add(entry);
entry = getEntry();
entry.setUniversityFiscalYear((Integer) jobParameters.get(KFSConstants.UNIV_FISCAL_YR) + 1);
entry.setChartOfAccountsCode(unitOfWork.chartOfAccountsCode);
entry.setAccountNumber(unitOfWork.accountNumber);
entry.setSubAccountNumber(unitOfWork.subAccountNumber);
entry.setFinancialObjectCode(commonObject);
entry.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
entry.setFinancialBalanceTypeCode(KFSConstants.BALANCE_TYPE_CURRENT_BUDGET);
getPersistenceService().retrieveReferenceObject(entry, KFSPropertyConstants.FINANCIAL_OBJECT);
if (ObjectUtils.isNull(entry.getFinancialObject())) {
throw new FatalErrorException("Object Code for Entry not found: " + entry);
}
objectCode = entry.getFinancialObject();
entry.setFinancialObjectTypeCode(objectCode.getFinancialObjectTypeCode());
entry.setUniversityFiscalPeriodCode(KFSConstants.MONTH1);
entry.setDocumentNumber(DEFAULT_DOCUMENT_NUMBER_PREFIX + unitOfWork.accountNumber);
entry.setTransactionLedgerEntryDescription(FUND_CARRIED_MESSAGE + (Integer) jobParameters.get(KFSConstants.UNIV_FISCAL_YR));
entry.setTransactionLedgerEntryAmount(commonAmount);
// 3343 MOVE TRN-LDGR-ENTR-AMT TO WS-AMT-W-PERIOD
// 3344 WS-AMT-N.
// 3345 MOVE WS-AMT-X TO TRN-AMT-RED-X.
originEntriesToWrite.add(entry);
}
}
}
use of edu.cornell.kfs.coa.businessobject.ReversionCategory in project cu-kfs by CU-CommunityApps.
the class ReversionProcessBase method clearCalculationTotals.
protected void clearCalculationTotals() {
// Initialize all the amounts before applying the proper rule
KualiDecimal totalAvailable = KualiDecimal.ZERO;
for (ReversionCategory category : categoryList) {
ReversionCategoryLogic logic = categories.get(category.getReversionCategoryCode());
ReversionUnitOfWorkCategoryAmount amount = unitOfWork.amounts.get(category.getReversionCategoryCode());
if (logic.isExpense()) {
amount.setAvailable(amount.getBudget().subtract(amount.getActual()));
} else {
amount.setAvailable(amount.getActual().subtract(amount.getBudget()));
}
totalAvailable = totalAvailable.add(amount.getAvailable());
amount.setCarryForward(KualiDecimal.ZERO);
}
unitOfWork.setTotalAvailable(totalAvailable);
unitOfWork.setTotalReversion(totalAvailable);
unitOfWork.setTotalCarryForward(KualiDecimal.ZERO);
}
Aggregations