private void addSharedBasicConfigModel(
     BasicRepositoryConfigModel basic, RepoDescriptor descriptor) {
   basic.setPublicDescription(descriptor.getDescription());
   basic.setInternalDescription(descriptor.getNotes());
   basic.setIncludesPattern(descriptor.getIncludesPattern());
   basic.setExcludesPattern(descriptor.getExcludesPattern());
   Optional.ofNullable(descriptor.getRepoLayout())
       .ifPresent(repoLayout -> basic.setLayout(repoLayout.getName()));
 }
 @Override
 public int compare(RepoDescriptor o1, RepoDescriptor o2) {
   if (o1 instanceof LocalCacheRepoDescriptor && !(o2 instanceof LocalCacheRepoDescriptor)) {
     return 1;
   } else if (!(o1 instanceof LocalCacheRepoDescriptor)
       && (o2 instanceof LocalCacheRepoDescriptor)) {
     return -1;
   } else {
     return o1.getKey().toLowerCase().compareTo(o2.getKey().toLowerCase());
   }
 }
 private List<String> getOrderdRepoKeys() {
   List<RepoDescriptor> repoSet = Lists.newArrayList();
   List<LocalRepoDescriptor> localAndCachedRepoDescriptors =
       repoService.getLocalAndCachedRepoDescriptors();
   Collections.sort(localAndCachedRepoDescriptors, new LocalAndCachedDescriptorsComparator());
   repoSet.addAll(localAndCachedRepoDescriptors);
   List<String> repoKeys = Lists.newArrayList();
   for (RepoDescriptor descriptor : repoSet) {
     repoKeys.add(descriptor.getKey());
   }
   return repoKeys;
 }
 protected RepositoryConfigurationBase(RepoDescriptor repoDescriptor, String type) {
   this.key = repoDescriptor.getKey();
   this.type = type;
   String description = repoDescriptor.getDescription();
   if (StringUtils.isNotBlank(description)) {
     setDescription(description);
   }
   String notes = repoDescriptor.getNotes();
   if (StringUtils.isNotBlank(notes)) {
     setNotes(notes);
   }
   String excludesPattern = repoDescriptor.getExcludesPattern();
   if (StringUtils.isNotBlank(excludesPattern)) {
     setExcludesPattern(excludesPattern);
   }
   String includesPattern = repoDescriptor.getIncludesPattern();
   if (StringUtils.isNotBlank(includesPattern)) {
     setIncludesPattern(includesPattern);
   }
   RepoLayout repoLayout = repoDescriptor.getRepoLayout();
   if (repoLayout != null) {
     setRepoLayoutRef(repoLayout.getName());
   }
   setEnableNuGetSupport(repoDescriptor.isEnableNuGetSupport());
 }
  private String adjustChecksum(MavenSnapshotVersionAdapterContext context) {
    // find latest unique file matching the checksum coordinates
    RepositoryService repoService = ContextHelper.get().getRepositoryService();
    RepoPath repoPath = context.getRepoPath();
    RepoPath parentRepoPath = repoPath.getParent();
    RepoDescriptor repoDescriptor = repoService.repoDescriptorByKey(parentRepoPath.getRepoKey());
    RepoLayout repoLayout = repoDescriptor.getRepoLayout();

    String latestMatching = null;

    String originalChecksumRequestPath = repoPath.getPath();
    String originalRequestPathWithNoChecksum =
        PathUtils.stripExtension(originalChecksumRequestPath);

    if (repoService.exists(parentRepoPath)) {
      List<String> children = repoService.getChildrenNames(parentRepoPath);
      for (String child : children) {
        if (MavenNaming.isUniqueSnapshotFileName(child)) {

          ModuleInfo childModule =
              repoService.getItemModuleInfo(InternalRepoPathFactory.create(parentRepoPath, child));
          String fileRevisionIntegration = childModule.getFileIntegrationRevision();

          // Try to construct a new non-unique path as a descriptor
          String nonUniquePath =
              replaceIntegration(
                  ModuleInfoUtils.constructDescriptorPath(childModule, repoLayout, true),
                  fileRevisionIntegration);

          // If the path as a descriptor doesn't match, perhaps it's an artifact path
          if (!nonUniquePath.equals(originalRequestPathWithNoChecksum)) {
            // Try to construct a new non-unique path as an artifact
            nonUniquePath =
                replaceIntegration(
                    ModuleInfoUtils.constructArtifactPath(childModule, repoLayout),
                    fileRevisionIntegration);
          }

          if (nonUniquePath.equals(originalRequestPathWithNoChecksum)) {
            if (latestMatching == null
                || MavenNaming.getUniqueSnapshotVersionBuildNumber(latestMatching)
                    < MavenNaming.getUniqueSnapshotVersionBuildNumber(child)) {
              latestMatching = child;
            }
          }
        }
      }
    }

    // if latest not found, return invalid path which will fail and return a message to the client
    String timestamp =
        latestMatching != null
            ? MavenNaming.getUniqueSnapshotVersionTimestamp(latestMatching)
            : System.currentTimeMillis() + "";
    int buildNumber =
        latestMatching != null
            ? MavenNaming.getUniqueSnapshotVersionBuildNumber(latestMatching)
            : 0;

    // use the timestamp and build number from it. if not found return something that will fail?
    return buildUniqueSnapshotFileName(buildNumber, timestamp, context.getModuleInfo());
  }