Package org.apache.archiva.maven2.model

Examples of org.apache.archiva.maven2.model.TreeEntry


        throws ArchivaRestServiceException
    {
        // if not a generic we can use the standard way to delete artifact
        if ( !VersionUtil.isGenericSnapshot( version ) )
        {
            Artifact artifact = new Artifact( namespace, projectId, version );
            artifact.setRepositoryId( repositoryId );
            artifact.setContext( repositoryId );
            return deleteArtifact( artifact );
        }

        if ( StringUtils.isEmpty( repositoryId ) )
        {
View Full Code Here


        ref.setType( type );
        File file = managedRepositoryContent.toFile( ref );

        String extension = FilenameUtils.getExtension( file.getName() );

        Artifact artifact = new Artifact( ref.getGroupId(), ref.getArtifactId(), ref.getVersion() );
        artifact.setRepositoryId( artifactMetadata.getRepositoryId() );
        artifact.setClassifier( classifier );
        artifact.setPackaging( type );
        artifact.setType( type );
        artifact.setFileExtension( extension );
        artifact.setPath( managedRepositoryContent.toPath( ref ) );
        // TODO: find a reusable formatter for this
        double s = this.artifactMetadata.getSize();
        String symbol = "b";
        if ( s > 1024 )
        {
            symbol = "K";
            s /= 1024;

            if ( s > 1024 )
            {
                symbol = "M";
                s /= 1024;

                if ( s > 1024 )
                {
                    symbol = "G";
                    s /= 1024;
                }
            }
        }
        artifact.setContext( managedRepositoryContent.getId() );
        DecimalFormat df = new DecimalFormat( "#,###.##", new DecimalFormatSymbols( Locale.US ) );
        artifact.setSize( df.format( s ) + " " + symbol );

        artifact.setId( ref.getArtifactId() + "-" + ref.getVersion() + "." + ref.getType() );

        return artifact;

    }
View Full Code Here

                return Response.temporaryRedirect(
                    new URI( artifactPerVersion.lastEntry().getValue().getUrl() ) ).build();

            }

            Artifact artifact = artifacts.get( 0 );

            return Response.temporaryRedirect( new URI( artifact.getUrl() ) ).build();
        }
        catch ( Exception e )
        {
            throw new ArchivaRestServiceException( e.getMessage(), e );
        }
View Full Code Here

            if ( hit.getVersions().size() > 0 )
            {
                for ( String version : hit.getVersions() )
                {

                    Artifact versionned = getModelMapper().map( hit, Artifact.class );

                    if ( StringUtils.isNotBlank( version ) )
                    {
                        versionned.setVersion( version );
                        versionned.setUrl( getArtifactUrl( versionned ) );

                        artifacts.add( versionned );

                    }
                }
View Full Code Here

        List<Artifact> artifacts = new ArrayList<>( references.size() );

        for ( ProjectVersionReference projectVersionReference : references )
        {
            artifacts.add( new Artifact( projectVersionReference.getNamespace(), projectVersionReference.getProjectId(),
                                         projectVersionReference.getProjectVersion() ) );
        }
        return artifacts;
    }
View Full Code Here

                {

                    ArtifactBuilder builder =
                        new ArtifactBuilder().forArtifactMetadata( artifact ).withManagedRepositoryContent(
                            repositoryContentFactory.getManagedRepositoryContent( repositoryId ) );
                    Artifact art = builder.build();
                    art.setUrl( getArtifactUrl( art, repositoryId ) );
                    artifacts.add( art );
                }
                return artifacts;
            }
            return Collections.emptyList();
View Full Code Here

        throws ArchivaRestServiceException
    {
        // if not a generic we can use the standard way to delete artifact
        if ( !VersionUtil.isGenericSnapshot( version ) )
        {
            Artifact artifact = new Artifact( namespace, projectId, version );
            artifact.setRepositoryId( repositoryId );
            artifact.setContext( repositoryId );
            return deleteArtifact( artifact );
        }

        if ( StringUtils.isEmpty( repositoryId ) )
        {
View Full Code Here

        List<Artifact> artifacts = new ArrayList<Artifact>( references.size() );

        for ( ProjectVersionReference projectVersionReference : references )
        {
            artifacts.add( new Artifact( projectVersionReference.getNamespace(), projectVersionReference.getProjectId(),
                                         projectVersionReference.getProjectVersion() ) );
        }
        return artifacts;
    }
View Full Code Here

                {

                    ArtifactBuilder builder =
                        new ArtifactBuilder().forArtifactMetadata( artifact ).withManagedRepositoryContent(
                            repositoryContentFactory.getManagedRepositoryContent( repositoryId ) );
                    Artifact art = builder.build();
                    art.setUrl( getArtifactUrl( art ) );
                    artifacts.add( art );
                }
                return artifacts;
            }
            return Collections.emptyList();
View Full Code Here

            if ( hit.getVersions().size() > 0 )
            {
                for ( String version : hit.getVersions() )
                {

                    Artifact versionned = getModelMapper().map( hit, Artifact.class );

                    if ( StringUtils.isNotBlank( version ) )
                    {
                        versionned.setVersion( version );
                        versionned.setUrl( getArtifactUrl( versionned ) );

                        artifacts.add( versionned );

                    }
                }
View Full Code Here

TOP

Related Classes of org.apache.archiva.maven2.model.TreeEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.