コード例 #1
0
  /** 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);
  }
コード例 #2
0
 private GeneralRepositoryConfigModel createGeneralConfig(RepoBaseDescriptor descriptor) {
   GeneralRepositoryConfigModel general = new GeneralRepositoryConfigModel();
   general.setRepoKey(descriptor.getKey());
   return general;
 }