bundles/org.eclipse.packagedrone.repo.importer.aether/src/org/eclipse/packagedrone/repo/importer/aether/AetherImporter.java
public static AetherResult asResult ( final Collection<ArtifactResult> results, final ImportConfiguration cfg, final Optional<DependencyResult> dependencyResult )
    {
        final AetherResult result = new AetherResult ();

        // create set of requested coordinates

        final Set<String> requested = new HashSet<> ( cfg.getCoordinates ().size () );
        for ( final MavenCoordinates mc : cfg.getCoordinates () )
        {
            requested.add ( mc.toString () );
        }

        // generate dependency map

        final Map<String, Boolean> optionalDeps = new HashMap<> ();
        fillOptionalDependenciesMap ( dependencyResult, optionalDeps );

        // convert artifacts

        for ( final ArtifactResult ar : results )
        {
            final AetherResult.Entry entry = new AetherResult.Entry ();

            final MavenCoordinates coordinates = MavenCoordinates.fromResult ( ar );
            final String key = coordinates.toBase ().toString ();

            entry.setCoordinates ( coordinates );
            entry.setResolved ( ar.isResolved () );
            entry.setRequested ( requested.contains ( key ) );
            entry.setOptional ( optionalDeps.getOrDefault ( key, Boolean.FALSE ) );

            // convert error

            if ( ar.getExceptions () != null && !ar.getExceptions ().isEmpty () )
            {
                final StringBuilder sb = new StringBuilder ( ar.getExceptions ().get ( 0 ).getMessage () );
                if ( ar.getExceptions ().size () > 1 )
                {
                    sb.append ( " ..." );
                }
                entry.setError ( sb.toString () );
            }

            // add to list

            result.getArtifacts ().add ( entry );
        }

        // sort by coordinates

        Collections.sort ( result.getArtifacts (), Comparator.comparing ( AetherResult.Entry::getCoordinates ) );

        // set repo url

        result.setRepositoryUrl ( cfg.getRepositoryUrl () );

        return result;
    }
public static AetherResult asResult ( final Collection<ArtifactResult> results, final ImportConfiguration cfg, final Optional<DependencyResult> dependencyResult )
    {
        final AetherResult result = new AetherResult ();

        // create set of requested coordinates

        final Set<String> requested = new HashSet<> ( cfg.getCoordinates ().size () );
        for ( final MavenCoordinates mc : cfg.getCoordinates () )
        {
            requested.add ( mc.toString () );
        }

        // generate dependency map

        final Map<String, Boolean> optionalDeps = new HashMap<> ();
        fillOptionalDependenciesMap ( dependencyResult, optionalDeps );

        // convert artifacts

        for ( final ArtifactResult ar : results )
        {
            final AetherResult.Entry entry = new AetherResult.Entry ();

            final MavenCoordinates coordinates = MavenCoordinates.fromResult ( ar );
            final String key = coordinates.toBase ().toString ();

            entry.setCoordinates ( coordinates );
            entry.setResolved ( ar.isResolved () );
            entry.setRequested ( requested.contains ( key ) );
            entry.setOptional ( optionalDeps.getOrDefault ( key, Boolean.FALSE ) );

            // convert error

            if ( ar.getExceptions () != null && !ar.getExceptions ().isEmpty () )
            {
                final StringBuilder sb = new StringBuilder ( ar.getExceptions ().get ( 0 ).getMessage () );
                if ( ar.getExceptions ().size () > 1 )
                {
                    sb.append ( " ..." );
                }
                entry.setError ( sb.toString () );
            }

            // add to list

            result.getArtifacts ().add ( entry );
        }

        // sort by coordinates

        Collections.sort ( result.getArtifacts (), Comparator.comparing ( AetherResult.Entry::getCoordinates ) );

        // set repo url

        result.setRepositoryUrl ( cfg.getRepositoryUrl () );

        return result;
    }
public static AetherResult asResult ( final Collection < ArtifactResult > results , final ImportConfiguration cfg , final Optional < DependencyResult > dependencyResult ) { final AetherResult result = new AetherResult ( ) ; // create set of requested coordinates final Set < String > requested = new HashSet <> ( cfg . getCoordinates ( ) . size ( ) ) ; for ( final MavenCoordinates mc : cfg . getCoordinates ( ) ) { requested . add ( mc . toString ( ) ) ; } // generate dependency map final Map < String , Boolean > optionalDeps = new HashMap <> ( ) ; fillOptionalDependenciesMap ( dependencyResult , optionalDeps ) ; // convert artifacts for ( final ArtifactResult ar : results ) { final AetherResult . Entry entry = new AetherResult . Entry ( ) ; final MavenCoordinates coordinates = MavenCoordinates . fromResult ( ar ) ; final String key = coordinates . toBase ( ) . toString ( ) ; entry . setCoordinates ( coordinates ) ; entry . setResolved ( ar . isResolved ( ) ) ; entry . setRequested ( requested . contains ( key ) ) ; entry . setOptional ( optionalDeps . getOrDefault ( key , Boolean . FALSE ) ) ; // convert error if ( ar . getExceptions ( ) != null && ! ar . getExceptions ( ) . isEmpty ( ) ) { final StringBuilder sb = new StringBuilder ( ar . getExceptions ( ) . get ( 0 ) . getMessage ( ) ) ; if ( ar . getExceptions ( ) . size ( ) > 1 ) { sb . append ( " ..." ) ; } entry . setError ( sb . toString ( ) ) ; } // add to list result . getArtifacts ( ) . add ( entry ) ; } // sort by coordinates Collections . sort ( result . getArtifacts ( ) , Comparator . comparing ( AetherResult . Entry :: getCoordinates ) ) ; // set repo url result . setRepositoryUrl ( cfg . getRepositoryUrl ( ) ) ; return result ; }
Convert aether result list to AetherResult object

@param results
the result collection
@param cfg
the import configuration
@param dependencyResult
The result of the dependency resolution
@return the AetherResult object
Convert aether result list to AetherResult object