class UrlUtils {

  public static Map<String, String> convertSubscribe(Map<String, String> subscribe) {
    Map<String, String> newSubscribe = new HashMap<String, String>();
    for (Map.Entry<String, String> entry : subscribe.entrySet()) {
      String serviceName = entry.getKey();
      String serviceQuery = entry.getValue();
      if (!serviceName.contains(":") && !serviceName.contains("/")) {
        Map<String, String> params = StringUtils.parseQueryString(serviceQuery);
        String group = params.get("group");
        String version = params.get("version");
        //params.remove("group");
        //params.remove("version");
        String name = serviceName;
        if (group != null && group.length() > 0) {
          name = group + "/" + name;
        }
        if (version != null && version.length() > 0) {
          name = name + ":" + version;
        }
        newSubscribe.put(name, StringUtils.toQueryString(params));
      } else {
        newSubscribe.put(serviceName, serviceQuery);
      }
    }
    return newSubscribe;
  }

}