Package org.apache.archiva.metadata.model.maven2

Examples of org.apache.archiva.metadata.model.maven2.MavenArtifactFacet


        ArtifactReference artifact = new ArtifactReference();
        artifact.setGroupId( metadata.getNamespace() );
        artifact.setArtifactId( metadata.getProject() );
        artifact.setVersion( metadata.getVersion() );
        MavenArtifactFacet facet = (MavenArtifactFacet) metadata.getFacet( MavenArtifactFacet.FACET_ID );
        if ( facet != null )
        {
            artifact.setClassifier( facet.getClassifier() );
            artifact.setType( facet.getType() );
        }

        return artifact;
    }
View Full Code Here


                                {
                                    if ( StringUtils.isNotBlank( reference.getClassifier() ) )
                                    {

                                        // cleanup facet which contains classifier information
                                        MavenArtifactFacet mavenArtifactFacet =
                                            (MavenArtifactFacet) artifactMetadata.getFacet(
                                                MavenArtifactFacet.FACET_ID );

                                        if ( StringUtils.equals( reference.getClassifier(),
                                                                 mavenArtifactFacet.getClassifier() ) )
                                        {
                                            artifactMetadata.removeFacet( MavenArtifactFacet.FACET_ID );
                                            String groupId = reference.getGroupId(), artifactId =
                                                reference.getArtifactId(),
                                                version = reference.getVersion();
                                            MavenArtifactFacet mavenArtifactFacetToCompare = new MavenArtifactFacet();
                                            mavenArtifactFacetToCompare.setClassifier( reference.getClassifier() );
                                            metadataRepository.removeArtifact( repository.getId(), groupId, artifactId,
                                                                               version, mavenArtifactFacetToCompare );
                                            metadataRepository.save();
                                        }
View Full Code Here

                        {
                            throw new ArchivaRestServiceException(
                                "You must configure a type/packaging when using classifier", 400, null );
                        }
                        // cleanup facet which contains classifier information
                        MavenArtifactFacet mavenArtifactFacet =
                            (MavenArtifactFacet) artifactMetadata.getFacet( MavenArtifactFacet.FACET_ID );

                        if ( StringUtils.equals( artifact.getClassifier(), mavenArtifactFacet.getClassifier() ) )
                        {
                            artifactMetadata.removeFacet( MavenArtifactFacet.FACET_ID );
                            String groupId = artifact.getGroupId(), artifactId = artifact.getArtifactId(), version =
                                artifact.getVersion();
                            MavenArtifactFacet mavenArtifactFacetToCompare = new MavenArtifactFacet();
                            mavenArtifactFacetToCompare.setClassifier( artifact.getClassifier() );
                            metadataRepository.removeArtifact( repositoryId, groupId, artifactId, version,
                                                               mavenArtifactFacetToCompare );
                            metadataRepository.save();
                        }
View Full Code Here

        ArtifactReference artifact = new ArtifactReference();
        artifact.setGroupId( metadata.getNamespace() );
        artifact.setArtifactId( metadata.getProject() );
        artifact.setVersion( metadata.getVersion() );
        MavenArtifactFacet facet = (MavenArtifactFacet) metadata.getFacet( MavenArtifactFacet.FACET_ID );
        if ( facet != null )
        {
            artifact.setClassifier( facet.getClassifier() );
            artifact.setType( facet.getType() );
        }

        return artifact;
    }
View Full Code Here

        metadata.setSize( 12345L );
        metadata.setProjectVersion( projectVersion );
        metadata.setVersion( projectVersion );
        metadata.setNamespace( namespace );

        MavenArtifactFacet facet = new MavenArtifactFacet();
        facet.setType( type );
        metadata.addFacet( facet );

        return metadata;
    }
View Full Code Here

            path = path.substring( 0, path.lastIndexOf( "/" ) + 1 ) + artifact.getId();

            // TODO: need to accommodate Maven 1 layout too. Non-maven repository formats will need to generate this
            // facet (perhaps on the fly) if wanting to display the Maven 2 elements on the Archiva pages
            String type = null;
            MavenArtifactFacet facet = (MavenArtifactFacet) artifact.getFacet( MavenArtifactFacet.FACET_ID );
            if ( facet != null )
            {
                this.type = facet.getType();
                this.classifier = facet.getClassifier();
            }

            namespace = artifact.getNamespace();
            project = artifact.getProject();
View Full Code Here

        metadata.setRepositoryId( TEST_REPO );
        metadata.setSize( TEST_SIZE );
        metadata.setProjectVersion( VersionUtil.getBaseVersion( version ) );
        metadata.setVersion( version );

        MavenArtifactFacet facet = new MavenArtifactFacet();
        facet.setType( "jar" );
        facet.setTimestamp( timestamp );
        facet.setBuildNumber( buildNumber );
        metadata.addFacet( facet );

        return metadata;
    }
View Full Code Here

            for ( String repoId : observableRepos )
            {
                for ( ArtifactMetadata artifact : metadataRepository.getArtifactsByChecksum( repoId, checksum ) )
                {
                    // TODO: customise XMLRPC to handle non-Maven artifacts
                    MavenArtifactFacet facet = (MavenArtifactFacet) artifact.getFacet( MavenArtifactFacet.FACET_ID );

                    results.add( new Artifact( artifact.getRepositoryId(), artifact.getNamespace(),
                                               artifact.getProject(), artifact.getVersion(),
                                               facet != null ? facet.getType() : null ) );
                }
            }
        }
        finally
        {
View Full Code Here

        artifactMetadata.setNamespace( ARCHIVA_TEST_GROUP_ID );
        artifactMetadata.setMd5( CHECKSUM );
        artifactMetadata.setWhenGathered( whenGathered );
        artifactMetadata.setRepositoryId( TEST_REPO );

        MavenArtifactFacet facet = new MavenArtifactFacet();
        facet.setType( "jar" );
        artifactMetadata.addFacet( facet );

        return artifactMetadata;
    }
View Full Code Here

    private String getTypeFromArtifactId( String artifactId )
    {
        ArtifactMetadata artifact = pathTranslator.getArtifactFromId( null, "groupId", artifactId, "1.0",
                                                                      artifactId + "-1.0.jar" );
        MavenArtifactFacet facet = (MavenArtifactFacet) artifact.getFacet( MavenArtifactFacet.FACET_ID );
        return facet.getType();
    }
View Full Code Here

TOP

Related Classes of org.apache.archiva.metadata.model.maven2.MavenArtifactFacet

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.