use of org.kuali.kfs.core.api.config.property.ConfigurationService in project cu-kfs by CU-CommunityApps.
the class ConcurManageRefreshTokenAction method updateFormValues.
protected void updateFormValues(ConcurManageRefreshTokenForm concurTokenForm, boolean displayUpdateRefreshTokenMessage, boolean displayUpdateRequestTokenMessage) {
ConfigurationService configService = getConfigurationService();
concurTokenForm.setNonProdWarning(configService.getPropertyValueAsString(ConcurKeyConstants.MESSAGE_CONCUR_REFRESH_TOKEN_NONPROD_WARNING));
concurTokenForm.setDisplayNonProdWarning(!isProduction());
String refreshTokenUpdateDate = MessageFormat.format(configService.getPropertyValueAsString(ConcurKeyConstants.MESSAGE_CONCUR_TOKEN_DATE), "refresh", getTokenUpdateTimestamp(ConcurConstants.ConcurOAuth2.WebServiceCredentialKeys.REFRESH_TOKEN).toString());
String updateRefreshSuccessMessage = MessageFormat.format(configService.getPropertyValueAsString(ConcurKeyConstants.MESSAGE_CONCUR_TOKEN_UPDATE_SUCCESS), "refresh");
concurTokenForm.setRefreshTokenUpdateDate(refreshTokenUpdateDate);
concurTokenForm.setUpdateRefreshTokenMessage(updateRefreshSuccessMessage);
concurTokenForm.setDisplayUpdateRefreshTokenMessage(displayUpdateRefreshTokenMessage);
String requestTokenUpdateDate = MessageFormat.format(configService.getPropertyValueAsString(ConcurKeyConstants.MESSAGE_CONCUR_TOKEN_DATE), "request", getTokenUpdateTimestamp(ConcurConstants.ConcurOAuth2.WebServiceCredentialKeys.REQUEST_TOKEN).toString());
String updateRequestSuccessMessage = MessageFormat.format(configService.getPropertyValueAsString(ConcurKeyConstants.MESSAGE_CONCUR_TOKEN_UPDATE_SUCCESS), "request");
concurTokenForm.setRequestTokenUpdateDate(requestTokenUpdateDate);
concurTokenForm.setUpdateRequestTokenMessage(updateRequestSuccessMessage);
concurTokenForm.setDisplayUpdateRequestTokenMessage(displayUpdateRequestTokenMessage);
concurTokenForm.setUpdateRequestTokenInstructions(getConcurBatchUtilityService().getConcurParameterValue(ConcurParameterConstants.CONCUR_OAUTH2_REPLACE_REQUEST_TOKEN_INSTRUCTIONS));
concurTokenForm.setNewRequestToken(StringUtils.EMPTY);
}
use of org.kuali.kfs.core.api.config.property.ConfigurationService in project cu-kfs by CU-CommunityApps.
the class CuContractsGrantsInvoiceDocumentAction method promptForFinalBillConfirmation.
protected ActionForward promptForFinalBillConfirmation(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, String caller, String warningMessage, ContractsGrantsInvoiceDocument contractsGrantsInvoiceDocument) throws Exception {
ActionForward forward = null;
Object question = request.getParameter(KFSConstants.QUESTION_INST_ATTRIBUTE_NAME);
if (question == null) {
return performQuestionWithoutInput(mapping, form, request, response, CuArConstants.CINV_FINAL_BILL_INDICATOR_CONFIRMATION_QUESTION, warningMessage, KFSConstants.CONFIRMATION_QUESTION, caller, StringUtils.EMPTY);
}
Object buttonClicked = request.getParameter(KFSConstants.QUESTION_CLICKED_BUTTON);
if (CuArConstants.CINV_FINAL_BILL_INDICATOR_CONFIRMATION_QUESTION.equals(question)) {
if (ConfirmationQuestion.NO.equals(buttonClicked)) {
forward = mapping.findForward(KFSConstants.MAPPING_BASIC);
} else if (ConfirmationQuestion.YES.equals(buttonClicked)) {
try {
Pair<Date, Date> billingPeriod = parseDateRange(contractsGrantsInvoiceDocument.getInvoiceGeneralDetail().getBillingPeriod());
Date billingPeriodEndDate = billingPeriod.getRight();
DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
if (dateTimeService.dateDiff(billingPeriodEndDate, contractsGrantsInvoiceDocument.getInvoiceGeneralDetail().getLastBilledDate(), false) != 0) {
contractsGrantsInvoiceDocument.getInvoiceGeneralDetail().setLastBilledDate(billingPeriodEndDate);
}
} catch (Exception ex) {
ConfigurationService configurationService = SpringContext.getBean(ConfigurationService.class);
String message = configurationService.getPropertyValueAsString(CUKFSKeyConstants.ERROR_CINV_SETTING_LAST_BILLED_DATE);
GlobalVariables.getMessageMap().putError(KFSConstants.GLOBAL_ERRORS, KFSKeyConstants.ERROR_CUSTOM, message);
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
}
}
return forward;
}
use of org.kuali.kfs.core.api.config.property.ConfigurationService in project cu-kfs by CU-CommunityApps.
the class CuAutoDisapproveDocumentsServiceImpl method buildSuccessMessage.
private String buildSuccessMessage(Document document) throws Exception {
StringBuilder headerBuilder = new StringBuilder();
headerBuilder.append(document.getDocumentNumber());
headerBuilder.append(TAB);
headerBuilder.append(document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName());
headerBuilder.append(TAB);
headerBuilder.append(document.getDocumentHeader().getDocumentDescription());
headerBuilder.append(TAB);
headerBuilder.append(getPersonService().getPerson(document.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId()).getPrincipalName());
headerBuilder.append(TAB);
headerBuilder.append(getPersonService().getPerson(document.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId()).getName());
headerBuilder.append(TAB);
headerBuilder.append(document.getDocumentHeader().getWorkflowDocument().getDateCreated());
headerBuilder.append(TAB);
ConfigurationService k = KRADServiceLocator.getKualiConfigurationService();
StringBuilder routeBuilder = new StringBuilder();
String url = k.getPropertyValueAsString("workflow.url");
routeBuilder.append(url);
routeBuilder.append("/RouteLog.do?routeHeaderId=");
routeBuilder.append(document.getDocumentNumber());
routeBuilder.append(TAB);
headerBuilder.append(routeBuilder);
List<ActionTaken> actions;
// try {
// actions = KEWServiceLocator.getActionTakenService().findByDocumentId(document.getDocumentHeader().getWorkflowDocument().getDocumentId());
actions = KEWServiceLocator.getActionTakenService().findByDocumentIdIgnoreCurrentInd(document.getDocumentNumber());
ActionTaken max = null;
for (ActionTaken at : actions) {
if (ObjectUtils.isNull(max)) {
max = at;
} else if (at.getActionDate().compareTo(max.getActionDate()) > 0) {
max = at;
}
}
headerBuilder.append(getPersonService().getPerson(max.getPrincipalId()).getPrincipalName());
headerBuilder.append(TAB);
headerBuilder.append(getPersonService().getPerson(max.getPrincipalId()).getName());
headerBuilder.append(TAB);
headerBuilder.append(max.getActionDate());
headerBuilder.append(TAB);
headerBuilder.append(max.getActionTakenLabel());
headerBuilder.append(TAB);
// } catch (WorkflowException e) {
// e.printStackTrace();
// }
String headerString = headerBuilder.toString();
StringBuilder builder = new StringBuilder();
if (document instanceof AccountingDocumentBase) {
for (Object o : ((AccountingDocumentBase) document).getSourceAccountingLines()) {
SourceAccountingLine sal = (SourceAccountingLine) o;
builder.append(headerString);
builder.append(sal.getChartOfAccountsCode());
builder.append(TAB);
builder.append(sal.getAccountNumber());
builder.append(TAB);
builder.append(sal.getAmount());
builder.append(TAB);
builder.append(sal.getAccount().getOrganizationCode());
builder.append(TAB);
builder.append(KFSConstants.NEWLINE);
}
for (Object o : ((AccountingDocumentBase) document).getTargetAccountingLines()) {
TargetAccountingLine tal = (TargetAccountingLine) o;
builder.append(headerString);
builder.append(tal.getChartOfAccountsCode());
builder.append(TAB);
builder.append(tal.getAccountNumber());
builder.append(TAB);
builder.append(tal.getAmount());
builder.append(TAB);
builder.append(tal.getAccount().getOrganizationCode());
builder.append(TAB);
builder.append(KFSConstants.NEWLINE);
}
}
return builder.toString();
}
use of org.kuali.kfs.core.api.config.property.ConfigurationService in project cu-kfs by CU-CommunityApps.
the class PreferencesServiceImpl method getPreferences.
public Preferences getPreferences(String principalId) {
if (LOG.isDebugEnabled()) {
LOG.debug("start preferences fetch user " + principalId);
}
Collection<UserOptions> options = getUserOptionService().findByWorkflowUser(principalId);
Map<String, UserOptions> optionMap = new HashMap<>();
Map<String, String> optionValueMap = new HashMap<>();
Map<String, String> documentTypeNotificationPreferences = new HashMap<>();
for (UserOptions option : options) {
if (option.getOptionId().endsWith(KewApiConstants.DOCUMENT_TYPE_NOTIFICATION_PREFERENCE_SUFFIX)) {
String preferenceName = option.getOptionId();
preferenceName = StringUtils.substringBeforeLast(preferenceName, KewApiConstants.DOCUMENT_TYPE_NOTIFICATION_PREFERENCE_SUFFIX);
documentTypeNotificationPreferences.put(preferenceName, option.getOptionVal());
} else {
optionMap.put(option.getOptionId(), option);
}
}
ConfigurationService kcs = CoreApiServiceLocator.getKualiConfigurationService();
boolean isSaveRequired = false;
for (Map.Entry<String, String> entry : USER_OPTION_KEY_DEFAULT_MAP.entrySet()) {
String optionKey = entry.getKey();
String defaultValue = kcs.getPropertyValueAsString(entry.getValue());
if (LOG.isDebugEnabled()) {
LOG.debug("start fetch option " + optionKey + " user " + principalId);
}
UserOptions option = optionMap.get(optionKey);
if (option == null) {
if (LOG.isDebugEnabled()) {
LOG.debug("User option '" + optionKey + "' on user " + principalId + " has no stored value. Preferences will require save.");
}
option = new UserOptions();
option.setWorkflowId(principalId);
option.setOptionId(optionKey);
option.setOptionVal(defaultValue);
// just in case referenced a second time
optionMap.put(optionKey, option);
if (!isSaveRequired) {
if (!optionKey.equals(Preferences.KEYS.USE_OUT_BOX) || ConfigContext.getCurrentContextConfig().getOutBoxOn()) {
isSaveRequired = true;
}
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("End fetch option " + optionKey + " user " + principalId);
}
optionValueMap.put(optionKey, option.getOptionVal());
}
return Preferences.Builder.create(optionValueMap, documentTypeNotificationPreferences, isSaveRequired).build();
}
use of org.kuali.kfs.core.api.config.property.ConfigurationService in project cu-kfs by CU-CommunityApps.
the class CreateAccountingDocumentServiceImplTest method setUp.
@Before
public void setUp() throws Exception {
ConfigurationService configurationService = buildMockConfigurationService();
DateTimeService dateTimeService = buildMockDateTimeService();
ParameterService parameterService = buildParameterService();
CuDisbursementVoucherDefaultDueDateService cuDisbursementVoucherDefaultDueDateService = buildCuDisbursementVoucherDefaultDueDateService();
createAccountingDocumentService = new TestCreateAccountingDocumentServiceImpl(buildMockPersonService(), buildAccountingXmlDocumentDownloadAttachmentService(), configurationService, buildMockFiscalYearFunctionControlService(), buildMockDisbursementVoucherTravelService(), buildMockUniversityDateService(), buildAccountingPeriodService(), dateTimeService, cuDisbursementVoucherDefaultDueDateService, buildCuDisbursementVoucherPayeeService(), buildMockVendorService());
createAccountingDocumentService.initializeDocumentGeneratorsFromMappings(AccountingDocumentMapping.DI_DOCUMENT, AccountingDocumentMapping.IB_DOCUMENT, AccountingDocumentMapping.TF_DOCUMENT, AccountingDocumentMapping.BA_DOCUMENT, AccountingDocumentMapping.SB_DOCUMENT, AccountingDocumentMapping.YEDI_DOCUMENT, AccountingDocumentMapping.DV_DOCUMENT, AccountingDocumentMapping.YEBA_DOCUMENT, AccountingDocumentMapping.YETF_DOCUMENT, AccountingDocumentMapping.AV_DOCUMENT);
createAccountingDocumentService.setAccountingDocumentBatchInputFileType(buildAccountingXmlDocumentInputFileType(dateTimeService));
createAccountingDocumentService.setBatchInputFileService(new BatchInputFileServiceImpl());
createAccountingDocumentService.setFileStorageService(buildFileStorageService());
createAccountingDocumentService.setConfigurationService(configurationService);
createAccountingDocumentService.setDocumentService(buildMockDocumentService());
createAccountingDocumentService.setCreateAccountingDocumentReportService(new TestCreateAccountingDocumentReportService());
createAccountingDocumentService.setParameterService(parameterService);
createAccountingDocumentService.setCreateAccountingDocumentValidationService(buildCreateAccountingDocumentValidationService(configurationService));
routedAccountingDocuments = new ArrayList<>();
creationOrderedBaseFileNames = new ArrayList<>();
createTargetTestDirectory();
dateFormat = new SimpleDateFormat(CUKFSConstants.DATE_FORMAT_yyyyMMdd, Locale.US);
}
Aggregations