Search in sources :

Example 6 with AccountReversionDetail

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

the class AccountReversionRule method validateDetailBusinessObjects.

/**
 * Tests each option attached to the main business object and validates its properties.
 *
 * @param orgReversion
 * @return false if any of the detail objects fail with their validation
 */
protected boolean validateDetailBusinessObjects(AccountReversion orgReversion) {
    GlobalVariables.getMessageMap().addToErrorPath("document.newMaintainableObject");
    List<AccountReversionDetail> details = orgReversion.getAccountReversionDetails();
    int index = 0;
    int originalErrorCount = GlobalVariables.getMessageMap().getErrorCount();
    for (AccountReversionDetail dtl : details) {
        String errorPath = "accountReversionDetails[" + index + "]";
        GlobalVariables.getMessageMap().addToErrorPath(errorPath);
        validateAccountReversionDetail(dtl);
        GlobalVariables.getMessageMap().removeFromErrorPath(errorPath);
        index++;
    }
    GlobalVariables.getMessageMap().removeFromErrorPath("document.newMaintainableObject");
    return GlobalVariables.getMessageMap().getErrorCount() == originalErrorCount;
}
Also used : AccountReversionDetail(edu.cornell.kfs.coa.businessobject.AccountReversionDetail)

Example 7 with AccountReversionDetail

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

the class AccountReversionDetailTrickleDownInactivationServiceImpl method trickleDownActivations.

/**
 * The method which actually does the work of activating the details
 * @param organizationReversionDetails the details to inactivate
 * @param documentNumber the document number which has the inactivations as part of it
 * @return an inactivation status object which will help us save notes
 */
protected void trickleDownActivations(List<AccountReversionDetail> accountReversionDetails, String documentNumber) {
    TrickleDownStatus status = new TrickleDownStatus(CUKFSKeyConstants.ACCOUNT_REVERSION_DETAIL_TRICKLE_DOWN_ACTIVATION, CUKFSKeyConstants.ACCOUNT_REVERSION_DETAIL_TRICKLE_DOWN_ACTIVATION_ERROR_DURING_PERSISTENCE);
    if (!ObjectUtils.isNull(accountReversionDetails) && !accountReversionDetails.isEmpty()) {
        for (AccountReversionDetail detail : accountReversionDetails) {
            if (!detail.isActive() && allowActivation(detail)) {
                detail.setActive(true);
                try {
                    businessObjectService.save(detail);
                    status.addAccountReversionDetail(detail);
                } catch (RuntimeException re) {
                    LOG.error("Unable to trickle-down inactivate sub-account " + detail.toString(), re);
                    status.addErrorPersistingAccountReversionDetail(detail);
                }
            }
        }
    }
    status.saveSuccesfullyChangedNotes(documentNumber);
    status.saveErrorNotes(documentNumber);
}
Also used : AccountReversionDetail(edu.cornell.kfs.coa.businessobject.AccountReversionDetail)

Example 8 with AccountReversionDetail

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

the class AccountReversionDetailTrickleDownInactivationServiceImpl method trickleDownInactivations.

/**
 * The method which actually does the work of inactivating the details
 * @param organizationReversionDetails the details to inactivate
 * @param documentNumber the document number which has the inactivations as part of it
 * @return an inactivation status object which will help us save notes
 */
protected void trickleDownInactivations(List<AccountReversionDetail> accountReversionDetails, String documentNumber) {
    TrickleDownStatus status = new TrickleDownStatus(CUKFSKeyConstants.ACCOUNT_REVERSION_DETAIL_TRICKLE_DOWN_INACTIVATION, CUKFSKeyConstants.ACCOUNT_REVERSION_DETAIL_TRICKLE_DOWN_INACTIVATION_ERROR_DURING_PERSISTENCE);
    if (!ObjectUtils.isNull(accountReversionDetails) && !accountReversionDetails.isEmpty()) {
        for (AccountReversionDetail detail : accountReversionDetails) {
            if (detail.isActive()) {
                detail.setActive(false);
                try {
                    businessObjectService.save(detail);
                    status.addAccountReversionDetail(detail);
                } catch (RuntimeException re) {
                    LOG.error("Unable to trickle-down inactivate sub-account " + detail.toString(), re);
                    status.addErrorPersistingAccountReversionDetail(detail);
                }
            }
        }
    }
    status.saveSuccesfullyChangedNotes(documentNumber);
    status.saveErrorNotes(documentNumber);
}
Also used : AccountReversionDetail(edu.cornell.kfs.coa.businessobject.AccountReversionDetail)

Example 9 with AccountReversionDetail

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

the class AccountReversionDetailTrickleDownInactivationServiceImpl method trickleDownInactiveAccountReversionDetails.

/**
 * @see org.kuali.kfs.coa.service.OrganizationReversionDetailTrickleDownInactivationService#trickleDownInactiveAccountReversionDetails(org.kuali.kfs.coa.businessobject.ReversionCategory, java.lang.String)
 */
public void trickleDownInactiveAccountReversionDetails(ReversionCategory reversionCategory, String documentNumber) {
    Map<String, Object> fieldValues = new HashMap<String, Object>();
    fieldValues.put("reversionCategoryCode", reversionCategory.getReversionCategoryCode());
    Collection acctReversionDetails = businessObjectService.findMatching(AccountReversionDetail.class, fieldValues);
    List<AccountReversionDetail> accountReversionDetailList = new ArrayList<AccountReversionDetail>();
    for (Object acctRevDetailAsObject : acctReversionDetails) {
        accountReversionDetailList.add((AccountReversionDetail) acctRevDetailAsObject);
    }
    trickleDownInactivations(accountReversionDetailList, documentNumber);
}
Also used : AccountReversionDetail(edu.cornell.kfs.coa.businessobject.AccountReversionDetail) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Collection(java.util.Collection) PersistableBusinessObject(org.kuali.kfs.krad.bo.PersistableBusinessObject)

Aggregations

AccountReversionDetail (edu.cornell.kfs.coa.businessobject.AccountReversionDetail)9 AccountReversion (edu.cornell.kfs.coa.businessobject.AccountReversion)3 HashMap (java.util.HashMap)3 ReversionCategory (edu.cornell.kfs.coa.businessobject.ReversionCategory)2 AccountReversionService (edu.cornell.kfs.coa.service.AccountReversionService)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 PersistableBusinessObject (org.kuali.kfs.krad.bo.PersistableBusinessObject)2 CSVReader (au.com.bytecode.opencsv.CSVReader)1 FileReader (java.io.FileReader)1 Account (org.kuali.kfs.coa.businessobject.Account)1 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)1