Search in sources :

Example 26 with ParameterService

use of org.kuali.kfs.coreservice.framework.parameter.ParameterService in project cu-kfs by CU-CommunityApps.

the class EzraCGCodeMappingParametersTest method setupMockParameterServiceWithMultiValueParms.

protected void setupMockParameterServiceWithMultiValueParms(ParameterNameAndMultiValue... parameters) {
    ParameterService parameterService = EasyMock.createMock(ParameterServiceImpl.class);
    for (ParameterNameAndMultiValue parameter : parameters) {
        EasyMock.expect(parameterService.getParameterValuesAsString(KFSConstants.OptionalModuleNamespaces.CONTRACTS_AND_GRANTS, KfsParameterConstants.BATCH_COMPONENT, parameter.name)).andStubReturn(createParameterValueStrings(parameter.values));
    }
    EasyMock.replay(parameterService);
    ezraService.setParameterService(parameterService);
}
Also used : ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService)

Example 27 with ParameterService

use of org.kuali.kfs.coreservice.framework.parameter.ParameterService in project cu-kfs by CU-CommunityApps.

the class CuPurchaseOrderAmendmentDocument method isContractManagementReviewRequired.

// KFSUPGRADE-339
protected boolean isContractManagementReviewRequired() {
    ParameterService parameterService = SpringContext.getBean(ParameterService.class);
    KualiDecimal automaticPurchaseOrderDefaultLimit = new KualiDecimal(parameterService.getParameterValueAsString(RequisitionDocument.class, PurapParameterConstants.AUTOMATIC_PURCHASE_ORDER_DEFAULT_LIMIT_AMOUNT));
    return ((ObjectUtils.isNull(automaticPurchaseOrderDefaultLimit)) || (automaticPurchaseOrderDefaultLimit.compareTo(this.getTotalDollarAmount()) < 0));
}
Also used : RequisitionDocument(org.kuali.kfs.module.purap.document.RequisitionDocument) ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal)

Example 28 with ParameterService

use of org.kuali.kfs.coreservice.framework.parameter.ParameterService in project cu-kfs by CU-CommunityApps.

the class CuRequisitionDocument method isB2BTotalAmountForAutoPO.

protected boolean isB2BTotalAmountForAutoPO() {
    boolean returnValue = false;
    ParameterService parameterService = SpringContext.getBean(ParameterService.class);
    String autoPOAmountString = new String(parameterService.getParameterValueAsString(RequisitionDocument.class, CUPurapParameterConstants.B2B_TOTAL_AMOUNT_FOR_AUTO_PO));
    KualiDecimal autoPOAmount = new KualiDecimal(autoPOAmountString);
    // KFSPTS-1625
    String routedBy = getRoutedByPrincipalId();
    if (StringUtils.isBlank(routedBy)) {
        routedBy = this.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId();
    }
    if (KimApiServiceLocator.getPermissionService().hasPermission(routedBy, CUKFSConstants.ParameterNamespaces.PURCHASING, CUPurapConstants.B2B_HIGHER_LIMIT_PERMISSION)) {
        String paramVal = parameterService.getParameterValueAsString(RequisitionDocument.class, CUPurapParameterConstants.B2B_TOTAL_AMOUNT_FOR_SUPER_USER_AUTO_PO);
        if (StringUtils.isNotBlank(paramVal)) {
            autoPOAmount = new KualiDecimal(paramVal);
        }
    }
    RequisitionDocument document = null;
    try {
        document = (RequisitionDocument) (SpringContext.getBean(DocumentService.class).getByDocumentHeaderId(this.getDocumentNumber()));
    } catch (WorkflowException we) {
    }
    KualiDecimal totalAmount = document.getFinancialSystemDocumentHeader().getFinancialDocumentTotalAmount();
    if (ObjectUtils.isNotNull(autoPOAmount) && ObjectUtils.isNotNull(totalAmount) && (autoPOAmount.compareTo(totalAmount) >= 0)) {
        returnValue = true;
    } else {
        returnValue = false;
    }
    return returnValue;
}
Also used : RequisitionDocument(org.kuali.kfs.module.purap.document.RequisitionDocument) ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal)

Example 29 with ParameterService

use of org.kuali.kfs.coreservice.framework.parameter.ParameterService in project cu-kfs by CU-CommunityApps.

the class CuRequisitionDocument method getAccountsForAwardRouting.

public List<Account> getAccountsForAwardRouting() {
    List<Account> accounts = new ArrayList<Account>();
    ParameterService parameterService = SpringContext.getBean(ParameterService.class);
    for (PurApItem item : (List<PurApItem>) this.getItems()) {
        for (PurApAccountingLine accountingLine : item.getSourceAccountingLines()) {
            if (isObjectCodeAllowedForAwardRouting(accountingLine, parameterService)) {
                if (ObjectUtils.isNull(accountingLine.getAccount())) {
                    accountingLine.refreshReferenceObject("account");
                }
                if (accountingLine.getAccount() != null && !accounts.contains(accountingLine.getAccount())) {
                    accounts.add(accountingLine.getAccount());
                }
            }
        }
    }
    return accounts;
}
Also used : RequisitionAccount(org.kuali.kfs.module.purap.businessobject.RequisitionAccount) Account(org.kuali.kfs.coa.businessobject.Account) ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) PurApItem(org.kuali.kfs.module.purap.businessobject.PurApItem) PurApAccountingLine(org.kuali.kfs.module.purap.businessobject.PurApAccountingLine) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)29 ArrayList (java.util.ArrayList)9 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)9 List (java.util.List)4 PurApAccountingLine (org.kuali.kfs.module.purap.businessobject.PurApAccountingLine)4 PurApItem (org.kuali.kfs.module.purap.businessobject.PurApItem)4 ParameterEvaluator (org.kuali.rice.core.api.parameter.ParameterEvaluator)4 ParameterEvaluatorService (org.kuali.rice.core.api.parameter.ParameterEvaluatorService)4 CuDisbursementVoucherPayeeDetailExtension (edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension)3 HashMap (java.util.HashMap)3 Account (org.kuali.kfs.coa.businessobject.Account)3 DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)3 RequisitionDocument (org.kuali.kfs.module.purap.document.RequisitionDocument)3 KfsParameterConstants (org.kuali.kfs.sys.service.impl.KfsParameterConstants)3 EntityAddress (org.kuali.rice.kim.api.identity.address.EntityAddress)3 Date (java.sql.Date)2 ParseException (java.text.ParseException)2 Calendar (java.util.Calendar)2 BenefitsCalculation (org.kuali.kfs.module.ld.businessobject.BenefitsCalculation)2 PreEncumbranceSourceAccountingLine (edu.cornell.kfs.fp.businessobject.PreEncumbranceSourceAccountingLine)1