/**
  * @param layoutName
  * @return
  */
 private RepoLayout getLayout(String layoutName) {
   RepoLayout layout = null;
   List<RepoLayout> repoLayouts = centralConfigService.getDescriptor().getRepoLayouts();
   for (RepoLayout repoLayout : repoLayouts) {
     if (repoLayout.getName().equals(layoutName)) {
       layout = repoLayout;
       break;
     }
   }
   return layout;
 }
  /** Populate model configuration from remote repository descriptor */
  public void populateRemoteRepositoryConfigValuesToModel(
      HttpRepoDescriptor descriptor, RemoteRepositoryConfigModel model) {
    GeneralRepositoryConfigModel general = createGeneralConfig(descriptor);
    model.setGeneral(general);

    RemoteBasicRepositoryConfigModel basic = createRemoteBasicConfig(descriptor);
    model.setBasic(basic);

    RemoteReplicationDescriptor replicationDescriptor =
        centralConfig.getDescriptor().getRemoteReplication(descriptor.getKey());
    if (replicationDescriptor != null) {
      RemoteReplicationConfigModel replication =
          createRemoteReplicationConfigModel(replicationDescriptor);
      model.setReplications(Lists.newArrayList(replication));
    }
    RemoteAdvancedRepositoryConfigModel advanced = createRemoteAdvancedConfig(descriptor);
    model.setAdvanced(advanced);
    TypeSpecificConfigModel typeSpecific =
        createRemoteTypeSpecific(descriptor.getType(), descriptor);
    model.setTypeSpecific(typeSpecific);
  }
  /** Populate model configuration from local repository descriptor */
  public void populateLocalDescriptorValuesToModel(
      LocalRepoDescriptor descriptor, LocalRepositoryConfigModel model) {
    GeneralRepositoryConfigModel general = createGeneralConfig(descriptor);
    LocalBasicRepositoryConfigModel basic = createLocalBasicConfig(descriptor);
    LocalAdvancedRepositoryConfigModel advanced = createLocalAdvancedConfig(descriptor);
    TypeSpecificConfigModel typeSpecific =
        createLocalTypeSpecific(descriptor.getType(), descriptor);

    List<LocalReplicationDescriptor> replicationDescriptors =
        centralConfig.getDescriptor().getMultiLocalReplications(descriptor.getKey());
    List<LocalReplicationConfigModel> replications =
        replicationDescriptors
            .stream()
            .map(this::createLocalReplicationConfig)
            .collect(Collectors.toList());

    model.setGeneral(general);
    model.setBasic(basic);
    model.setAdvanced(advanced);
    model.setTypeSpecific(typeSpecific);
    model.setReplications(replications);
  }