Search in sources :

Example 1 with ParameterEvaluator

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

the class WebServiceCredentialAuthorizer method canMaintain.

@Override
public boolean canMaintain(Object dataObject, Person user) {
    if (!super.canMaintain(dataObject, user)) {
        return false;
    }
    WebServiceCredential webServiceCredential = (WebServiceCredential) dataObject;
    ParameterEvaluator parameterEvaluator = getParameterEvaluatorService().getParameterEvaluator(WebServiceCredential.class, CUKFSParameterKeyConstants.NON_EDITABLE_CREDENTIAL_VALUES, webServiceCredential.getCredentialGroupCode(), webServiceCredential.getCredentialKey());
    return !parameterEvaluator.evaluationSucceeds();
}
Also used : WebServiceCredential(edu.cornell.kfs.sys.businessobject.WebServiceCredential) ParameterEvaluator(org.kuali.rice.core.api.parameter.ParameterEvaluator)

Example 2 with ParameterEvaluator

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

the class CuDisbursementVoucherDocument method populateDocumentForRouting.

@Override
public void populateDocumentForRouting() {
    CuDisbursementVoucherPayeeDetail payeeDetail = getDvPayeeDetail();
    if (payeeDetail.isVendor()) {
        payeeDetail.setDisbVchrPayeeEmployeeCode(getVendorService().isVendorInstitutionEmployee(payeeDetail.getDisbVchrVendorHeaderIdNumberAsInteger()));
        payeeDetail.setDvPayeeSubjectPaymentCode(getVendorService().isSubjectPaymentVendor(payeeDetail.getDisbVchrVendorHeaderIdNumberAsInteger()));
    } else if (payeeDetail.isEmployee() || payeeDetail.isStudent() || payeeDetail.isAlumni()) {
        // Determine if employee student or alumni is a research subject
        ParameterEvaluator researchPaymentReasonCodeEvaluator = /*REFACTORME*/
        SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_PAYMENT_REASONS_PARM_NM, payeeDetail.getDisbVchrPaymentReasonCode());
        if (researchPaymentReasonCodeEvaluator.evaluationSucceeds()) {
            if (getParameterService().parameterExists(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM)) {
                String researchPayLimit = getParameterService().getParameterValueAsString(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM);
                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 : CuDisbursementVoucherPayeeDetail(edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetail) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) ParameterEvaluator(org.kuali.rice.core.api.parameter.ParameterEvaluator) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument)

Example 3 with ParameterEvaluator

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

the class CuDisbursementVoucherDocument method templateStudent.

/**
 * Convenience method to set dv payee detail fields based on a given student.
 *
 * @param student
 */
public void templateStudent(Person student) {
    if (student == null) {
        return;
    }
    this.getDvPayeeDetail().setDisbursementVoucherPayeeTypeCode(CuDisbursementVoucherConstants.DV_PAYEE_TYPE_STUDENT);
    this.getDvPayeeDetail().setDisbVchrPayeeIdNumber(student.getPrincipalId());
    ((CuDisbursementVoucherPayeeDetailExtension) this.getDvPayeeDetail().getExtension()).setDisbVchrPayeeIdType(CuDisbursementVoucherConstants.DV_PAYEE_ID_TYP_ENTITY);
    ((CuDisbursementVoucherPayeeDetailExtension) this.getDvPayeeDetail().getExtension()).setPayeeTypeSuffix(StringUtils.EMPTY);
    this.getDvPayeeDetail().setDisbVchrPayeePersonName(student.getNameUnmasked());
    final ParameterService parameterService = this.getParameterService();
    // Use the same parameter as for employees even though this is a student as basic intention is the same
    if (parameterService.parameterExists(DisbursementVoucherDocument.class, DisbursementVoucherDocument.USE_DEFAULT_EMPLOYEE_ADDRESS_PARAMETER_NAME) && parameterService.getParameterValueAsBoolean(DisbursementVoucherDocument.class, DisbursementVoucherDocument.USE_DEFAULT_EMPLOYEE_ADDRESS_PARAMETER_NAME)) {
        this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr(student.getAddressLine1Unmasked());
        this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr(student.getAddressLine2Unmasked());
        this.getDvPayeeDetail().setDisbVchrPayeeCityName(student.getAddressCityUnmasked());
        this.getDvPayeeDetail().setDisbVchrPayeeStateCode(student.getAddressStateProvinceCodeUnmasked());
        this.getDvPayeeDetail().setDisbVchrPayeeZipCode(student.getAddressPostalCodeUnmasked());
        this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(student.getAddressCountryCodeUnmasked());
    } else {
        final EntityAddress address = getNonDefaultAddress(student);
        if (address != null) {
            this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr(address.getLine1Unmasked());
            this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr(address.getLine2Unmasked());
            this.getDvPayeeDetail().setDisbVchrPayeeCityName(address.getCityUnmasked());
            this.getDvPayeeDetail().setDisbVchrPayeeStateCode(address.getStateProvinceCodeUnmasked());
            this.getDvPayeeDetail().setDisbVchrPayeeZipCode(student.getAddressPostalCodeUnmasked());
            this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(address.getCountryCodeUnmasked());
        } else {
            this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr("");
            this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr("");
            this.getDvPayeeDetail().setDisbVchrPayeeCityName("");
            this.getDvPayeeDetail().setDisbVchrPayeeStateCode("");
            this.getDvPayeeDetail().setDisbVchrPayeeZipCode("");
            this.getDvPayeeDetail().setDisbVchrPayeeCountryCode("");
        }
    }
    // I'm assuming that if a tax id type code other than 'TAX' is present, then the student must be foreign
    for (String externalIdentifierTypeCode : student.getExternalIdentifiers().keySet()) {
        if (KimConstants.PersonExternalIdentifierTypes.TAX.equals(externalIdentifierTypeCode)) {
            this.getDvPayeeDetail().setDisbVchrAlienPaymentCode(false);
        }
    }
    // Determine if student is a research subject
    ParameterEvaluator researchPaymentReasonCodeEvaluator = SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_PAYMENT_REASONS_PARM_NM);
    if (researchPaymentReasonCodeEvaluator.evaluationSucceeds()) {
        if (getParameterService().parameterExists(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM)) {
            String researchPayLimit = getParameterService().getParameterValueAsString(DisbursementVoucherDocument.class, DisbursementVoucherConstants.RESEARCH_NON_VENDOR_PAY_LIMIT_AMOUNT_PARM_NM);
            if (StringUtils.isNotBlank(researchPayLimit)) {
                KualiDecimal payLimit = new KualiDecimal(researchPayLimit);
                if (getDisbVchrCheckTotalAmount().isLessThan(payLimit)) {
                    this.getDvPayeeDetail().setDvPayeeSubjectPaymentCode(true);
                }
            }
        }
    }
    this.disbVchrPayeeTaxControlCode = "";
    this.disbVchrPayeeW9CompleteCode = true;
}
Also used : ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) CuDisbursementVoucherPayeeDetailExtension(edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension) EntityAddress(org.kuali.rice.kim.api.identity.address.EntityAddress) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) ParameterEvaluator(org.kuali.rice.core.api.parameter.ParameterEvaluator) ParameterEvaluatorService(org.kuali.rice.core.api.parameter.ParameterEvaluatorService) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument)

Example 4 with ParameterEvaluator

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

the class CuDisbursementVoucherDocument method isCAndGReviewRequired.

protected boolean isCAndGReviewRequired() {
    String awardThreshold = getParameterService().getParameterValueAsString("KFS-FP", "DisbursementVoucher", DOLLAR_THRESHOLD_REQUIRING_AWARD_REVIEW);
    KualiDecimal dollarThresholdDecimal = new KualiDecimal(awardThreshold);
    if (this.disbVchrCheckTotalAmount.isGreaterEqual(dollarThresholdDecimal)) {
        return true;
    }
    List<AccountingLine> theList = (List<AccountingLine>) this.sourceAccountingLines;
    for (AccountingLine alb : theList) {
        ParameterEvaluator objectCodes = SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator("KFS-FP", "DisbursementVoucher", OBJECT_CODES_REQUIRING_AWARD_REVIEW, alb.getFinancialObjectCode());
        if (objectCodes.evaluationSucceeds()) {
            LOG.info("Object Code " + alb.getFinancialObjectCode() + " requires this document to undergo Award review.");
            return true;
        }
    }
    return false;
}
Also used : AccountingLine(org.kuali.kfs.sys.businessobject.AccountingLine) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) List(java.util.List) ArrayList(java.util.ArrayList) ParameterEvaluator(org.kuali.rice.core.api.parameter.ParameterEvaluator) ParameterEvaluatorService(org.kuali.rice.core.api.parameter.ParameterEvaluatorService)

Example 5 with ParameterEvaluator

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

the class CuDisbursementVoucherDocument method isCampusReviewRequired.

protected boolean isCampusReviewRequired() {
    List<ActionTakenValue> actions = RouteContext.getCurrentRouteContext().getDocument().getActionsTaken();
    List<String> people = new ArrayList<String>();
    for (ActionTakenValue atv : actions) {
        if (!people.contains(atv.getPrincipalId())) {
            people.add(atv.getPrincipalId());
        }
    }
    if (people.size() < 2) {
        return true;
    }
    List<AccountingLine> theList = (List<AccountingLine>) this.sourceAccountingLines;
    for (AccountingLine alb : theList) {
        ParameterEvaluator objectCodes = SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator("KFS-FP", "DisbursementVoucher", OBJECT_CODES_REQUIRING_CAMPUS_REVIEW, alb.getFinancialObjectCode());
        if (objectCodes.evaluationSucceeds()) {
            LOG.info("Object Code " + alb.getFinancialObjectCode() + " requires this document to undergo Campus review.");
            return true;
        }
    }
    ParameterEvaluator paymentReasons = SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator("KFS-FP", "DisbursementVoucher", PAYMENT_REASONS_REQUIRING_CAMPUS_REVIEW, this.dvPayeeDetail.getDisbVchrPaymentReasonCode());
    if (paymentReasons.evaluationSucceeds()) {
        return true;
    }
    String dollarThreshold = getParameterService().getParameterValueAsString("KFS-FP", "DisbursementVoucher", DOLLAR_THRESHOLD_REQUIRING_CAMPUS_REVIEW);
    KualiDecimal dollarThresholdDecimal = new KualiDecimal(dollarThreshold);
    if (this.disbVchrCheckTotalAmount.isGreaterEqual(dollarThresholdDecimal)) {
        return true;
    }
    return false;
}
Also used : AccountingLine(org.kuali.kfs.sys.businessobject.AccountingLine) ActionTakenValue(org.kuali.rice.kew.actiontaken.ActionTakenValue) ArrayList(java.util.ArrayList) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) List(java.util.List) ArrayList(java.util.ArrayList) ParameterEvaluator(org.kuali.rice.core.api.parameter.ParameterEvaluator) ParameterEvaluatorService(org.kuali.rice.core.api.parameter.ParameterEvaluatorService)

Aggregations

ParameterEvaluator (org.kuali.rice.core.api.parameter.ParameterEvaluator)14 ParameterEvaluatorService (org.kuali.rice.core.api.parameter.ParameterEvaluatorService)8 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)7 ArrayList (java.util.ArrayList)5 DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)5 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)4 CuDisbursementVoucherPayeeDetailExtension (edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension)3 List (java.util.List)3 AccountingLine (org.kuali.kfs.sys.businessobject.AccountingLine)3 EntityAddress (org.kuali.rice.kim.api.identity.address.EntityAddress)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 RecurringDisbursementVoucherDocument (edu.cornell.kfs.fp.document.RecurringDisbursementVoucherDocument)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