/**
  * convert PrivacyLevelObjectKeyFilter 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
  *     "PrivacyLevelObject")
  * @return Map the output Map
  */
 public static Map toMap(PrivacyLevelObjectKeyFilter in, Map record, String rootName) {
   Integer iVal = null;
   if (record == null) record = new HashMap();
   if (rootName == null) rootName = "PrivacyLevelObject";
   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 PrivacyLevelObjectKeyFilter.
   *
   * @param record the Map containing the data to convert to the object, not including the root
   * @return PrivacyLevelObjectKeyFilter the converted object
   */
  public static PrivacyLevelObjectKeyFilter getFilter(Map record) {
    Object[] list = null;
    Object obj = null;
    if (record == null) return null;
    PrivacyLevelObjectKeyFilter out = new PrivacyLevelObjectKeyFilter();

    Map LevelMap = (Map) record.get("Level");
    Boolean LevelFetch = DataHelper.getFetch(LevelMap);
    Boolean LevelSortDir = DataHelper.getSortDirection(LevelMap);
    Integer LevelSortOrder = DataHelper.getSortOrder(LevelMap);
    if (LevelFetch != null) out.setLevelFetch(LevelFetch);
    if (LevelSortDir != null) out.setLevelSortDirection(LevelSortDir);
    if (LevelSortOrder != null) out.setLevelSortOrder(LevelSortOrder);

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

    Map LanguageCodeMap = (Map) record.get("LanguageCode");
    Boolean LanguageCodeFetch = DataHelper.getFetch(LanguageCodeMap);
    Boolean LanguageCodeSortDir = DataHelper.getSortDirection(LanguageCodeMap);
    Integer LanguageCodeSortOrder = DataHelper.getSortOrder(LanguageCodeMap);
    if (LanguageCodeFetch != null) out.setLanguageCodeFetch(LanguageCodeFetch);
    if (LanguageCodeSortDir != null) out.setLanguageCodeSortDirection(LanguageCodeSortDir);
    if (LanguageCodeSortOrder != null) out.setLanguageCodeSortOrder(LanguageCodeSortOrder);

    Filter[] LanguageCodeFilter = DataHelper.mapToFilterArray(LanguageCodeMap, Integer.class);
    if (LanguageCodeFilter != null) {
      IntegerFilter[] LanguageCodeFilters = new IntegerFilter[LanguageCodeFilter.length];
      for (int i = 0; i < LanguageCodeFilters.length; i++) {
        LanguageCodeFilters[i] = (IntegerFilter) LanguageCodeFilter[i];
      }
      try {
        out.setLanguageCodeFilter(LanguageCodeFilters);
      } 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;
  }