apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigsImportService.java/ConfigsImportService/importItems
class ConfigsImportService:  private void importItems(String appId, Env env, String clusterName, String namespaceName, String configText,
                           NamespaceDTO namespaceDTO) {
    List<ItemDTO> toImportItems = gson.fromJson(configText, GsonType.ITEM_DTOS);

    toImportItems.parallelStream().forEach(newItem -> {
      String key = newItem.getKey();
      newItem.setNamespaceId(namespaceDTO.getId());
      newItem.setDataChangeCreatedBy(currentUser);
      newItem.setDataChangeLastModifiedBy(currentUser);
      newItem.setDataChangeCreatedTime(new Date());
      newItem.setDataChangeLastModifiedTime(new Date());

      if (StringUtils.hasText(key)) {
        //create or update normal item
        try {
          ItemDTO oldItem = itemService.loadItem(env, appId, clusterName, namespaceName, key);
          newItem.setId(oldItem.getId());
          //existed
          itemService.updateItem(appId, env, clusterName, namespaceName, newItem);
        } catch (Exception e) {
          if (e instanceof HttpStatusCodeException && ((HttpStatusCodeException) e).getStatusCode()
              .equals(HttpStatus.NOT_FOUND)) {
            //not existed
            itemService.createItem(appId, env, clusterName, namespaceName, newItem);
          } else {
            LOGGER.error("Load or update item error. appId = {}, env = {}, cluster = {}, namespace = {}", appId, env,
                         clusterName, namespaceDTO, e);
          }
        }
      } else if (StringUtils.hasText(newItem.getComment())){
        //create comment item
        itemService.createCommentItem(appId, env, clusterName, namespaceName, newItem);
      }

    });
  }