use of org.kuali.kfs.core.api.datetime.DateTimeService in project cu-kfs by CU-CommunityApps.
the class CuFormatAction method prepare.
@Override
public ActionForward prepare(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
CuFormatForm formatForm = (CuFormatForm) form;
DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
if (formatForm.getCampus() == null) {
return mapping.findForward(PdpConstants.MAPPING_SELECTION);
}
// Figure out which ones they have selected
List<CustomerProfile> selectedCustomers = new ArrayList<>();
for (CustomerProfile customer : formatForm.getCustomers()) {
if (customer.isSelectedForFormat()) {
selectedCustomers.add(customer);
}
}
Date paymentDate = dateTimeService.convertToSqlDate(formatForm.getPaymentDate());
Person kualiUser = GlobalVariables.getUserSession().getPerson();
FormatProcessSummary formatProcessSummary = ((CuFormatService) formatService).startFormatProcess(kualiUser, formatForm.getCampus(), selectedCustomers, paymentDate, formatForm.getPaymentTypes(), formatForm.getPaymentDistribution());
if (formatProcessSummary.getProcessSummaryList().size() == 0) {
KNSGlobalVariables.getMessageList().add(PdpKeyConstants.Format.ERROR_PDP_NO_MATCHING_PAYMENT_FOR_FORMAT);
return mapping.findForward(PdpConstants.MAPPING_SELECTION);
}
formatForm.setFormatProcessSummary(formatProcessSummary);
return mapping.findForward(PdpConstants.MAPPING_CONTINUE);
}
use of org.kuali.kfs.core.api.datetime.DateTimeService in project cu-kfs by CU-CommunityApps.
the class FormatAction method start.
/**
* This method prepares the data for the format process
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
FormatForm formatForm = (FormatForm) form;
Person kualiUser = GlobalVariables.getUserSession().getPerson();
FormatSelection formatSelection = formatService.getDataForFormat(kualiUser);
DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
formatForm.setCampus(kualiUser.getCampusCode());
// no data for format because another format process is already running
if (formatSelection.getStartDate() != null) {
GlobalVariables.getMessageMap().putError(KFSConstants.GLOBAL_ERRORS, PdpKeyConstants.Format.ERROR_PDP_FORMAT_PROCESS_ALREADY_RUNNING, dateTimeService.toDateTimeString(formatSelection.getStartDate()));
} else {
List<CustomerProfile> customers = formatSelection.getCustomerList();
for (CustomerProfile element : customers) {
if (formatSelection.getCampus().equals(element.getDefaultPhysicalCampusProcessingCode())) {
element.setSelectedForFormat(Boolean.TRUE);
} else {
element.setSelectedForFormat(Boolean.FALSE);
}
}
formatForm.setPaymentDate(dateTimeService.toDateString(dateTimeService.getCurrentTimestamp()));
formatForm.setPaymentTypes(PdpConstants.PaymentTypes.ALL);
formatForm.setCustomers(customers);
formatForm.setRanges(formatSelection.getRangeList());
}
return mapping.findForward(PdpConstants.MAPPING_SELECTION);
}
use of org.kuali.kfs.core.api.datetime.DateTimeService in project cu-kfs by CU-CommunityApps.
the class DisencumbranceEnterpriseFeederFileSetType method getFileName.
/**
* Return the file name based on information from user and file user identifier
*
* @param user Person object representing user who uploaded file
* @param fileUserIdentifer String representing user who uploaded file
* @return String enterprise feeder formated file name string using information from user and file user identifier
* @see org.kuali.kfs.sys.batch.BatchInputFileSetType#getFileName(java.lang.String, org.kuali.kfs.kim.bo.Person,
* java.lang.String)
*/
public String getFileName(String fileType, String principalName, String fileUserIdentifer, Date creationDate) {
DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
StringBuilder buf = new StringBuilder();
fileUserIdentifer = StringUtils.deleteWhitespace(fileUserIdentifer);
fileUserIdentifer = StringUtils.remove(fileUserIdentifer, FILE_NAME_PART_DELIMITER);
buf.append(FILE_NAME_PREFIX).append(FILE_NAME_PART_DELIMITER).append(principalName).append(FILE_NAME_PART_DELIMITER).append(fileUserIdentifer).append(FILE_NAME_PART_DELIMITER).append(dateTimeService.toDateTimeStringForFilename(creationDate)).append(getFileExtension(fileType));
return buf.toString();
}
use of org.kuali.kfs.core.api.datetime.DateTimeService in project cu-kfs by CU-CommunityApps.
the class VendorRule method validateDOBDate.
protected boolean validateDOBDate(VendorDetail vDetail) {
DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
Date today = dateTimeService.getCurrentDate();
if (ObjectUtils.isNotNull(vDetail.getVendorHeader().getVendorDOB())) {
Date dobDate = vDetail.getVendorHeader().getVendorDOB();
if (ObjectUtils.isNotNull(dobDate) && today.compareTo(dobDate) <= 0) {
putFieldError(VendorPropertyConstants.VENDOR_DOB, VendorKeyConstants.ERROR_VENDOR_W8ANDW9_SIGNED_AFTER_TODAY);
return false;
}
}
return true;
}
use of org.kuali.kfs.core.api.datetime.DateTimeService in project cu-kfs by CU-CommunityApps.
the class VendorRule method validateW8SignedDate.
protected boolean validateW8SignedDate(VendorDetail vDetail) {
if (ObjectUtils.isNotNull(vDetail.getVendorHeader().getVendorW8BenReceivedIndicator()) && vDetail.getVendorHeader().getVendorW8BenReceivedIndicator()) {
if (SpringContext.getBean(ParameterService.class).getParameterValueAsBoolean(VendorDetail.class, VendorParameterConstants.W8_DATA_REQUIRED_IND)) {
DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
Date today = dateTimeService.getCurrentDate();
if (ObjectUtils.isNotNull(vDetail.getVendorHeader().getVendorW8SignedDate())) {
Date signedDate = vDetail.getVendorHeader().getVendorW8SignedDate();
if (today.compareTo(signedDate) <= 0) {
putFieldError(VendorPropertyConstants.VENDOR_W8SIGNED_DATE, VendorKeyConstants.ERROR_VENDOR_W8ANDW9_SIGNED_AFTER_TODAY);
return false;
}
} else {
putFieldError(VendorPropertyConstants.VENDOR_W8SIGNED_DATE, VendorKeyConstants.ERROR_VENDOR_W8SINGED_DATE_REQUIRED);
return false;
}
}
}
return true;
}
Aggregations