Search in sources :

Example 1 with GenericReversionCategory

use of edu.cornell.kfs.gl.batch.service.impl.GenericReversionCategory 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)

Aggregations

ReversionCategory (edu.cornell.kfs.coa.businessobject.ReversionCategory)1 ReversionCategoryLogic (edu.cornell.kfs.gl.batch.service.ReversionCategoryLogic)1 GenericReversionCategory (edu.cornell.kfs.gl.batch.service.impl.GenericReversionCategory)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1