private void populateVirtualP2Values(
     P2TypeSpecificConfigModel model, VirtualRepoDescriptor descriptor) {
   if (descriptor.getP2() == null || descriptor.getP2().getUrls() == null) {
     return;
   }
   Map<String, String> urlToRepoKeyMap = getUrlToRepoKeyMapping(descriptor.getRepositories());
   List<P2Repo> p2Repos = Lists.newArrayList();
   descriptor
       .getP2()
       .getUrls()
       .stream()
       .forEach(
           url -> {
             if (StringUtils.startsWith(url, "local://")) {
               Optional.ofNullable(resolveLocalP2RepoFromUrl(url)).ifPresent(p2Repos::add);
             } else {
               urlToRepoKeyMap
                   .keySet()
                   .stream()
                   .map(RepoConfigDescriptorBuilder::getUrlWithoutSubpath)
                   .filter(
                       p2Url ->
                           RepoConfigDescriptorBuilder.getUrlWithoutSubpath(url).equals(p2Url))
                   .findAny()
                   .ifPresent(
                       containingUrl ->
                           p2Repos.add(new P2Repo(null, urlToRepoKeyMap.get(containingUrl), url)));
             }
           });
   model.setP2Repos(p2Repos);
 }
  /** Populate model configuration from virtual repository descriptor */
  public void populateVirtualRepositoryConfigValuesToModel(
      VirtualRepoDescriptor descriptor, VirtualRepositoryConfigModel model) {
    // General
    GeneralRepositoryConfigModel general = new GeneralRepositoryConfigModel();
    general.setRepoKey(descriptor.getKey());
    model.setGeneral(general);

    // Basic
    VirtualBasicRepositoryConfigModel basic = new VirtualBasicRepositoryConfigModel();
    Optional.ofNullable(descriptor.getRepoLayout())
        .ifPresent(layout -> basic.setLayout(layout.getName()));
    basic.setPublicDescription(descriptor.getDescription());
    basic.setInternalDescription(descriptor.getNotes());
    basic.setExcludesPattern(descriptor.getExcludesPattern());
    basic.setIncludesPattern(descriptor.getIncludesPattern());
    List<RepoDescriptor> repositories = descriptor.getRepositories();
    VirtualRepoResolver resolver = new VirtualRepoResolver(descriptor);
    List<String> resolvedDesc =
        resolver
            .getOrderedRepos()
            .stream()
            .map(RealRepoDescriptor::getKey)
            .collect(Collectors.toList());
    basic.setResolvedRepositories(resolvedDesc);
    basic.setSelectedRepositories(
        repositories.stream().map(VirtualSelectedRepository::new).collect(Collectors.toList()));
    model.setBasic(basic);

    // Advanced
    VirtualAdvancedRepositoryConfigModel advanced = new VirtualAdvancedRepositoryConfigModel();
    advanced.setRetrieveRemoteArtifacts(
        descriptor.isArtifactoryRequestsCanRetrieveRemoteArtifacts());
    model.setAdvanced(advanced);

    // Type specific
    TypeSpecificConfigModel typeSpecific =
        createVirtualTypeSpecific(descriptor.getType(), descriptor);
    model.setTypeSpecific(typeSpecific);
  }