/** @return a List of the names of fields which are marked in data dictionary as return fields. */
  @SuppressWarnings("deprecation")
  @Override
  protected Properties getParameters(
      BusinessObject bo, Map fieldConversions, String lookupImpl, List pkNames) {
    Properties parameters = new Properties();
    parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.RETURN_METHOD_TO_CALL);
    parameters.put(KRADConstants.DOC_FORM_KEY, getDocFormKey());
    parameters.put(KRADConstants.REFRESH_CALLER, lookupImpl);
    if (ObjectUtils.isNotNull(getReferencesToRefresh())) {
      parameters.put(KRADConstants.REFERENCES_TO_REFRESH, getReferencesToRefresh());
    }

    for (Object o : getReturnKeys()) {
      String fieldNm = (String) o;

      Object fieldVal = ObjectUtils.getPropertyValue(bo, fieldNm);
      if (ObjectUtils.isNull(fieldVal)) {
        fieldVal = KRADConstants.EMPTY_STRING;
      }

      // Encrypt value if it is a secure field
      if (fieldConversions.containsKey(fieldNm)) {
        fieldNm = (String) fieldConversions.get(fieldNm);
      }

      if (SpringContext.getBean(BusinessObjectAuthorizationService.class)
          .attributeValueNeedsToBeEncryptedOnFormsAndLinks(bo.getClass(), fieldNm)) {}

      // need to format date in url
      if (fieldVal instanceof Date) {
        DateFormatter dateFormatter = new DateFormatter();
        fieldVal = dateFormatter.format(fieldVal);
      }

      parameters.put(fieldNm, fieldVal.toString());
    }

    return parameters;
  }
  private String getCustomerOpenInvoicesReportUrl(
      BusinessObject bo, String columnTitle, Map<String, String> fieldsMap) {

    Properties parameters = new Properties();

    ContractsAndGrantsAgingReport detail = (ContractsAndGrantsAgingReport) bo;

    parameters.put(
        KFSConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE,
        ContractsGrantsAgingOpenInvoicesReport.class.getName());
    parameters.put(
        "lookupableImplementaionServiceName", "arContractsGrantsAgingOpenInvoicesReportLookupable");
    parameters.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, KFSConstants.SEARCH_METHOD);
    parameters.put(
        "reportName", ArConstants.ContractsGrantsAgingReportFields.OPEN_INVOCE_REPORT_NAME);
    parameters.put(KFSConstants.DOC_FORM_KEY, "88888888");

    if (ObjectUtils.isNotNull(fieldsMap) && !fieldsMap.isEmpty()) {
      for (String key : fieldsMap.keySet()) {
        String val = fieldsMap.get(key);
        // put if val is not blank or null
        if (ObjectUtils.isNotNull(val) && StringUtils.isNotEmpty(val)) {
          parameters.put(key.toString(), fieldsMap.get(key).toString());
        }
      }
    }

    parameters.put(KFSPropertyConstants.CUSTOMER_NUMBER, detail.getCustomerNumber());
    parameters.put(KFSPropertyConstants.CUSTOMER_NAME, detail.getCustomerName());

    // Report Option
    if (ObjectUtils.isNotNull(reportOption)) {

      parameters.put(
          ArPropertyConstants.ContractsGrantsAgingReportFields.REPORT_OPTION, reportOption);
    }
    // Report Run Date
    DateFormatter dateFormatter = new DateFormatter();
    parameters.put(
        ArPropertyConstants.ContractsGrantsAgingReportFields.REPORT_RUN_DATE,
        dateFormatter.format(reportRunDate).toString());

    // put bucket dates
    if (StringUtils.equals(columnTitle, customerNumberLabel)) {
      parameters.put("columnTitle", KFSConstants.CustomerOpenItemReport.ALL_DAYS);
      parameters.put("startDate", "");
      parameters.put("endDate", dateFormatter.format(reportRunDate).toString());
    } else {
      if (StringUtils.equals(columnTitle, cutoffdate30Label)) {
        parameters.put(
            "startDate", dateFormatter.format(DateUtils.addDays(reportRunDate, -30)).toString());
        parameters.put("endDate", dateFormatter.format(reportRunDate).toString());
      } else if (StringUtils.equals(columnTitle, cutoffdate60Label)) {
        parameters.put(
            "startDate", dateFormatter.format(DateUtils.addDays(reportRunDate, -60)).toString());
        parameters.put(
            "endDate", dateFormatter.format(DateUtils.addDays(reportRunDate, -31)).toString());
      } else if (StringUtils.equals(columnTitle, cutoffdate90Label)) {
        parameters.put(
            "startDate", dateFormatter.format(DateUtils.addDays(reportRunDate, -90)).toString());
        parameters.put("endDate", dateFormatter.format(DateUtils.addDays(reportRunDate, -61)));
      } else if (StringUtils.equals(columnTitle, cutoffdate91toSYSPRlabel)) {
        parameters.put(
            "startDate", dateFormatter.format(DateUtils.addDays(reportRunDate, -120)).toString());
        parameters.put(
            "endDate", dateFormatter.format(DateUtils.addDays(reportRunDate, -91)).toString());
      } else if (StringUtils.equals(columnTitle, cutoffdateSYSPRplus1orMorelabel)) {
        parameters.put("startDate", "");
        parameters.put(
            "endDate", dateFormatter.format(DateUtils.addDays(reportRunDate, -121)).toString());
        columnTitle =
            Integer.toString((Integer.parseInt(nbrDaysForLastBucket)) + 1) + " days and older";
      } else {
        parameters.put("startDate", "");
        parameters.put("endDate", dateFormatter.format(reportRunDate).toString());
      }
      parameters.put("columnTitle", columnTitle);
    }
    return UrlFactory.parameterizeUrl(
        "arContractsGrantsAgingOpenInvoicesReportLookup.do", parameters);
  }
Beispiel #3
0
 /**
  * Gets the current date from the DateTimeService.
  *
  * @see org.kuali.rice.krad.valuefinder.ValueFinder#getValue()
  */
 public String getValue() {
   DateTimeService dts = SpringContext.getBean(DateTimeService.class);
   DateFormatter df = new DateFormatter();
   return df.format(dts.getCurrentSqlDateMidnight()).toString();
 }