public Response apply()

in src/main/java/com/googlesource/gerrit/plugins/lfs/GetLfsGlobalConfig.java [39:61]


  public Response<LfsGlobalConfigInfo> apply(ProjectResource resource) throws RestApiException {
    adminView.validate(resource);

    LfsGlobalConfigInfo info = new LfsGlobalConfigInfo();
    LfsGlobalConfig globalConfig = lfsConfigFactory.getGlobalConfig();
    info.defaultBackendType = globalConfig.getDefaultBackend().type;
    info.backends = Maps.transformValues(globalConfig.getBackends(), b -> b.type);

    List<LfsProjectConfigSection> configSections =
        lfsConfigFactory.getProjectsConfig().getConfigSections();
    if (!configSections.isEmpty()) {
      info.namespaces = new HashMap<>(configSections.size());
      for (LfsProjectConfigSection section : configSections) {
        LfsProjectConfigInfo sectionInfo = new LfsProjectConfigInfo();
        sectionInfo.enabled = section.isEnabled();
        sectionInfo.maxObjectSize = section.getMaxObjectSize();
        sectionInfo.readOnly = section.isReadOnly();
        sectionInfo.backend = section.getBackend();
        info.namespaces.put(section.getNamespace(), sectionInfo);
      }
    }
    return Response.ok(info);
  }