@Override
  @SuppressWarnings("rawtypes")
  public BusinessObject getBusinessObject(Map fieldValues) {
    SalaryGroupBo salaryGroup = null;

    if (StringUtils.isNotBlank((String) fieldValues.get("hrSalGroupId"))) {
      salaryGroup =
          SalaryGroupBo.from(
              HrServiceLocator.getSalaryGroupService()
                  .getSalaryGroup((String) fieldValues.get("hrSalGroupId")));
    } else if (StringUtils.isNotBlank((String) fieldValues.get("hrSalGroup"))
        && StringUtils.isNotBlank((String) fieldValues.get("effectiveDate"))) {
      String hrSalGroup = (String) fieldValues.get("hrSalGroup");
      String effDate = (String) fieldValues.get("effectiveDate");
      LocalDate effectiveDate =
          StringUtils.isBlank(effDate) ? LocalDate.now() : TKUtils.formatDateString(effDate);

      salaryGroup =
          SalaryGroupBo.from(
              HrServiceLocator.getSalaryGroupService().getSalaryGroup(hrSalGroup, effectiveDate));
    } else {
      salaryGroup = (SalaryGroupBo) super.getBusinessObject(fieldValues);
    }

    return salaryGroup;
  }
  @SuppressWarnings({"rawtypes", "unchecked"})
  private void injectSubQueries(
      Criteria root, Class<? extends HrBusinessObjectContract> hrBOClass, Map formProps) {
    // create the effective date filter criteria
    Criteria effectiveDateFilter = new Criteria();
    LocalDate fromEffdt =
        TKUtils.formatDateString(TKUtils.getFromDateString((String) formProps.get(EFFECTIVE_DATE)));
    LocalDate toEffdt =
        TKUtils.formatDateString(TKUtils.getToDateString((String) formProps.get(EFFECTIVE_DATE)));
    if (fromEffdt != null) {
      effectiveDateFilter.addGreaterOrEqualThan(EFFECTIVE_DATE, fromEffdt.toDate());
    }
    if (toEffdt != null) {
      effectiveDateFilter.addLessOrEqualThan(EFFECTIVE_DATE, toEffdt.toDate());
    }
    if (fromEffdt == null && toEffdt == null) {
      effectiveDateFilter.addLessOrEqualThan(EFFECTIVE_DATE, LocalDate.now().toDate());
    }

    List<String> businessKeys = new ArrayList<String>();
    try {
      businessKeys =
          (List<String>) hrBOClass.getDeclaredField(BUSINESS_KEYS_VAR_NAME).get(hrBOClass);
    } catch (NoSuchFieldException e) {
      LOG.warn(hrBOClass.getName() + DOES_NOT_CONTAIN_BUSINESS_KEYS_MESSAGE);
    } catch (IllegalAccessException e) {
      LOG.warn(hrBOClass.getName() + DOES_NOT_CONTAIN_BUSINESS_KEYS_MESSAGE);
    }

    // inject the subqueries
    root.addEqualTo(
        EFFECTIVE_DATE,
        OjbSubQueryUtil.getEffectiveDateSubQueryWithFilter(
            hrBOClass, effectiveDateFilter, businessKeys, false));
    root.addEqualTo(
        TIMESTAMP, OjbSubQueryUtil.getTimestampSubQuery(hrBOClass, businessKeys, false));
  }