Search in sources :

Example 1 with AccountReversionGlobal

use of edu.cornell.kfs.coa.businessobject.AccountReversionGlobal 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 2 with AccountReversionGlobal

use of edu.cornell.kfs.coa.businessobject.AccountReversionGlobal 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)

Example 3 with AccountReversionGlobal

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

the class AccountReversionGlobalMaintainableImpl method generateMaintenanceLocks.

/**
 * This implementation locks all account reversions that would be accessed by this global account reversion. It does
 * not lock any AccountReversionDetail objects, as we expect that those will be inaccessible
 *
 * @see org.kuali.kfs.kns.maintenance.KualiGlobalMaintainableImpl#generateMaintenaceLocks()
 */
@Override
public List<MaintenanceLock> generateMaintenanceLocks() {
    List<MaintenanceLock> locks = new ArrayList<MaintenanceLock>();
    AccountReversionGlobal globalAcctRev = (AccountReversionGlobal) this.getBusinessObject();
    if (globalAcctRev.getUniversityFiscalYear() != null && globalAcctRev.getAccountReversionGlobalAccounts() != null && globalAcctRev.getAccountReversionGlobalAccounts().size() > 0) {
        // only generate locks if we're going to have primary keys
        for (AccountReversionGlobalAccount acctRevAcct : globalAcctRev.getAccountReversionGlobalAccounts()) {
            MaintenanceLock maintenanceLock = new MaintenanceLock();
            maintenanceLock.setDocumentNumber(globalAcctRev.getDocumentNumber());
            StringBuffer lockRep = new StringBuffer();
            lockRep.append(AccountReversion.class.getName());
            lockRep.append(KFSConstants.Maintenance.AFTER_CLASS_DELIM);
            lockRep.append("chartOfAccountsCode");
            lockRep.append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
            lockRep.append(acctRevAcct.getChartOfAccountsCode());
            lockRep.append(KFSConstants.Maintenance.AFTER_VALUE_DELIM);
            lockRep.append("universityFiscalYear");
            lockRep.append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
            lockRep.append(globalAcctRev.getUniversityFiscalYear().toString());
            lockRep.append(KFSConstants.Maintenance.AFTER_VALUE_DELIM);
            lockRep.append("accountNumber");
            lockRep.append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
            lockRep.append(acctRevAcct.getAccountNumber());
            lockRep.append(KFSConstants.Maintenance.AFTER_VALUE_DELIM);
            maintenanceLock.setLockingRepresentation(lockRep.toString());
            locks.add(maintenanceLock);
        }
    }
    return locks;
}
Also used : AccountReversion(edu.cornell.kfs.coa.businessobject.AccountReversion) AccountReversionGlobal(edu.cornell.kfs.coa.businessobject.AccountReversionGlobal) ArrayList(java.util.ArrayList) MaintenanceLock(org.kuali.kfs.krad.maintenance.MaintenanceLock) AccountReversionGlobalAccount(edu.cornell.kfs.coa.businessobject.AccountReversionGlobalAccount)

Example 4 with AccountReversionGlobal

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

the class AccountReversionGlobalPreRules method doCustomPreRules.

/**
 * This is the hook method for the {@link MaintenancePreRulesBase} to call. It calls
 * <ul>
 * <li>{@link AccountReversionGlobalPreRules#checkForContinuationAccounts(OrganizationReversionGlobal)}</li>
 * <li>{@link AccountReversionGlobalPreRules#copyKeyAttributesToCollections(OrganizationReversionGlobal)}</li>
 * </ul>
 * @see org.kuali.kfs.coa.document.validation.impl.MaintenancePreRulesBase#doCustomPreRules(org.kuali.kfs.kns.document.MaintenanceDocument)
 */
@Override
public boolean doCustomPreRules(MaintenanceDocument maintenanceDocument) {
    AccountReversionGlobal globalAcctReversion = (AccountReversionGlobal) maintenanceDocument.getNewMaintainableObject().getBusinessObject();
    checkForContinuationAccounts(globalAcctReversion);
    copyKeyAttributesToCollections(globalAcctReversion);
    return true;
}
Also used : AccountReversionGlobal(edu.cornell.kfs.coa.businessobject.AccountReversionGlobal)

Example 5 with AccountReversionGlobal

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

the class AccountReversionGlobalRule method processCustomAddCollectionLineBusinessRules.

/**
 * This performs rules checks whenever a new {@link AccountReversionGlobalDetail} or {@link AccountReversionGlobalAccount} is added
 * <p>
 * This includes:
 * <ul>
 * <li>{@link AccountReversionGlobalRule#checkDetailObjectCodeValidity(AccountReversionGlobal, AccountReversionGlobalDetail)}</li>
 * <li>{@link AccountReversionGlobalRule#checkDetailObjectReversionCodeValidity(AccountReversionGlobalDetail)}</li>
 * <li>ensure that the chart of accounts code and account number for {@link AccountReversionGlobalAccount} are not empty values</li>
 * <li>{@link AccountReversionGlobalRule#checkAllObjectCodesForValidity(AccountReversionGlobal, AccountReversionGlobalAccount)}</li>
 * <li>{@link AccountReversionGlobalRule#checkAccountChartValidity(AccountReversionGlobalAccount)</li>
 * <li>{@link AccountReversionGlobalRule#checkAccountValidity(AccountReversionGlobalAccount)</li>
 * <li>{@link AccountReversionGlobalRule#checkAccountIsNotAmongAcctRevAccounts(AccountReversionGlobal, AccountReversionGlobalAccount)</li>
 * </ul>
 * @see org.kuali.kfs.kns.maintenance.rules.MaintenanceDocumentRuleBase#processCustomAddCollectionLineBusinessRules(org.kuali.kfs.kns.document.MaintenanceDocument,
 *      java.lang.String, org.kuali.kfs.kns.bo.PersistableBusinessObject)
 */
@Override
public boolean processCustomAddCollectionLineBusinessRules(MaintenanceDocument document, String collectionName, PersistableBusinessObject line) {
    boolean success = true;
    AccountReversionGlobal globalAcctRev = (AccountReversionGlobal) ((AccountReversionGlobalMaintainableImpl) document.getNewMaintainableObject()).getBusinessObject();
    if (line instanceof AccountReversionGlobalDetail) {
        AccountReversionGlobalDetail detail = (AccountReversionGlobalDetail) line;
        success &= checkDetailObjectCodeValidity(globalAcctRev, detail);
        success &= checkDetailObjectReversionCodeValidity(detail);
    } else if (line instanceof AccountReversionGlobalAccount) {
        AccountReversionGlobalAccount acct = (AccountReversionGlobalAccount) line;
        if (!checkEmptyValue(acct.getChartOfAccountsCode()) || !checkEmptyValue(acct.getAccountNumber())) {
            // Skip Most validation if chart or account are empty. The default required-field checking will populate the error map accordingly.
            success = false;
        }
        if (success) {
            success &= checkAllObjectCodesForValidity(globalAcctRev, acct);
            success &= checkAccountChartValidity(acct);
            success &= checkAccountValidity(acct);
            success &= checkAccountIsNotAmongAcctRevAccounts(globalAcctRev, acct);
        }
    }
    return success;
}
Also used : AccountReversionGlobal(edu.cornell.kfs.coa.businessobject.AccountReversionGlobal) AccountReversionGlobalDetail(edu.cornell.kfs.coa.businessobject.AccountReversionGlobalDetail) AccountReversionGlobalAccount(edu.cornell.kfs.coa.businessobject.AccountReversionGlobalAccount)

Aggregations

AccountReversionGlobal (edu.cornell.kfs.coa.businessobject.AccountReversionGlobal)5 AccountReversionGlobalDetail (edu.cornell.kfs.coa.businessobject.AccountReversionGlobalDetail)3 AccountReversionGlobalAccount (edu.cornell.kfs.coa.businessobject.AccountReversionGlobalAccount)2 ReversionCategory (edu.cornell.kfs.coa.businessobject.ReversionCategory)2 AccountReversion (edu.cornell.kfs.coa.businessobject.AccountReversion)1 AccountReversionService (edu.cornell.kfs.coa.service.AccountReversionService)1 ArrayList (java.util.ArrayList)1 MaintenanceLock (org.kuali.kfs.krad.maintenance.MaintenanceLock)1