Exemplo n.º 1
0
  public static void main(String[] args) throws Exception {
    //		Map<String, Map<String, String>> config=IndexConfig.getCommonDocConfig();
    //		System.out.println(config.get("price").get("type"));
    String value = IndexConfig.getDefaultValue("accountType");

    System.out.println(value);
  }
Exemplo n.º 2
0
  private static Map<byte[], byte[]> packFamilyMap(
      String tableName, Result result, byte[] cf, String[] selectArray) {
    Map<byte[], byte[]> fmap = new HashMap<byte[], byte[]>();
    // 缓存复合字段一条数据,供解析子字段使用
    Map<String, Map<String, String>> compoundFieldValueMap =
        new HashMap<String, Map<String, String>>();
    for (String column : selectArray) {
      String[] temp = processField(column, Bytes.toString(cf));
      byte[] value;

      if ("ca_summary_optimize".equals(tableName) && compoundFieldMap.containsKey(temp[1])) {
        value =
            result.getValue(Bytes.toBytes(temp[0]), Bytes.toBytes(compoundFieldMap.get(temp[1])));
        if (compoundFieldValueMap.containsKey(compoundFieldMap.get(temp[1]))) {
          if (compoundFieldValueMap.get(compoundFieldMap.get(temp[1])).get(temp[1]) != null) {
            value =
                Bytes.toBytes(
                    compoundFieldValueMap.get(compoundFieldMap.get(temp[1])).get(temp[1]));
          } else {
            value = Bytes.toBytes("-");
          }
        } else {
          byte[] comValue =
              result.getValue(Bytes.toBytes(temp[0]), Bytes.toBytes(compoundFieldMap.get(temp[1])));
          if (comValue != null) {
            String str = Bytes.toString(comValue).replace("\n", "");
            Map<String, String> map =
                compoundFieldValueToMap(str, tableName, compoundFieldMap.get(temp[1]));
            compoundFieldValueMap.put(compoundFieldMap.get(temp[1]), map);
            if (map.get(temp[1]) != null) {
              value = Bytes.toBytes(map.get(temp[1]));
            } else {
              value = Bytes.toBytes("-");
            }
          }
        }
      } else {
        value = result.getValue(Bytes.toBytes(temp[0]), Bytes.toBytes(temp[1]));
      }
      if (value == null) {
        value = Bytes.toBytes(IndexConfig.getDefaultValue(tableName, column));
      }
      fmap.put(Bytes.toBytes(column), value);
    }

    return fmap;
  }