Search in sources :

Example 1 with ReversionCategory

use of edu.cornell.kfs.coa.businessobject.ReversionCategory in project cu-kfs by CU-CommunityApps.

the class AccountReversionMaintainableImpl method setBusinessObject.

/**
 * pre-populate the static list of details with each category
 *
 * @see org.kuali.kfs.kns.maintenance.MaintainableImpl#setBusinessObject(org.kuali.kfs.kns.bo.BusinessObject)
 */
public void setBusinessObject(PersistableBusinessObject businessObject) {
    AccountReversionService accountReversionService = SpringContext.getBean(AccountReversionService.class);
    AccountReversion accountReversion = (AccountReversion) businessObject;
    List<AccountReversionDetail> details = accountReversion.getAccountReversionDetails();
    if (details == null) {
        details = new ArrayList<AccountReversionDetail>();
        accountReversion.setAccountReversionDetails(details);
    }
    if (details.size() == 0) {
        Collection<ReversionCategory> categories = accountReversionService.getCategoryList();
        for (ReversionCategory category : categories) {
            if (category.isActive()) {
                AccountReversionDetail detail = new AccountReversionDetail();
                detail.setAccountReversionCategoryCode(category.getReversionCategoryCode());
                detail.setReversionCategory(category);
                details.add(detail);
            }
        }
        Collections.sort(details, new categoryComparator());
    }
    super.setBusinessObject(businessObject);
}
Also used : AccountReversion(edu.cornell.kfs.coa.businessobject.AccountReversion) AccountReversionDetail(edu.cornell.kfs.coa.businessobject.AccountReversionDetail) ReversionCategory(edu.cornell.kfs.coa.businessobject.ReversionCategory) AccountReversionService(edu.cornell.kfs.coa.service.AccountReversionService)

Example 2 with ReversionCategory

use of edu.cornell.kfs.coa.businessobject.ReversionCategory in project cu-kfs by CU-CommunityApps.

the class AccountReversionServiceImpl method getCategories.

/**
 * @see org.kuali.kfs.coa.service.OrganizationReversionService#getCategories()
 */
public Map<String, ReversionCategoryLogic> getCategories() {
    LOG.debug("getCategories() started");
    Map<String, ReversionCategoryLogic> categories = new HashMap<String, ReversionCategoryLogic>();
    Collection cats = accountReversionDao.getCategories();
    for (Iterator iter = cats.iterator(); iter.hasNext(); ) {
        ReversionCategory rc = (ReversionCategory) iter.next();
        String categoryCode = rc.getReversionCategoryCode();
        Map<String, ReversionCategoryLogic> beanMap = SpringContext.getBeansOfType(ReversionCategoryLogic.class);
        if (beanMap.containsKey("gl" + categoryCode + "AccountReversionCategory")) {
            LOG.info("Found Account Reversion Category Logic for gl" + categoryCode + "AccountReversionCategory");
            categories.put(categoryCode, beanMap.get("gl" + categoryCode + "AccountReversionCategory"));
        } else {
            LOG.info("No Account Reversion Category Logic for gl" + categoryCode + "AccountReversionCategory; using generic");
            GenericReversionCategory cat = SpringContext.getBean(GenericReversionCategory.class);
            cat.setCategoryCode(categoryCode);
            cat.setCategoryName(rc.getReversionCategoryName());
            categories.put(categoryCode, (ReversionCategoryLogic) cat);
        }
    }
    return categories;
}
Also used : HashMap(java.util.HashMap) ReversionCategoryLogic(edu.cornell.kfs.gl.batch.service.ReversionCategoryLogic) Iterator(java.util.Iterator) Collection(java.util.Collection) ReversionCategory(edu.cornell.kfs.coa.businessobject.ReversionCategory) GenericReversionCategory(edu.cornell.kfs.gl.batch.service.impl.GenericReversionCategory) GenericReversionCategory(edu.cornell.kfs.gl.batch.service.impl.GenericReversionCategory)

Example 3 with ReversionCategory

use of edu.cornell.kfs.coa.businessobject.ReversionCategory in project cu-kfs by CU-CommunityApps.

the class AccountReversionServiceImpl method isCategoryActive.

/**
 * @see org.kuali.kfs.coa.service.OrganizationReversionService#isCategoryActive(java.lang.String)
 */
public boolean isCategoryActive(String categoryCode) {
    Map<String, Object> pkMap = new HashMap<String, Object>();
    pkMap.put("reversionCategoryCode", categoryCode);
    final ReversionCategory category = (ReversionCategory) businessObjectService.findByPrimaryKey(ReversionCategory.class, pkMap);
    if (category == null)
        return false;
    return category.isActive();
}
Also used : HashMap(java.util.HashMap) ReversionCategory(edu.cornell.kfs.coa.businessobject.ReversionCategory) GenericReversionCategory(edu.cornell.kfs.gl.batch.service.impl.GenericReversionCategory)

Example 4 with ReversionCategory

use of edu.cornell.kfs.coa.businessobject.ReversionCategory in project cu-kfs by CU-CommunityApps.

the class AccountReversionGlobalMaintainableImpl method processAfterNew.

/**
 * Just like OrganizationReversionMaintainableImpl's setBusinessObject method populates the list of details so there is one
 * detail per active Organization Reversion Category, this method populates a list of Organization Reversion Change details.
 *
 * @see org.kuali.kfs.kns.maintenance.MaintainableImpl#setBusinessObject(org.kuali.kfs.krad.bo.PersistableBusinessObject)
 */
@Override
public void processAfterNew(MaintenanceDocument document, Map<String, String[]> requestParameters) {
    super.processAfterNew(document, requestParameters);
    AccountReversionGlobal globalOrgRev = (AccountReversionGlobal) getBusinessObject();
    List<AccountReversionGlobalDetail> details = globalOrgRev.getAccountReversionGlobalDetails();
    if (LOG.isDebugEnabled()) {
        LOG.debug("Details size before adding categories = " + details.size());
    }
    if (details == null) {
        details = new ArrayList<AccountReversionGlobalDetail>();
        globalOrgRev.setAccountReversionGlobalDetails(details);
    }
    if (details.size() == 0) {
        Collection<ReversionCategory> categories = getAccountReversionService().getCategoryList();
        for (ReversionCategory category : categories) {
            if (category.isActive()) {
                AccountReversionGlobalDetail detail = new AccountReversionGlobalDetail();
                detail.setAccountReversionCategoryCode(category.getReversionCategoryCode());
                detail.setReversionCategory(category);
                detail.setParentGlobalAccountReversion(globalOrgRev);
                details.add(detail);
            }
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("Details size after adding categories = " + details.size());
        }
        Collections.sort(details, new CategoryComparator());
    }
}
Also used : AccountReversionGlobal(edu.cornell.kfs.coa.businessobject.AccountReversionGlobal) AccountReversionGlobalDetail(edu.cornell.kfs.coa.businessobject.AccountReversionGlobalDetail) ReversionCategory(edu.cornell.kfs.coa.businessobject.ReversionCategory)

Example 5 with ReversionCategory

use of edu.cornell.kfs.coa.businessobject.ReversionCategory in project cu-kfs by CU-CommunityApps.

the class AccountReversionGlobalMaintainableImpl method setBusinessObject.

/**
 * Just like AccountReversionMaintainableImpl's setBusinessObject method populates the list of details so there is one
 * detail per active Account Reversion Category, this method populates a list of Account Reversion Change details.
 *
 * @see org.kuali.kfs.kns.maintenance.MaintainableImpl#setBusinessObject(org.kuali.kfs.kns.bo.PersistableBusinessObject)
 */
@Override
public void setBusinessObject(PersistableBusinessObject businessObject) {
    super.setBusinessObject(businessObject);
    AccountReversionService accountReversionService = SpringContext.getBean(AccountReversionService.class);
    AccountReversionGlobal globalAcctRev = (AccountReversionGlobal) businessObject;
    List<AccountReversionGlobalDetail> details = globalAcctRev.getAccountReversionGlobalDetails();
    LOG.debug("Details size before adding categories = " + details.size());
    if (details == null) {
        details = new ArrayList<AccountReversionGlobalDetail>();
        globalAcctRev.setAccountReversionGlobalDetails(details);
    }
    if (details.size() == 0) {
        Collection<ReversionCategory> categories = getAccountReversionService().getCategoryList();
        for (ReversionCategory category : categories) {
            if (category.isActive()) {
                AccountReversionGlobalDetail detail = new AccountReversionGlobalDetail();
                detail.setAccountReversionCategoryCode(category.getReversionCategoryCode());
                detail.setReversionCategory(category);
                detail.setParentGlobalAccountReversion(globalAcctRev);
                details.add(detail);
            }
        }
        LOG.debug("Details size after adding categories = " + details.size());
        Collections.sort(details, new CategoryComparator());
    }
    super.setBusinessObject(businessObject);
}
Also used : AccountReversionGlobal(edu.cornell.kfs.coa.businessobject.AccountReversionGlobal) AccountReversionGlobalDetail(edu.cornell.kfs.coa.businessobject.AccountReversionGlobalDetail) ReversionCategory(edu.cornell.kfs.coa.businessobject.ReversionCategory) AccountReversionService(edu.cornell.kfs.coa.service.AccountReversionService)

Aggregations

ReversionCategory (edu.cornell.kfs.coa.businessobject.ReversionCategory)15 ReversionCategoryLogic (edu.cornell.kfs.gl.batch.service.ReversionCategoryLogic)4 HashMap (java.util.HashMap)4 AccountReversionService (edu.cornell.kfs.coa.service.AccountReversionService)3 GenericReversionCategory (edu.cornell.kfs.gl.batch.service.impl.GenericReversionCategory)3 ReversionUnitOfWorkCategoryAmount (edu.cornell.kfs.gl.businessobject.ReversionUnitOfWorkCategoryAmount)3 AccountReversion (edu.cornell.kfs.coa.businessobject.AccountReversion)2 AccountReversionDetail (edu.cornell.kfs.coa.businessobject.AccountReversionDetail)2 AccountReversionGlobal (edu.cornell.kfs.coa.businessobject.AccountReversionGlobal)2 AccountReversionGlobalDetail (edu.cornell.kfs.coa.businessobject.AccountReversionGlobalDetail)2 ReversionCategoryInfo (edu.cornell.kfs.coa.businessobject.ReversionCategoryInfo)2 Collection (java.util.Collection)2 Iterator (java.util.Iterator)2 KualiDecimal (org.kuali.kfs.core.api.util.type.KualiDecimal)2 FatalErrorException (org.kuali.kfs.gl.batch.service.impl.exception.FatalErrorException)2 ArrayList (java.util.ArrayList)1 ObjectCode (org.kuali.kfs.coa.businessobject.ObjectCode)1 ConcreteKeyValue (org.kuali.kfs.core.api.util.ConcreteKeyValue)1 KeyValue (org.kuali.kfs.core.api.util.KeyValue)1 OriginEntryFull (org.kuali.kfs.gl.businessobject.OriginEntryFull)1