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);
}
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;
}
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();
}
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());
}
}
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);
}
Aggregations