@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()); } }
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 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; }