use of org.kuali.kfs.core.api.config.property.ConfigurationService in project cu-kfs by CU-CommunityApps.
the class PayeeACHAccountExtractServiceImplTest method createMockConfigurationService.
private ConfigurationService createMockConfigurationService() throws Exception {
ConfigurationService configurationService = mock(ConfigurationService.class);
when(configurationService.getPropertyValueAsString(KFSConstants.GLOBAL_ERRORS)).thenReturn(GLOBAL_ERROR_FORMAT);
return configurationService;
}
use of org.kuali.kfs.core.api.config.property.ConfigurationService in project cu-kfs by CU-CommunityApps.
the class PaymentWorksNewVendorPayeeAchServiceImplTest method buildMockConfigurationService.
private ConfigurationService buildMockConfigurationService() {
ConfigurationService configService = Mockito.mock(ConfigurationService.class);
Mockito.when(configService.getPropertyValueAsString(PaymentWorksKeyConstants.ERROR_PAYMENTWORKS_BANK_NOT_US)).thenReturn(ACH_BANK_NOT_US_ERROR_MESSAGE);
return configService;
}
use of org.kuali.kfs.core.api.config.property.ConfigurationService in project cu-kfs by CU-CommunityApps.
the class CuContractsGrantsInvoiceDocumentAction method validateBillingPeriodDateRange.
protected void validateBillingPeriodDateRange(ContractsGrantsInvoiceDocument contractsGrantsInvoiceDocument, List<String> warningMessages) throws ParseException {
Pair<Date, Date> billingPeriodDates = parseDateRange(contractsGrantsInvoiceDocument.getInvoiceGeneralDetail().getBillingPeriod());
DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
ConfigurationService configurationService = SpringContext.getBean(ConfigurationService.class);
Date billingPeriodStartDate = billingPeriodDates.getLeft();
Date billingPeriodEndDate = billingPeriodDates.getRight();
if (dateTimeService.dateDiff(billingPeriodEndDate, billingPeriodStartDate, false) >= 1) {
warningMessages.add(configurationService.getPropertyValueAsString(CUKFSKeyConstants.WARNING_CINV_BILLING_PERIOD_END_DATE_BEFORE_BILLING_PERIOD_START_DATE));
}
if (dateTimeService.dateDiff(dateTimeService.getCurrentSqlDate(), billingPeriodEndDate, false) >= 1) {
warningMessages.add(configurationService.getPropertyValueAsString(CUKFSKeyConstants.WARNING_CINV_BILLING_PERIOD_END_DATE_AFTER_TODAY));
}
Date lastBilledDate = contractsGrantsInvoiceDocument.getInvoiceGeneralDetail().getLastBilledDate();
if (dateTimeService.dateDiff(billingPeriodEndDate, lastBilledDate, false) >= 1) {
warningMessages.add(configurationService.getPropertyValueAsString(CUKFSKeyConstants.WARNING_CINV_BILLING_PERIOD_END_DATE_BEFORE_LAST_BILLED_DATE));
}
if (dateTimeService.dateDiff(billingPeriodEndDate, lastBilledDate, false) <= -1) {
warningMessages.add(configurationService.getPropertyValueAsString(CUKFSKeyConstants.WARNING_CINV_BILLING_PERIOD_END_DATE_AFTER_LAST_BILLED_DATE));
}
if (dateTimeService.dateDiff(billingPeriodStartDate, lastBilledDate, false) <= -1) {
warningMessages.add(configurationService.getPropertyValueAsString(CUKFSKeyConstants.WARNING_CINV_BILLING_PERIOD_START_DATE_AFTER_LAST_BILLED_DATE));
}
Pair<Date, Date> awardDateRange = parseDateRange(contractsGrantsInvoiceDocument.getInvoiceGeneralDetail().getAwardDateRange());
if (dateTimeService.dateDiff(billingPeriodStartDate, awardDateRange.getLeft(), false) >= 1) {
warningMessages.add(configurationService.getPropertyValueAsString(CUKFSKeyConstants.WARNING_CINV_BILLING_PERIOD_START_DATE_BEFORE_AWARD_START_DATE));
}
}
use of org.kuali.kfs.core.api.config.property.ConfigurationService in project cu-kfs by CU-CommunityApps.
the class CuContractsGrantsInvoiceDocumentAction method getContractsGrantsInvoiceDocumentWarningMessage.
protected String getContractsGrantsInvoiceDocumentWarningMessage(ContractsGrantsInvoiceDocument contractsGrantsInvoiceDocument) {
if (contractsGrantsInvoiceDocument.isCorrectionDocument()) {
return StringUtils.EMPTY;
}
List<String> warningMessages = new ArrayList<>();
ConfigurationService configurationService = SpringContext.getBean(ConfigurationService.class);
if (contractsGrantsInvoiceDocument.getInvoiceGeneralDetail().isFinalBillIndicator()) {
warningMessages.add(configurationService.getPropertyValueAsString(CUKFSKeyConstants.WARNING_CINV_FINAL_BILL_INDICATOR));
}
String billingPeriod = contractsGrantsInvoiceDocument.getInvoiceGeneralDetail().getBillingPeriod();
if (StringUtils.length(billingPeriod) != CuArConstants.CINV_DATE_RANGE_EXPECTED_FORMAT_LENGTH) {
billingPeriod = StringUtils.defaultString(billingPeriod);
String warningMessage = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(CUKFSKeyConstants.WARNING_CINV_DATE_RANGE_INVALID_FORMAT_LENGTH);
warningMessages.add(MessageFormat.format(warningMessage, new String[] { billingPeriod }));
} else if (shouldValidateBillingPeriodDateRange(contractsGrantsInvoiceDocument)) {
try {
validateBillingPeriodDateRange(contractsGrantsInvoiceDocument, warningMessages);
} catch (ParseException ex) {
LOG.error("getContractsGrantsInvoiceDocumentWarningMessage: " + ex.getMessage());
String warningMessage = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(CUKFSKeyConstants.WARNING_CINV_DATE_RANGE_PARSE_EXCEPTION);
warningMessages.add(MessageFormat.format(warningMessage, new String[] { billingPeriod }));
}
}
return StringUtils.join(warningMessages, CuArConstants.QUESTION_NEWLINE_STRING);
}
use of org.kuali.kfs.core.api.config.property.ConfigurationService in project cu-kfs by CU-CommunityApps.
the class CreateDoneKualiBatchFileAdminAction method createDoneFile.
/**
* Creates a '.done' file with the name of the original file.
*/
protected String createDoneFile(String filename) {
String status = null;
String doneFileName = StringUtils.substringBeforeLast(filename, ".") + ".done";
File doneFile = new File(doneFileName);
ConfigurationService kualiConfigurationService = SpringContext.getBean(ConfigurationService.class);
if (!doneFile.exists()) {
boolean doneFileCreated = false;
try {
doneFileCreated = doneFile.createNewFile();
status = kualiConfigurationService.getPropertyValueAsString(CUKFSKeyConstants.MESSAGE_DONE_FILE_SUCCESSFULLY_CREATED);
} catch (IOException e) {
throw new RuntimeException("Errors encountered while saving the file: Unable to create .done file " + doneFileName, e);
}
if (!doneFileCreated) {
throw new RuntimeException("Errors encountered while saving the file: Unable to create .done file " + doneFileName);
}
} else {
status = kualiConfigurationService.getPropertyValueAsString(CUKFSKeyConstants.MESSAGE_DONE_FILE_ALREADY_EXISTS);
}
return status;
}
Aggregations