Filter unwanted artifacts

@param artifact  the artifact
@return <tt>true</tt> to skip this artifact, <tt>false</tt> to keep it
431586
protected boolean filterUnwantedArtifacts(Artifact artifact) {
        // filter out maven and plexus stuff (plexus used by maven plugins)
        if (artifact.getGroupId().startsWith("org.apache.maven")) {
            return true;
        } else if (artifact.getGroupId().startsWith("org.codehaus.plexus")) {
            return true;
        }

        return false;
    }
859220
@SuppressWarnings("static-method")
	public Dependency toDependency(Artifact artifact) {
		final Dependency result = new Dependency();
		result.setArtifactId(artifact.getArtifactId());
		result.setClassifier(artifact.getClassifier());
		result.setGroupId(artifact.getGroupId());
		result.setOptional(artifact.isOptional());
		result.setScope(artifact.getScope());
		result.setType(artifact.getType());
		result.setVersion(artifact.getVersion());
		return result;
	}
902986
public Map<String, Object> getArtifactFieldsFilters() {
		final Map<String, Object> params = new HashMap<String, Object>();

        for(final Filter filter: filters){
            params.putAll(filter.artifactFilterFields());
        }

		return params;
	}
298883
@Check
	public void checkArtifactUse(SarlArtifact artifact) {
		error(MessageFormat.format(
				Messages.SARLValidator_0,
				this.grammarAccess.getSpaceKeyword()),
				artifact,
				null);
	}
178251
public static Set<Artifact> getArtifactsToConsider(AbstractWisdomMojo mojo, DependencyGraphBuilder graph,
                                                       boolean transitive, ArtifactFilter filter) {
        // No transitive.
        Set<Artifact> artifacts;
        if (!transitive) {
            // Direct dependencies that the current project has (no transitives)
            artifacts = mojo.project.getDependencyArtifacts();
        } else {
            // All dependencies that the current project has, including transitive ones. Contents are lazily
            // populated, so depending on what phases have run dependencies in some scopes won't be
            // included.
            artifacts = getTransitiveDependencies(mojo, graph, filter);
        }
        return artifacts;
    }
525958
@Override
    protected MavenFormatStage createFormatStage(final Collection<MavenResolvedArtifact> filteredArtifacts)
            throws IllegalArgumentException {
        assert filteredArtifacts != null : "filtered artifacts are required";
        return new MavenFormatStageImpl(filteredArtifacts);
    }
360185
private static boolean artifactsMatch(org.apache.maven.model.Dependency d, Artifact a) {
        return isEqualOrNull(a.getArtifactId(), d.getArtifactId())
                && isEqualOrNull(a.getGroupId(), d.getGroupId())
                && isEqualOrNull(a.getVersion(), d.getVersion());
    }
840712
private boolean isDepOfIdlArtifact(Artifact artifact, Map<String, Artifact> depsMap) {
    List<String> depTrail = artifact.getDependencyTrail();
    // depTrail can be null sometimes, which seems like a maven bug
    if (depTrail != null) {
      for (String name : depTrail) {
        Artifact dep = depsMap.get(name);
        if (dep != null && isIdlCalssifier(dep, classifier)) {
          return true;
        }
      }
    }
    return false;
  }
621479
public boolean isUpToDate(final DbArtifact artifact) {
        final List<String> versions = repoHandler.getArtifactVersions(artifact);
        final String currentVersion = artifact.getVersion();

        final String lastDevVersion = getLastVersion(versions);
        final String lastReleaseVersion = getLastRelease(versions);

        if(lastDevVersion == null || lastReleaseVersion == null) {
            // Plain Text comparison against version "strings"
            for(final String version: versions){
                if(version.compareTo(currentVersion) > 0){
                    return false;
                }
            }
            return true;
        } else {
            return currentVersion.equals(lastDevVersion) || currentVersion.equals(lastReleaseVersion);
        }
    }
1221311
private static void scanArtifact(Artifact artifact, VictimsOutputStream vos)
            throws IOException {
        ArrayList<Artifact> embedded = artifact.embedded();
        if (embedded != null) {
            for (Artifact eartifact : artifact.embedded()) {
                scanArtifact(eartifact, vos);
            }
        }
        VictimsRecord record = new VictimsRecord(artifact);
        vos.write(record);
    }
1233275
private void checkNonCoreArtifactId(Model model) throws EnforcerRuleException
    {
        String artifactId = model.getArtifactId();
        for (String prefix : CORE_ARTIFACT_ID_PREFIXES) {
            if (artifactId.startsWith(prefix)) {
                throw new EnforcerRuleException("The [%s] artifact id prefix is reserved for XWiki Core Committers.");
            }
        }
    }
612463
private synchronized void set( Artifact artifact, Content content )
    {
        Map<String, Map<String, Map<Artifact, Content>>> artifactMap = contents.get( artifact.getGroupId() );
        if ( artifactMap == null )
        {
            artifactMap = new HashMap<String, Map<String, Map<Artifact, Content>>>();
            contents.put( artifact.getGroupId(), artifactMap );
        }
        Map<String, Map<Artifact, Content>> versionMap = artifactMap.get( artifact.getArtifactId() );
        if ( versionMap == null )
        {
            versionMap = new HashMap<String, Map<Artifact, Content>>();
            artifactMap.put( artifact.getArtifactId(), versionMap );
        }
        Map<Artifact, Content> filesMap = versionMap.get( artifact.getVersion() );
        if ( filesMap == null )
        {
            filesMap = new HashMap<Artifact, Content>();
            versionMap.put( artifact.getVersion(), filesMap );
        }
        filesMap.put( artifact, content );
    }
679067
protected final FilterArtifacts getFilters(ArtifactsFilter... additionalFilters) {
		FilterArtifacts filters = new FilterArtifacts();
		for (ArtifactsFilter additionalFilter : additionalFilters) {
			filters.addFilter(additionalFilter);
		}
		filters.addFilter(
				new MatchingGroupIdFilter(cleanFilterConfig(this.excludeGroupIds)));
		if (this.includes != null && !this.includes.isEmpty()) {
			filters.addFilter(new IncludeFilter(this.includes));
		}
		if (this.excludes != null && !this.excludes.isEmpty()) {
			filters.addFilter(new ExcludeFilter(this.excludes));
		}
		return filters;
	}
1087046
@SuppressWarnings("rawtypes")
    public List<File> downloadArtifacts( List artifactsOrNotations ) throws NaetherException {
        
        List<Artifact> artifacts = new ArrayList<Artifact>();
        
        for ( Object artifactsOrNotation : artifactsOrNotations ) {
            if ( artifactsOrNotation != null ) {
                if ( artifactsOrNotation instanceof String ) {
                    artifacts.add( new DefaultArtifact( (String) artifactsOrNotation ) );
                } else if ( artifactsOrNotation instanceof Artifact ) {
                    artifacts.add( (Artifact)artifactsOrNotation );
                } else {
                    throw new NaetherException( "Only String notations or Artifact instances allowed. Found " + artifactsOrNotation.getClass() );
                }
            } else {
                log.warn( "Null found in list of artifacts to download" );
            }
        }
        
        List<File> files = new ArrayList<File>();
        
        for ( Artifact artifact : artifacts ) {
            
            log.debug( "Downloading {}", artifact );
            
            ArtifactRequest artifactRequest = new ArtifactRequest();
            artifactRequest.setArtifact( artifact );
            for ( RemoteRepository repo : this.getRemoteRepositories() ) {
                artifactRequest.addRepository( repo );
            }
    
            RepositoryClient repoClient = new RepositoryClient(this.getLocalRepoPath());
            
            ArtifactResult artifactResult = null;
            try {
                artifactResult = repoClient.resolveArtifact(artifactRequest );
            } catch (ArtifactResolutionException e) {
                throw new ResolveException(e);
            }
    
            Artifact downloadedArtifact = artifactResult.getArtifact();
            files.add( downloadedArtifact.getFile() );
        }
        
        return files;
    }
350982
private synchronized void addResolved( Artifact artifact )
    {
        String path =
            artifact.getGroupId().replace( '.', '/' ) + '/' + artifact.getArtifactId() + "/" + artifact.getVersion();
        Map<String, Artifact> artifactMapper = this.children.get( path );
        if ( artifactMapper == null )
        {
            artifactMapper = new HashMap<String, Artifact>();
            this.children.put( path, artifactMapper );
        }
        artifactMapper.put( artifact.getName(), artifact );
        addResolved( path );
    }
538723
@Override
	public boolean filter(Object entity) {
		if (fixture instanceof FilterableFixture) {
			return filterableFixture().filter(entity);
		}

		return true;
	}
581611
public void deleteLicense(final String licName) {
        final DbLicense dbLicense = getLicense(licName);

        repoHandler.deleteLicense(dbLicense.getName());

        final FiltersHolder filters = new FiltersHolder();
        final LicenseIdFilter licenseIdFilter = new LicenseIdFilter(licName);
        filters.addFilter(licenseIdFilter);

        for (final DbArtifact artifact : repoHandler.getArtifacts(filters)) {
            repoHandler.removeLicenseFromArtifact(artifact, licName, this);
        }
    }