/**
  * convert AccountCodeObjectKeyFilter to a Map.
  *
  * @param in the filter object to convert to the Map
  * @param record use this Map instead of creating a new one (Optional)
  * @param rootName use this name as the root name for the object (defaults to "AccountCodeObject")
  * @return Map the output Map
  */
 public static Map toMap(AccountCodeObjectKeyFilter in, Map record, String rootName) {
   Integer iVal = null;
   if (record == null) record = new HashMap();
   if (rootName == null) rootName = "AccountCodeObject";
   Map keyMap = (Map) record.get(rootName);
   if (keyMap != null) keyMap = (Map) record.get("Key");
   keyMap.put("Key", getMap(in, keyMap));
   record.put(rootName, keyMap);
   if ((iVal = in.getIndex()) != null) record.put("Index", iVal);
   return record;
 }
  /**
   * convert Map to AccountCodeObjectKeyFilter.
   *
   * @param record the Map containing the data to convert to the object, not including the root
   * @return AccountCodeObjectKeyFilter the converted object
   */
  public static AccountCodeObjectKeyFilter getFilter(Map record) {
    Object[] list = null;
    Object obj = null;
    if (record == null) return null;
    AccountCodeObjectKeyFilter out = new AccountCodeObjectKeyFilter();

    Map AcgTrackingIdMap = (Map) record.get("AcgTrackingId");
    Boolean AcgTrackingIdFetch = DataHelper.getFetch(AcgTrackingIdMap);
    Boolean AcgTrackingIdSortDir = DataHelper.getSortDirection(AcgTrackingIdMap);
    Integer AcgTrackingIdSortOrder = DataHelper.getSortOrder(AcgTrackingIdMap);
    if (AcgTrackingIdFetch != null) out.setAcgTrackingIdFetch(AcgTrackingIdFetch);
    if (AcgTrackingIdSortDir != null) out.setAcgTrackingIdSortDirection(AcgTrackingIdSortDir);
    if (AcgTrackingIdSortOrder != null) out.setAcgTrackingIdSortOrder(AcgTrackingIdSortOrder);

    Filter[] AcgTrackingIdFilter = DataHelper.mapToFilterArray(AcgTrackingIdMap, Integer.class);
    if (AcgTrackingIdFilter != null) {
      IntegerFilter[] AcgTrackingIdFilters = new IntegerFilter[AcgTrackingIdFilter.length];
      for (int i = 0; i < AcgTrackingIdFilters.length; i++) {
        AcgTrackingIdFilters[i] = (IntegerFilter) AcgTrackingIdFilter[i];
      }
      try {
        out.setAcgTrackingIdFilter(AcgTrackingIdFilters);
      } catch (Exception x) {
        x.printStackTrace();
      }
    }

    Map AcgTrackingIdServMap = (Map) record.get("AcgTrackingIdServ");
    Boolean AcgTrackingIdServFetch = DataHelper.getFetch(AcgTrackingIdServMap);
    Boolean AcgTrackingIdServSortDir = DataHelper.getSortDirection(AcgTrackingIdServMap);
    Integer AcgTrackingIdServSortOrder = DataHelper.getSortOrder(AcgTrackingIdServMap);
    if (AcgTrackingIdServFetch != null) out.setAcgTrackingIdServFetch(AcgTrackingIdServFetch);
    if (AcgTrackingIdServSortDir != null)
      out.setAcgTrackingIdServSortDirection(AcgTrackingIdServSortDir);
    if (AcgTrackingIdServSortOrder != null)
      out.setAcgTrackingIdServSortOrder(AcgTrackingIdServSortOrder);

    Filter[] AcgTrackingIdServFilter =
        DataHelper.mapToFilterArray(AcgTrackingIdServMap, Integer.class);
    if (AcgTrackingIdServFilter != null) {
      IntegerFilter[] AcgTrackingIdServFilters = new IntegerFilter[AcgTrackingIdServFilter.length];
      for (int i = 0; i < AcgTrackingIdServFilters.length; i++) {
        AcgTrackingIdServFilters[i] = (IntegerFilter) AcgTrackingIdServFilter[i];
      }
      try {
        out.setAcgTrackingIdServFilter(AcgTrackingIdServFilters);
      } catch (Exception x) {
        x.printStackTrace();
      }
    }

    Map AccountCodeMap = (Map) record.get("AccountCode");
    Boolean AccountCodeFetch = DataHelper.getFetch(AccountCodeMap);
    Boolean AccountCodeSortDir = DataHelper.getSortDirection(AccountCodeMap);
    Integer AccountCodeSortOrder = DataHelper.getSortOrder(AccountCodeMap);
    if (AccountCodeFetch != null) out.setAccountCodeFetch(AccountCodeFetch);
    if (AccountCodeSortDir != null) out.setAccountCodeSortDirection(AccountCodeSortDir);
    if (AccountCodeSortOrder != null) out.setAccountCodeSortOrder(AccountCodeSortOrder);

    Filter[] AccountCodeFilter = DataHelper.mapToFilterArray(AccountCodeMap, String.class);
    if (AccountCodeFilter != null) {
      StringFilter[] AccountCodeFilters = new StringFilter[AccountCodeFilter.length];
      for (int i = 0; i < AccountCodeFilters.length; i++) {
        AccountCodeFilters[i] = (StringFilter) AccountCodeFilter[i];
      }
      try {
        out.setAccountCodeFilter(AccountCodeFilters);
      } catch (Exception x) {
        x.printStackTrace();
      }
    }

    Boolean Fetch = DataHelper.getFetch(record);
    if (Fetch != null) out.setFetch(Fetch);
    Integer Index = DataHelper.getIndex(record);
    if (Index != null) out.setIndex(Index);
    return out;
  }