Search in sources :

Example 1 with DateTimeService

use of org.kuali.rice.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.rice.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();
}
Also used : DateTimeService(org.kuali.rice.core.api.datetime.DateTimeService)

Example 2 with DateTimeService

use of org.kuali.rice.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);
}
Also used : FormatSelection(org.kuali.kfs.pdp.businessobject.FormatSelection) CustomerProfile(org.kuali.kfs.pdp.businessobject.CustomerProfile) Person(org.kuali.rice.kim.api.identity.Person) DateTimeService(org.kuali.rice.core.api.datetime.DateTimeService)

Example 3 with DateTimeService

use of org.kuali.rice.core.api.datetime.DateTimeService in project cu-kfs by CU-CommunityApps.

the class ConcurStandardAccountingExtractCreateCollectorFileServiceImplTest method buildCollectorFileService.

protected ConcurStandardAccountingExtractCreateCollectorFileService buildCollectorFileService() throws Exception {
    DateTimeService dateTimeService = buildDateTimeService();
    TestConcurStandardAccountingExtractCreateCollectorFileServiceImpl collectorFileServiceImpl = new TestConcurStandardAccountingExtractCreateCollectorFileServiceImpl();
    collectorFileServiceImpl.setDateTimeService(dateTimeService);
    collectorFileServiceImpl.setBatchFileLookupableHelperService(buildBatchFileLookupableHelperService(dateTimeService));
    collectorFileServiceImpl.setCollectorBatchBuilder(buildMockBatchBuilder());
    collectorFileServiceImpl.setCollectorDirectoryPath(COLLECTOR_OUTPUT_DIRECTORY_PATH);
    collectorFileServiceImpl.setCollectorFlatFileSerializerService(buildCollectorFlatFileSerializerService(dateTimeService));
    return collectorFileServiceImpl;
}
Also used : DateTimeService(org.kuali.rice.core.api.datetime.DateTimeService)

Example 4 with DateTimeService

use of org.kuali.rice.core.api.datetime.DateTimeService in project cu-kfs by CU-CommunityApps.

the class AwardStep method execute.

public boolean execute(String arg0, java.util.Date arg1) throws InterruptedException {
    String dateString = parameterService.getParameterValueAsString(PARAMETER_NAMESPACE_CODE, PARAMETER_NAMESPACE_STEP, LAST_SUCCESSFUL_RUN);
    LOG.info("AwardStep last successful run parm value= " + dateString);
    DateTimeService dtService = SpringContext.getBean(DateTimeService.class);
    java.sql.Date lastRun = null;
    if (dateString != null) {
        try {
            lastRun = dtService.convertToSqlDate(dateString);
        } catch (ParseException e1) {
            e1.printStackTrace();
        }
    }
    boolean result = ezraService.updateAwardsSince(lastRun);
    if (result) {
        Parameter parm = parameterService.getParameter(PARAMETER_NAMESPACE_CODE, PARAMETER_NAMESPACE_STEP, LAST_SUCCESSFUL_RUN);
        Parameter.Builder newParm = Parameter.Builder.create(parm);
        newParm.setValue(dtService.toDateTimeString(dtService.getCurrentSqlDate()));
        parameterService.updateParameter(newParm.build());
    // //parameterService.
    }
    return result;
}
Also used : Parameter(org.kuali.kfs.coreservice.api.parameter.Parameter) ParseException(java.text.ParseException) DateTimeService(org.kuali.rice.core.api.datetime.DateTimeService)

Example 5 with DateTimeService

use of org.kuali.rice.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 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);
}
Also used : FormatProcessSummary(org.kuali.kfs.pdp.businessobject.FormatProcessSummary) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) CustomerProfile(org.kuali.kfs.pdp.businessobject.CustomerProfile) DateTimeService(org.kuali.rice.core.api.datetime.DateTimeService) Person(org.kuali.rice.kim.api.identity.Person) Date(java.util.Date) CuFormatService(edu.cornell.kfs.pdp.service.CuFormatService)

Aggregations

DateTimeService (org.kuali.rice.core.api.datetime.DateTimeService)12 CustomerProfile (org.kuali.kfs.pdp.businessobject.CustomerProfile)4 Person (org.kuali.rice.kim.api.identity.Person)4 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 List (java.util.List)3 ParseException (java.text.ParseException)2 Parameter (org.kuali.kfs.coreservice.api.parameter.Parameter)2 FormatProcessSummary (org.kuali.kfs.pdp.businessobject.FormatProcessSummary)2 FormatSelection (org.kuali.kfs.pdp.businessobject.FormatSelection)2 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)2 CuFormatService (edu.cornell.kfs.pdp.service.CuFormatService)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 StringBufferInputStream (java.io.StringBufferInputStream)1 SimpleDateFormat (java.text.SimpleDateFormat)1 HashMap (java.util.HashMap)1 ServletOutputStream (javax.servlet.ServletOutputStream)1 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)1 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)1 LaborEnterpriseFeedStep (org.kuali.kfs.module.ld.batch.LaborEnterpriseFeedStep)1