Search in sources :

Example 16 with ParameterEvaluator

use of org.kuali.kfs.core.api.parameter.ParameterEvaluator in project cu-kfs by CU-CommunityApps.

the class DisbursementVoucherDocument method populateDocumentForRouting.

/**
 * This method is overridden to populate some local variables that are not persisted to the database. These values need to be
 * computed and saved to the DV Payee Detail BO so they can be serialized to XML for routing. Some of the routing rules rely on
 * these variables.
 */
@Override
public void populateDocumentForRouting() {
    DisbursementVoucherPayeeDetail payeeDetail = getDvPayeeDetail();
    if (payeeDetail.isVendor()) {
        payeeDetail.setDisbVchrPayeeEmployeeCode(getVendorService().isVendorInstitutionEmployee(payeeDetail.getDisbVchrVendorHeaderIdNumberAsInteger()));
        payeeDetail.setDvPayeeSubjectPaymentCode(getVendorService().isSubjectPaymentVendor(payeeDetail.getDisbVchrVendorHeaderIdNumberAsInteger()));
    } else if (payeeDetail.isEmployee()) {
        // Determine if employee is a research subject
        ParameterEvaluator researchPaymentReasonCodeEvaluator = /*REFACTORME*/
        SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator(DisbursementVoucherDocument.class, FPParameterConstants.RESEARCH_PAYMENT_REASONS, payeeDetail.getDisbVchrPaymentReasonCode());
        if (researchPaymentReasonCodeEvaluator.evaluationSucceeds() && getParameterService().parameterExists(DisbursementVoucherDocument.class, FPParameterConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT)) {
            String researchPayLimit = getParameterService().getParameterValueAsString(DisbursementVoucherDocument.class, FPParameterConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT);
            if (StringUtils.isNotBlank(researchPayLimit)) {
                KualiDecimal payLimit = new KualiDecimal(researchPayLimit);
                if (getDisbVchrCheckTotalAmount().isLessThan(payLimit)) {
                    payeeDetail.setDvPayeeSubjectPaymentCode(true);
                }
            }
        }
    }
    // Call last, serializes to XML
    super.populateDocumentForRouting();
}
Also used : KualiDecimal(org.kuali.kfs.core.api.util.type.KualiDecimal) DisbursementVoucherPayeeDetail(org.kuali.kfs.fp.businessobject.DisbursementVoucherPayeeDetail) ParameterEvaluator(org.kuali.kfs.core.api.parameter.ParameterEvaluator)

Example 17 with ParameterEvaluator

use of org.kuali.kfs.core.api.parameter.ParameterEvaluator in project cu-kfs by CU-CommunityApps.

the class KualiAccountingDocumentActionBase method isSalesTaxRequired.

/**
 * This method checks to see if this doctype needs sales tax If it does then it checks to see if the account and
 * object code require sales tax If it does then it returns true. Note - this is hackish as we shouldn't have to
 * call rules directly from the action class But we need to in this instance because we are copying the lines
 * before calling rules and need a way to modify them before they go on
 *
 * @param accountingLine
 * @return true if sales tax check is needed, false otherwise
 */
protected boolean isSalesTaxRequired(AccountingDocument financialDocument, AccountingLine accountingLine) {
    boolean required = false;
    String docType = SpringContext.getBean(DataDictionaryService.class).getDocumentTypeNameByClass(financialDocument.getClass());
    // first we need to check just the doctype to see if it needs the sales tax check
    // apply the rule, see if it fails
    ParameterEvaluatorService parameterEvaluatorService = SpringContext.getBean(ParameterEvaluatorService.class);
    ParameterEvaluator docTypeSalesTaxCheckEvaluator = parameterEvaluatorService.getParameterEvaluator(KfsParameterConstants.FINANCIAL_PROCESSING_DOCUMENT.class, FPParameterConstants.SALES_TAX_DOCUMENT_TYPES, docType);
    if (docTypeSalesTaxCheckEvaluator.evaluationSucceeds()) {
        required = true;
    }
    // second we need to check the account and object code combination to see if it needs sales tax
    if (required) {
        // get the object code and account
        String objCd = accountingLine.getFinancialObjectCode();
        String account = accountingLine.getAccountNumber();
        if (StringUtils.isNotEmpty(objCd) && StringUtils.isNotEmpty(account)) {
            String compare = account + ":" + objCd;
            ParameterEvaluator salesTaxApplicableAcctAndObjectEvaluator = parameterEvaluatorService.getParameterEvaluator(KfsParameterConstants.FINANCIAL_PROCESSING_DOCUMENT.class, FPParameterConstants.SALES_TAX_APPLICABLE_ACCOUNTS_AND_OBJECT_CODES, compare);
            if (!salesTaxApplicableAcctAndObjectEvaluator.evaluationSucceeds()) {
                required = false;
            }
        } else {
            // the two fields are currently empty and we don't need to check yet
            required = false;
        }
    }
    return required;
}
Also used : KfsParameterConstants(org.kuali.kfs.sys.service.impl.KfsParameterConstants) ParameterEvaluatorService(org.kuali.kfs.core.api.parameter.ParameterEvaluatorService) ParameterEvaluator(org.kuali.kfs.core.api.parameter.ParameterEvaluator) DataDictionaryService(org.kuali.kfs.datadictionary.legacy.DataDictionaryService)

Example 18 with ParameterEvaluator

use of org.kuali.kfs.core.api.parameter.ParameterEvaluator in project cu-kfs by CU-CommunityApps.

the class BankServiceImpl method isBankSpecificationEnabledForDocument.

@Override
@Cacheable(cacheNames = Bank.CACHE_NAME, key = "'isBankSpecificationEnabled'+#p0")
public boolean isBankSpecificationEnabledForDocument(Class<?> documentClass) {
    String documentTypeCode = dataDictionaryService.getDocumentTypeNameByClass(documentClass);
    if (ArrayUtils.contains(PERMANENT_BANK_SPECIFICATION_ENABLED_DOCUMENT_TYPES, documentTypeCode)) {
        return true;
    }
    ParameterEvaluator evaluator = parameterEvaluatorService.getParameterEvaluator(Bank.class, KFSParameterKeyConstants.BANK_CODE_DOCUMENT_TYPES, documentTypeCode);
    return evaluator.evaluationSucceeds();
}
Also used : ParameterEvaluator(org.kuali.kfs.core.api.parameter.ParameterEvaluator) Cacheable(org.springframework.cache.annotation.Cacheable)

Aggregations

ParameterEvaluator (org.kuali.kfs.core.api.parameter.ParameterEvaluator)18 KualiDecimal (org.kuali.kfs.core.api.util.type.KualiDecimal)9 ParameterEvaluatorService (org.kuali.kfs.core.api.parameter.ParameterEvaluatorService)8 ArrayList (java.util.ArrayList)5 DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)5 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)4 EntityAddress (org.kuali.kfs.kim.impl.identity.address.EntityAddress)4 CuDisbursementVoucherPayeeDetailExtension (edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension)3 List (java.util.List)3 AccountingLine (org.kuali.kfs.sys.businessobject.AccountingLine)3 CuDisbursementVoucherPayeeDetail (edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetail)2 AppropriationAccount (edu.cornell.kfs.coa.businessobject.AppropriationAccount)1 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)1 CuBalanceDao (edu.cornell.kfs.gl.dataaccess.CuBalanceDao)1 WebServiceCredential (edu.cornell.kfs.sys.businessobject.WebServiceCredential)1 Criteria (org.apache.ojb.broker.query.Criteria)1 QueryByCriteria (org.apache.ojb.broker.query.QueryByCriteria)1 Account (org.kuali.kfs.coa.businessobject.Account)1 IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount)1 DataDictionaryService (org.kuali.kfs.datadictionary.legacy.DataDictionaryService)1