Ejemplo n.º 1
0
 protected List<String> getChartCodes(Collection<Chart> charts) {
   List<String> chartCodes = new ArrayList<String>(charts.size());
   for (Chart chart : charts) {
     chartCodes.add(chart.getChartOfAccountsCode());
   }
   return chartCodes;
 }
Ejemplo n.º 2
0
  /**
   * Gets the fieldInfo attribute.
   *
   * @return Returns the fieldInfo.
   */
  protected List<Map<String, String>> getFieldInfo(List<EffortCertificationDetail> detailLines) {
    LOG.debug("getFieldInfo(List<EffortCertificationDetail>) start");

    List<Map<String, String>> fieldInfo = new ArrayList<Map<String, String>>();
    EffortCertificationDocument document = (EffortCertificationDocument) this.getDocument();
    KualiDecimal totalOriginalPayrollAmount = document.getTotalOriginalPayrollAmount();

    for (EffortCertificationDetail detailLine : detailLines) {
      detailLine.refreshNonUpdateableReferences();

      Map<String, String> fieldInfoForAttribute = new HashMap<String, String>();

      fieldInfoForAttribute.put(
          KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE,
          detailLine.getChartOfAccounts().getFinChartOfAccountDescription());

      String accountInfo = buildAccountInfo(detailLine.getAccount());
      fieldInfoForAttribute.put(KFSPropertyConstants.ACCOUNT_NUMBER, accountInfo);

      SubAccount subAccount = detailLine.getSubAccount();
      if (ObjectUtils.isNotNull(subAccount)) {
        fieldInfoForAttribute.put(
            KFSPropertyConstants.SUB_ACCOUNT_NUMBER, subAccount.getSubAccountName());
      }

      ObjectCode objectCode = detailLine.getFinancialObject();
      if (ObjectUtils.isNotNull(objectCode)) {
        fieldInfoForAttribute.put(
            KFSPropertyConstants.FINANCIAL_OBJECT_CODE, objectCode.getFinancialObjectCodeName());
      }

      Account sourceAccount = detailLine.getSourceAccount();
      if (ObjectUtils.isNotNull(sourceAccount)) {
        fieldInfoForAttribute.put(
            EffortPropertyConstants.SOURCE_ACCOUNT_NUMBER, sourceAccount.getAccountName());
      }

      Chart sourceChart = detailLine.getSourceChartOfAccounts();
      if (ObjectUtils.isNotNull(sourceChart)) {
        fieldInfoForAttribute.put(
            EffortPropertyConstants.SOURCE_CHART_OF_ACCOUNTS_CODE,
            sourceChart.getFinChartOfAccountDescription());
      }

      KualiDecimal originalPayrollAmount = detailLine.getEffortCertificationOriginalPayrollAmount();
      String actualOriginalPercent =
          PayrollAmountHolder.recalculateEffortPercentAsString(
              totalOriginalPayrollAmount, originalPayrollAmount);
      fieldInfoForAttribute.put(
          EffortPropertyConstants.EFFORT_CERTIFICATION_CALCULATED_OVERALL_PERCENT,
          actualOriginalPercent);

      fieldInfo.add(fieldInfoForAttribute);
    }

    return fieldInfo;
  }
Ejemplo n.º 3
0
  /** @see org.kuali.module.chart.service.getReportsToHierarchy() */
  @Override
  @Cacheable(value = Chart.CACHE_NAME, key = "'ReportsToHierarchy'")
  public Map<String, String> getReportsToHierarchy() {
    Map<String, String> reportsToHierarchy = new HashMap<String, String>();

    for (String chartCode : getAllChartCodes()) {
      Chart chart = businessObjectService.findBySinglePrimaryKey(Chart.class, chartCode);

      if (LOG.isDebugEnabled()) {
        LOG.debug(
            "adding "
                + chart.getChartOfAccountsCode()
                + "-->"
                + chart.getReportsToChartOfAccountsCode());
      }
      reportsToHierarchy.put(
          chart.getChartOfAccountsCode(), chart.getReportsToChartOfAccountsCode());
    }

    return reportsToHierarchy;
  }
Ejemplo n.º 4
0
 @Override
 @Cacheable(value = Chart.CACHE_NAME, key = "'{isParentChart?}'+#p0+'-->'+#p1")
 public boolean isParentChart(String potentialChildChartCode, String potentialParentChartCode) {
   if ((potentialChildChartCode == null) || (potentialParentChartCode == null)) {
     throw new IllegalArgumentException(
         "The isParentChartCode method requires a non-null potentialChildChartCode and potentialParentChartCode");
   }
   Chart thisChart = getByPrimaryId(potentialChildChartCode);
   if ((thisChart == null) || StringUtils.isBlank(thisChart.getChartOfAccountsCode())) {
     throw new IllegalArgumentException(
         "The isParentChartCode method requires a valid potentialChildChartCode");
   }
   if (thisChart.getCode().equals(thisChart.getReportsToChartOfAccountsCode())) {
     return false;
   } else if (potentialParentChartCode.equals(thisChart.getReportsToChartOfAccountsCode())) {
     return true;
   } else {
     return isParentChart(thisChart.getReportsToChartOfAccountsCode(), potentialParentChartCode);
   }
 }