apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigsImportService.java/ConfigsImportService/importNamespace
class ConfigsImportService:  private void importNamespace(final String appId, final Env env,
                               final String clusterName, final String namespaceName,
                               final String configText, final String format,
                               boolean ignoreConflictNamespace) {
    NamespaceDTO namespaceDTO;
    try {
      namespaceDTO = namespaceService.loadNamespaceBaseInfo(appId, env, clusterName, namespaceName);
    } catch (Exception e) {
      //not existed
      namespaceDTO = null;
    }

    if (namespaceDTO == null) {
      namespaceDTO = new NamespaceDTO();
      namespaceDTO.setAppId(appId);
      namespaceDTO.setClusterName(clusterName);
      namespaceDTO.setNamespaceName(namespaceName);
      namespaceDTO.setDataChangeCreatedBy(currentUser);
      namespaceDTO.setDataChangeLastModifiedBy(currentUser);
      namespaceDTO = namespaceService.createNamespace(env, namespaceDTO);

      roleInitializationService.initNamespaceRoles(appId, namespaceName, currentUser);
      roleInitializationService.initNamespaceEnvRoles(appId, namespaceName, currentUser);
    }

    List<ItemDTO> itemDTOS = itemService.findItems(appId, env, clusterName, namespaceName);
    // skip import if target namespace has existed items
    if (!CollectionUtils.isEmpty(itemDTOS) && ignoreConflictNamespace) {
      return;
    }

    importItems(appId, env, clusterName, namespaceName, configText, namespaceDTO);
  }