use of org.kuali.kfs.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.kfs.core.api.parameter.ParameterEvaluator in project cu-kfs by CU-CommunityApps.
the class AccountGlobalRule method checkSubFundGroup.
/**
* This method checks to see if any SubFund Group rules were violated Specifically: if SubFundGroup is empty or not "PFCMR" we
* cannot have a campus code or building code if SubFundGroup is "PFCMR" then campus code and building code "must" be entered
* and be valid codes
*
* @param maintenanceDocument
* @return false on rules violation
*/
protected boolean checkSubFundGroup(AccountGlobalDetail detail) {
LOG.info("checkSubFundGroup called");
boolean success = true;
String subFundGroupCode = newAccountGlobal.getSubFundGroupCode();
Account account = detail.getAccount();
String errorPath = KFSPropertyConstants.ACCOUNT_CHANGE_DETAILS;
if (account.getAccountDescription() != null) {
String campusCode = account.getAccountDescription().getCampusCode();
String buildingCode = account.getAccountDescription().getBuildingCode();
// check if sub fund group code is blank
if (StringUtils.isBlank(subFundGroupCode)) {
// check if campus code and building code are NOT blank
if (StringUtils.isNotBlank(campusCode) || StringUtils.isNotBlank(buildingCode)) {
// if sub_fund_grp_cd is blank, campus code should NOT be entered
if (StringUtils.isNotBlank(campusCode)) {
putFieldError(errorPath, COAKeyConstants.ERROR_DOCUMENT_ACCMAINT_BLANK_SUBFUNDGROUP_WITH_CAMPUS_CD_FOR_BLDG, subFundGroupCode);
success &= false;
}
// if sub_fund_grp_cd is blank, then bldg_cd should NOT be entered
if (StringUtils.isNotBlank(buildingCode)) {
putFieldError(errorPath, COAKeyConstants.ERROR_DOCUMENT_ACCMAINT_BLANK_SUBFUNDGROUP_WITH_BUILDING_CD, subFundGroupCode);
success &= false;
}
} else {
// if all sub fund group, campus code, building code are all blank return true
return success;
}
} else if (StringUtils.isNotBlank(subFundGroupCode) && ObjectUtils.isNotNull(account.getSubFundGroup())) {
// Attempt to get the right SubFundGroup code to check the following logic with. If the value isn't available, go
// ahead
// and die, as this indicates a mis-configured application, and important business rules wont be implemented without it.
ParameterEvaluator evaluator = /*REFACTORME*/
SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator(Account.class, ACCT_CAPITAL_SUBFUNDGROUP, subFundGroupCode.trim());
if (evaluator.evaluationSucceeds()) {
// if sub_fund_grp_cd is 'PFCMR' then campus_cd must be entered
if (StringUtils.isBlank(campusCode)) {
putFieldError(errorPath, COAKeyConstants.ERROR_DOCUMENT_ACCMAINT_CAMS_SUBFUNDGROUP_WITH_MISSING_CAMPUS_CD_FOR_BLDG, subFundGroupCode);
success &= false;
}
// if sub_fund_grp_cd is 'PFCMR' then bldg_cd must be entered
if (StringUtils.isBlank(buildingCode)) {
putFieldError(errorPath, COAKeyConstants.ERROR_DOCUMENT_ACCMAINT_CAMS_SUBFUNDGROUP_WITH_MISSING_BUILDING_CD, subFundGroupCode);
success &= false;
}
} else {
// if sub_fund_grp_cd is NOT 'PFCMR', campus code should NOT be entered
if (StringUtils.isNotBlank(campusCode)) {
putFieldError(KFSPropertyConstants.ACCOUNT_DESCRIPTION + "." + KFSPropertyConstants.CAMPUS_CODE, COAKeyConstants.ERROR_DOCUMENT_ACCMAINT_NONCAMS_SUBFUNDGROUP_WITH_CAMPUS_CD_FOR_BLDG, subFundGroupCode);
success &= false;
}
// if sub_fund_grp_cd is NOT 'PFCMR' then bldg_cd should NOT be entered
if (StringUtils.isNotBlank(buildingCode)) {
putFieldError(KFSPropertyConstants.ACCOUNT_DESCRIPTION + "." + KFSPropertyConstants.BUILDING_CODE, COAKeyConstants.ERROR_DOCUMENT_ACCMAINT_NONCAMS_SUBFUNDGROUP_WITH_BUILDING_CD, subFundGroupCode);
success &= false;
}
}
}
}
return success;
}
use of org.kuali.kfs.core.api.parameter.ParameterEvaluator in project cu-kfs by CU-CommunityApps.
the class DisbursementVoucherDocument method templateEmployee.
/**
* Convenience method to set dv payee detail fields based on a given Employee.
*
* @param employee
*/
public void templateEmployee(Person employee) {
if (employee == null) {
return;
}
this.getDvPayeeDetail().setDisbursementVoucherPayeeTypeCode(KFSConstants.PaymentPayeeTypes.EMPLOYEE);
this.getDvPayeeDetail().setDisbVchrPayeeIdNumber(employee.getEmployeeId());
this.getDvPayeeDetail().setDisbVchrPayeePersonName(employee.getName());
final ParameterService parameterService = this.getParameterService();
if (parameterService.parameterExists(DisbursementVoucherDocument.class, FPParameterConstants.USE_DEFAULT_EMPLOYEE_ADDRESS) && parameterService.getParameterValueAsBoolean(DisbursementVoucherDocument.class, FPParameterConstants.USE_DEFAULT_EMPLOYEE_ADDRESS)) {
this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr(employee.getAddressLine1Unmasked());
this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr(employee.getAddressLine2Unmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCityName(employee.getAddressCityUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeStateCode(employee.getAddressStateProvinceCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeZipCode(employee.getAddressPostalCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(employee.getAddressCountryCodeUnmasked());
} else {
final EntityAddress address = getNonDefaultAddress(employee);
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(address.getPostalCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(address.getCountryCodeUnmasked());
} else {
this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr("");
this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr("");
this.getDvPayeeDetail().setDisbVchrPayeeCityName("");
this.getDvPayeeDetail().setDisbVchrPayeeStateCode("");
this.getDvPayeeDetail().setDisbVchrPayeeZipCode("");
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode("");
}
}
// "Is this payee an employee" = No
if (employee.isActive()) {
this.getDvPayeeDetail().setDisbVchrPayeeEmployeeCode(true);
} else {
this.getDvPayeeDetail().setDisbVchrPayeeEmployeeCode(false);
}
// I'm assuming that if a tax id type code other than 'TAX' is present, then the employee must be foreign
for (String externalIdentifierTypeCode : employee.getExternalIdentifiers().keySet()) {
if (KimConstants.PersonExternalIdentifierTypes.TAX.equals(externalIdentifierTypeCode)) {
this.getDvPayeeDetail().setDisbVchrNonresidentPaymentCode(false);
}
}
// Determine if employee is a research subject
ParameterEvaluator researchPaymentReasonCodeEvaluator = /*REFACTORME*/
SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator(DisbursementVoucherDocument.class, FPParameterConstants.RESEARCH_PAYMENT_REASONS, this.getDvPayeeDetail().getDisbVchrPaymentReasonCode());
if (researchPaymentReasonCodeEvaluator.evaluationSucceeds()) {
if (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)) {
this.getDvPayeeDetail().setDvPayeeSubjectPaymentCode(true);
}
}
}
}
this.disbVchrPayeeTaxControlCode = "";
this.disbVchrPayeeW9CompleteCode = true;
}
use of org.kuali.kfs.core.api.parameter.ParameterEvaluator in project cu-kfs by CU-CommunityApps.
the class GlLineServiceImpl method createAssetGlobal.
/**
* Creates asset global
*
* @param entry GeneralLedgerEntry
* @param maintDoc MaintenanceDocument
* @return AssetGlobal
*/
protected AssetGlobal createAssetGlobal(GeneralLedgerEntry entry, MaintenanceDocument maintDoc) {
AssetGlobal assetGlobal = new AssetGlobal();
assetGlobal.setOrganizationOwnerChartOfAccountsCode(entry.getChartOfAccountsCode());
assetGlobal.setOrganizationOwnerAccountNumber(entry.getAccountNumber());
assetGlobal.setDocumentNumber(maintDoc.getDocumentNumber());
assetGlobal.setConditionCode(CamsConstants.Asset.CONDITION_CODE_E);
// year end changes
String docType = DocumentTypeName.ASSET_ADD_GLOBAL;
ParameterEvaluator evaluator = parameterEvaluatorService.getParameterEvaluator(KFSConstants.CoreModuleNamespaces.KFS, KfsParameterConstants.YEAR_END_ACCOUNTING_PERIOD_PARAMETER_NAMES.DETAIL_PARAMETER_TYPE, KfsParameterConstants.YEAR_END_ACCOUNTING_PERIOD_PARAMETER_NAMES.FISCAL_PERIOD_SELECTION_DOCUMENT_TYPES, docType);
if (evaluator.evaluationSucceeds()) {
Integer closingYear = Integer.valueOf(parameterService.getParameterValueAsString(KfsParameterConstants.GENERAL_LEDGER_BATCH.class, GLParameterConstants.ANNUAL_CLOSING_FISCAL_YEAR));
if (entry.getUniversityFiscalYear().equals(closingYear + 1)) {
// default asset global year end accounting period drop down to current period instead of closing
// period(period 13)
assetGlobal.setAccountingPeriodCompositeString("");
}
}
return assetGlobal;
}
use of org.kuali.kfs.core.api.parameter.ParameterEvaluator in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherDocument method templateEmployee.
public void templateEmployee(Person employee) {
if (employee == null) {
return;
}
this.getDvPayeeDetail().setDisbursementVoucherPayeeTypeCode(KFSConstants.PaymentPayeeTypes.EMPLOYEE);
if (StringUtils.isNotBlank(employee.getEmployeeId())) {
this.getDvPayeeDetail().setDisbVchrPayeeIdNumber(employee.getEmployeeId());
((CuDisbursementVoucherPayeeDetailExtension) this.getDvPayeeDetail().getExtension()).setDisbVchrPayeeIdType(CuDisbursementVoucherConstants.DV_PAYEE_ID_TYP_EMPL);
} else {
this.getDvPayeeDetail().setDisbVchrPayeeIdNumber(employee.getPrincipalId());
((CuDisbursementVoucherPayeeDetailExtension) this.getDvPayeeDetail().getExtension()).setDisbVchrPayeeIdType(CuDisbursementVoucherConstants.DV_PAYEE_ID_TYP_ENTITY);
}
((CuDisbursementVoucherPayeeDetailExtension) this.getDvPayeeDetail().getExtension()).setPayeeTypeSuffix(StringUtils.EMPTY);
// Changed this from employee.getName to employee.getNameUnmasked() otherwise "Xxxxxx" appears on the DV!
this.getDvPayeeDetail().setDisbVchrPayeePersonName(employee.getNameUnmasked());
final ParameterService parameterService = this.getParameterService();
if (parameterService.parameterExists(DisbursementVoucherDocument.class, FPParameterConstants.USE_DEFAULT_EMPLOYEE_ADDRESS) && parameterService.getParameterValueAsBoolean(DisbursementVoucherDocument.class, FPParameterConstants.USE_DEFAULT_EMPLOYEE_ADDRESS)) {
this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr(employee.getAddressLine1Unmasked());
this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr(employee.getAddressLine2Unmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCityName(employee.getAddressCityUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeStateCode(employee.getAddressStateProvinceCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeZipCode(employee.getAddressPostalCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(employee.getAddressCountryCodeUnmasked());
} else {
final EntityAddress address = getNonDefaultAddress(employee);
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(address.getPostalCodeUnmasked());
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(address.getCountryCodeUnmasked());
} else {
this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr("");
this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr("");
this.getDvPayeeDetail().setDisbVchrPayeeCityName("");
this.getDvPayeeDetail().setDisbVchrPayeeStateCode("");
this.getDvPayeeDetail().setDisbVchrPayeeZipCode("");
this.getDvPayeeDetail().setDisbVchrPayeeCountryCode("");
}
}
// "Is this payee an employee" = No
if (employee.isActive()) {
this.getDvPayeeDetail().setDisbVchrPayeeEmployeeCode(true);
} else {
this.getDvPayeeDetail().setDisbVchrPayeeEmployeeCode(false);
}
// I'm assuming that if a tax id type code other than 'TAX' is present, then the employee must be foreign
for (String externalIdentifierTypeCode : employee.getExternalIdentifiers().keySet()) {
if (KimConstants.PersonExternalIdentifierTypes.TAX.equals(externalIdentifierTypeCode)) {
this.getDvPayeeDetail().setDisbVchrNonresidentPaymentCode(false);
}
}
// Determine if employee is a research subject
ParameterEvaluator researchPaymentReasonCodeEvaluator = SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator(DisbursementVoucherDocument.class, FPParameterConstants.RESEARCH_PAYMENT_REASONS, this.getDvPayeeDetail().getDisbVchrPaymentReasonCode());
if (researchPaymentReasonCodeEvaluator.evaluationSucceeds()) {
if (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)) {
this.getDvPayeeDetail().setDvPayeeSubjectPaymentCode(true);
}
}
}
}
this.disbVchrPayeeTaxControlCode = "";
this.disbVchrPayeeW9CompleteCode = true;
}
Aggregations