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