/**
   * Gets the fieldInfo attribute.
   *
   * @return Returns the fieldInfo.
   */
  protected List<Map<String, String>> getFieldInfo(List<EffortCertificationDetail> detailLines) {
    LOG.info("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;
  }
Esempio n. 2
0
  public boolean processSyncModularBusinessRules(Document document) {
    if (!(document instanceof BudgetDocument)) {
      return false;
    }

    boolean valid = true;

    BudgetDocument budgetDocument = (BudgetDocument) document;

    GlobalVariables.getErrorMap().addToErrorPath("document");

    List budgetPeriods = budgetDocument.getBudget().getBudgetPeriods();
    if (ObjectUtils.isNotNull(budgetPeriods) || budgetPeriods.size() >= 1) {
      BudgetPeriod period1 = (BudgetPeriod) budgetPeriods.get(0);
      if (ObjectUtils.isNull(period1.getBudgetLineItems())
          || period1.getBudgetLineItems().isEmpty()) {
        valid = false;
      }
    } else {
      valid = false;
    }

    if (!valid) {
      GlobalVariables.getErrorMap()
          .putError("modularBudget", KeyConstants.ERROR_NO_DETAILED_BUDGET);
    }

    GlobalVariables.getErrorMap().removeFromErrorPath("document");

    return valid;
  }
 public void templateBuilding(Building building) {
   if (ObjectUtils.isNotNull(building)) {
     this.setOffCampusIndicator(false);
     this.setBuildingCode(building.getBuildingCode());
     this.setCampusCode(building.getCampusCode());
     this.setCapitalAssetLine1Address(building.getBuildingStreetAddress());
     this.setCapitalAssetCityName(building.getBuildingAddressCityName());
     this.setCapitalAssetStateCode(building.getBuildingAddressStateCode());
     this.setCapitalAssetPostalCode(building.getBuildingAddressZipCode());
     this.setCapitalAssetCountryCode(building.getBuildingAddressCountryCode());
   }
 }
Esempio n. 4
0
  /**
   * Validate budget rates. Applicable rates are mandatory
   *
   * @param budgetDocument
   * @return
   */
  protected boolean processBudgetRatesBusinessRule(BudgetDocument budgetDocument) {
    boolean valid = true;
    final int APPLICABLE_RATE_LENGTH_EXCEEDED = 1;
    final int APPLICABLE_RATE_NEGATIVE = -1;

    ErrorMap errorMap = GlobalVariables.getErrorMap();
    int i = 0;
    for (BudgetRate budgetRate : budgetDocument.getBudget().getBudgetRates()) {
      String rateClassType = budgetRate.getRateClass().getRateClassTypeT().getDescription();
      String errorPath = "budgetProposalRate[" + rateClassType + "][" + i + "]";
      errorMap.addToErrorPath(errorPath);
      /* look for applicable rate */
      if (budgetRate.isApplicableRateNull()) {
        valid = false;
        errorMap.putError("applicableRate", KeyConstants.ERROR_REQUIRED_APPLICABLE_RATE);
      } else if (!BudgetDecimal.isNumeric(budgetRate.getApplicableRate().toString())) {
        valid = false;
        errorMap.putError("applicableRate", KeyConstants.ERROR_APPLICABLE_RATE_NOT_NUMERIC);
      } else {
        switch (verifyApplicableRate(budgetRate.getApplicableRate())) {
          case APPLICABLE_RATE_LENGTH_EXCEEDED:
            valid = false;
            errorMap.putError(
                "applicableRate",
                KeyConstants.ERROR_APPLICABLE_RATE_LIMIT,
                Constants.APPLICABLE_RATE_LIMIT);
            break;
          case APPLICABLE_RATE_NEGATIVE:
            valid = false;
            errorMap.putError("applicableRate", KeyConstants.ERROR_APPLICABLE_RATE_NEGATIVE);
            break;
        }
      }
      errorMap.removeFromErrorPath(errorPath);
      i++;
    }

    i = 0;
    for (BudgetLaRate budgetLaRate : budgetDocument.getBudget().getBudgetLaRates()) {
      String rateClassType = "";
      if (ObjectUtils.isNotNull(budgetLaRate.getRateClass())
          && ObjectUtils.isNotNull(budgetLaRate.getRateClass().getRateClassTypeT())) {
        rateClassType = budgetLaRate.getRateClass().getRateClassTypeT().getDescription();
      }
      String errorPath = "budgetRate[" + rateClassType + "][" + i + "]";
      errorMap.addToErrorPath(errorPath);
      /* look for applicable rate */
      if (budgetLaRate.isApplicableRateNull()) {
        valid = false;
        errorMap.putError("applicableRate", KeyConstants.ERROR_REQUIRED_APPLICABLE_RATE);
      } else if (!BudgetDecimal.isNumeric(budgetLaRate.getApplicableRate().toString())) {
        valid = false;
        errorMap.putError("applicableRate", KeyConstants.ERROR_APPLICABLE_RATE_NOT_NUMERIC);
      } else {
        switch (verifyApplicableRate(budgetLaRate.getApplicableRate())) {
          case APPLICABLE_RATE_LENGTH_EXCEEDED:
            valid = false;
            errorMap.putError(
                "applicableRate",
                KeyConstants.ERROR_APPLICABLE_RATE_LIMIT,
                Constants.APPLICABLE_RATE_LIMIT);
            break;
          case APPLICABLE_RATE_NEGATIVE:
            valid = false;
            errorMap.putError("applicableRate", KeyConstants.ERROR_APPLICABLE_RATE_NEGATIVE);
            break;
        }
      }
      errorMap.removeFromErrorPath(errorPath);
      i++;
    }

    return valid;
  }
  /**
   * @see
   *     org.kuali.kfs.sys.businessobject.inquiry.KfsInquirableImpl#getInquiryUrl(org.kuali.rice.kns.bo.BusinessObject,
   *     java.lang.String, boolean)
   */
  @Override
  public HtmlData getInquiryUrl(
      BusinessObject businessObject, String attributeName, boolean forceInquiry) {
    KEMIDHistoricalReportingGroup historicalReportingGroup =
        (KEMIDHistoricalReportingGroup) businessObject;
    if (EndowPropertyConstants.KEMID_CRNT_REP_GRP_UNITS.equals(attributeName)
        && ObjectUtils.isNotNull(historicalReportingGroup.getUnits())) {

      Properties params = new Properties();
      params.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, KFSConstants.SEARCH_METHOD);
      params.put(
          KFSConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, KEMIDHistoricalTaxLot.class.getName());
      params.put(KNSConstants.DOC_FORM_KEY, "88888888");
      params.put(KFSConstants.HIDE_LOOKUP_RETURN_LINK, "true");
      params.put(
          KFSConstants.BACK_LOCATION,
          SpringContext.getBean(KualiConfigurationService.class)
                  .getPropertyString(KNSConstants.APPLICATION_URL_KEY)
              + "/"
              + KFSConstants.MAPPING_PORTAL
              + ".do");
      params.put(
          KFSConstants.LOOKUP_READ_ONLY_FIELDS,
          EndowPropertyConstants.KEMID
              + ","
              + EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_PURPOSE_CD
              + ","
              + EndowPropertyConstants.KEMID_HIST_TAX_LOT_REP_GRP
              + ","
              + EndowPropertyConstants.KEMID_HIST_TAX_LOT_IP_IND
              + ","
              + EndowPropertyConstants.KEMID_HIST_TAX_LOT_SECURITY_ID
              + ","
              + EndowPropertyConstants.KEMID_HIST_TAX_LOT_REGIS_CD
              + ","
              + EndowPropertyConstants.KEMID_HIST_TAX_LOT_BALANCE_DATE
              + ","
              + EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_CLOSED_IND
              + ","
              + EndowPropertyConstants.KEMID_HIST_TAX_LOT_REGIS_DESC
              + ","
              + EndowPropertyConstants.KEMID_HIST_TAX_LOT_SEC_DESC
              + ","
              + EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_SHORT_TTL
              + ","
              + EndowPropertyConstants.KEMID_HIST_TAX_LOT_PURPOSE_DESC
              + ","
              + EndowPropertyConstants.KEMID_HIST_TAX_LOT_INC_PRIN_DESC
              + ","
              + EndowPropertyConstants.MONTH_END_DATE_ID);

      params.put(
          EndowPropertyConstants.KEMID,
          UrlFactory.encode(String.valueOf(historicalReportingGroup.getKemid())));
      params.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_PURPOSE_CD,
          UrlFactory.encode(historicalReportingGroup.getKemidObj().getPurposeCode()));
      params.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_REP_GRP,
          UrlFactory.encode(historicalReportingGroup.getReportingGroupCode()));
      params.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_IP_IND,
          UrlFactory.encode(historicalReportingGroup.getIpIndicator()));
      params.put(
          EndowPropertyConstants.KEMID_HIST_REP_GRP_SEC_ID,
          UrlFactory.encode(historicalReportingGroup.getSecurityId()));
      params.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_REGIS_CD,
          UrlFactory.encode(historicalReportingGroup.getRegistrationCode()));
      params.put(
          EndowPropertyConstants.MONTH_END_DATE_ID,
          UrlFactory.encode(String.valueOf(historicalReportingGroup.getHistoryBalanceDateId())));
      params.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_CLOSED_IND,
          historicalReportingGroup.getKemidObj().isClose() ? "Yes" : "No");
      params.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_REGIS_DESC,
          historicalReportingGroup.getRegistration().getName());
      params.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_SEC_DESC,
          historicalReportingGroup.getSecurity().getDescription());
      params.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_SHORT_TTL,
          historicalReportingGroup.getKemidObj().getShortTitle());
      params.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_PURPOSE_DESC,
          historicalReportingGroup.getKemidObj().getPurpose().getName());
      params.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_INC_PRIN_DESC,
          historicalReportingGroup.getIncomePrincipalIndicator().getName());

      String url = UrlFactory.parameterizeUrl(KNSConstants.LOOKUP_ACTION, params);

      Map<String, String> fieldList = new HashMap<String, String>();
      fieldList.put(EndowPropertyConstants.KEMID, historicalReportingGroup.getKemid().toString());
      fieldList.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_PURPOSE_CD,
          historicalReportingGroup.getKemidObj().getPurposeCode());
      fieldList.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_REP_GRP,
          historicalReportingGroup.getReportingGroupCode());
      fieldList.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_IP_IND,
          historicalReportingGroup.getIpIndicator());
      fieldList.put(
          EndowPropertyConstants.KEMID_HIST_REP_GRP_SEC_ID,
          historicalReportingGroup.getSecurityId());
      fieldList.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_REGIS_CD,
          historicalReportingGroup.getRegistrationCode());
      fieldList.put(
          EndowPropertyConstants.MONTH_END_DATE_ID,
          String.valueOf(historicalReportingGroup.getHistoryBalanceDateId()));
      fieldList.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_CLOSED_IND,
          historicalReportingGroup.getKemidObj().isClose() ? "Yes" : "No");
      fieldList.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_REGIS_DESC,
          historicalReportingGroup.getRegistration().getName());
      fieldList.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_SEC_DESC,
          historicalReportingGroup.getSecurity().getDescription());
      fieldList.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_SHORT_TTL,
          historicalReportingGroup.getKemidObj().getShortTitle());
      fieldList.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_PURPOSE_DESC,
          historicalReportingGroup.getKemidObj().getPurpose().getName());
      fieldList.put(
          EndowPropertyConstants.KEMID_HIST_TAX_LOT_INC_PRIN_DESC,
          historicalReportingGroup.getIncomePrincipalIndicator().getName());

      return getHyperLink(KEMIDHistoricalTaxLot.class, fieldList, url);
    }
    return super.getInquiryUrl(businessObject, attributeName, forceInquiry);
  }