Search in sources :

Example 1 with IMPLIED_REPO_ORIGIN

use of org.commonjava.indy.implrepo.data.ImpliedReposStoreDataManagerDecorator.IMPLIED_REPO_ORIGIN in project indy by Commonjava.

the class ImpliedReposQueryDelegate method maybeFilter.

private List<ArtifactStore> maybeFilter(String groupName, List<ArtifactStore> delegateResult) {
    Logger logger = LoggerFactory.getLogger(getClass());
    if (delegateResult == null || delegateResult.isEmpty() || config.isEnabledForGroup(groupName)) {
        logger.trace("Implied repositories are enabled for group: '{}'. Returning all membership from delegate result.", groupName);
        return delegateResult;
    }
    logger.trace("Filtering stores with metadata: '{}' value of '{}' from membership results", METADATA_ORIGIN, IMPLIED_REPO_ORIGIN);
    List<ArtifactStore> result = new ArrayList<>();
    delegateResult.stream().filter((store) -> !IMPLIED_REPO_ORIGIN.equals(store.getMetadata(METADATA_ORIGIN))).forEach((store) -> result.add(store));
    return result;
}
Also used : ArtifactStoreQuery(org.commonjava.indy.data.ArtifactStoreQuery) StringUtils(org.apache.commons.lang.StringUtils) Logger(org.slf4j.Logger) ArtifactStore(org.commonjava.indy.model.core.ArtifactStore) IMPLIED_REPO_ORIGIN(org.commonjava.indy.implrepo.data.ImpliedReposStoreDataManagerDecorator.IMPLIED_REPO_ORIGIN) LoggerFactory(org.slf4j.LoggerFactory) METADATA_ORIGIN(org.commonjava.indy.model.core.ArtifactStore.METADATA_ORIGIN) DelegatingArtifactStoreQuery(org.commonjava.indy.data.DelegatingArtifactStoreQuery) Set(java.util.Set) Collectors(java.util.stream.Collectors) Group(org.commonjava.indy.model.core.Group) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) List(java.util.List) ImpliedRepoConfig(org.commonjava.indy.implrepo.conf.ImpliedRepoConfig) Collections(java.util.Collections) IndyDataException(org.commonjava.indy.data.IndyDataException) StoreKey(org.commonjava.indy.model.core.StoreKey) ArtifactStore(org.commonjava.indy.model.core.ArtifactStore) ArrayList(java.util.ArrayList) Logger(org.slf4j.Logger)

Aggregations

ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 StringUtils (org.apache.commons.lang.StringUtils)1 ArtifactStoreQuery (org.commonjava.indy.data.ArtifactStoreQuery)1 DelegatingArtifactStoreQuery (org.commonjava.indy.data.DelegatingArtifactStoreQuery)1 IndyDataException (org.commonjava.indy.data.IndyDataException)1 ImpliedRepoConfig (org.commonjava.indy.implrepo.conf.ImpliedRepoConfig)1 IMPLIED_REPO_ORIGIN (org.commonjava.indy.implrepo.data.ImpliedReposStoreDataManagerDecorator.IMPLIED_REPO_ORIGIN)1 ArtifactStore (org.commonjava.indy.model.core.ArtifactStore)1 METADATA_ORIGIN (org.commonjava.indy.model.core.ArtifactStore.METADATA_ORIGIN)1 Group (org.commonjava.indy.model.core.Group)1 StoreKey (org.commonjava.indy.model.core.StoreKey)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1