Examples of MetadataFacet


Examples of org.apache.archiva.metadata.model.MetadataFacet

                    {
                        log.error( "Attempted to load unknown project version metadata facet: {}", name );
                    }
                    else
                    {
                        MetadataFacet facet = factory.createMetadataFacet();
                        Map<String, String> map = new HashMap<String, String>();
                        for ( Property property : JcrUtils.getProperties( n ) )
                        {
                            String p = property.getName();
                            if ( !p.startsWith( "jcr:" ) )
                            {
                                map.put( p, property.getString() );
                            }
                        }
                        facet.fromProperties( map );
                        versionMetadata.addFacet( facet );
                    }
                }
            }
        }
View Full Code Here

Examples of org.apache.archiva.metadata.model.MetadataFacet

                {
                    log.error( "Attempted to load unknown project version metadata facet: " + name );
                }
                else
                {
                    MetadataFacet facet = factory.createMetadataFacet();
                    Map<String, String> map = new HashMap<String, String>();
                    for ( Property p : JcrUtils.getProperties( n ) )
                    {
                        String property = p.getName();
                        if ( !property.startsWith( "jcr:" ) )
                        {
                            map.put( property, p.getString() );
                        }
                    }
                    facet.fromProperties( map );
                    artifact.addFacet( facet );
                }
            }
        }
        return artifact;
View Full Code Here

Examples of org.apache.archiva.metadata.model.MetadataFacet

        {
            // TODO
            log.error( e.getMessage(), e );
            return null;
        }
        MetadataFacet metadataFacet = null;
        MetadataFacetFactory metadataFacetFactory = metadataFacetFactories.get( facetId );
        if ( metadataFacetFactory != null )
        {
            metadataFacet = metadataFacetFactory.createMetadataFacet( repositoryId, name );
            Map<String, String> map = new HashMap<>();
            for ( Object key : new ArrayList( properties.keySet() ) )
            {
                String property = (String) key;
                map.put( property, properties.getProperty( property ) );
            }
            metadataFacet.fromProperties( map );
        }
        return metadataFacet;
    }
View Full Code Here

Examples of org.apache.archiva.metadata.model.MetadataFacet

                            {
                                log.error( "Attempted to load unknown artifact metadata facet: " + facetId );
                            }
                            else
                            {
                                MetadataFacet facet = factory.createMetadataFacet();
                                String prefix = propertyPrefix + facet.getFacetId();
                                Map<String, String> map = new HashMap<>();
                                for ( Object key : new ArrayList( properties.keySet() ) )
                                {
                                    String property = (String) key;
                                    if ( property.startsWith( prefix ) )
                                    {
                                        map.put( property.substring( prefix.length() + 1 ),
                                                 properties.getProperty( property ) );
                                    }
                                }
                                facet.fromProperties( map );
                                artifact.addFacet( facet );
                            }
                        }
                    }
View Full Code Here

Examples of org.apache.archiva.metadata.model.MetadataFacet

                    {
                        log.error( "Attempted to load unknown project version metadata facet: {}", facetId );
                    }
                    else
                    {
                        MetadataFacet facet = factory.createMetadataFacet();
                        Map<String, String> map = new HashMap<>();
                        for ( Object key : new ArrayList( properties.keySet() ) )
                        {
                            String property = (String) key;
                            if ( property.startsWith( facet.getFacetId() ) )
                            {
                                map.put( property.substring( facet.getFacetId().length() + 1 ),
                                         properties.getProperty( property ) );
                            }
                        }
                        facet.fromProperties( map );
                        versionMetadata.addFacet( facet );
                    }
                }
            }
View Full Code Here

Examples of org.apache.archiva.metadata.model.MetadataFacet

            for ( Map.Entry<String, Map<String, String>> entry : metadataFacetsPerFacetIds.entrySet() )
            {
                MetadataFacetFactory metadataFacetFactory = metadataFacetFactories.get( entry.getKey() );
                if ( metadataFacetFactory != null )
                {
                    MetadataFacet metadataFacet = metadataFacetFactory.createMetadataFacet();
                    metadataFacet.fromProperties( entry.getValue() );
                    projectVersionMetadata.addFacet( metadataFacet );
                }
            }
        }
View Full Code Here

Examples of org.apache.archiva.metadata.model.MetadataFacet

        String cf = cassandraArchivaManager.getMetadataFacetFamilyName();

        for ( final String facetId : metadataFacetFactories.keySet() )
        {
            MetadataFacet metadataFacet = facetedMetadata.getFacet( facetId );
            if ( metadataFacet == null )
            {
                continue;
            }
            // clean first

            QueryResult<OrderedRows<String, String, String>> result =
                HFactory.createRangeSlicesQuery( keyspace, ss, ss, ss ) //
                    .setColumnFamily( cf ) //
                    .setColumnNames( "repositoryName" ) //
                    .addEqualsExpression( "repositoryName", artifactMetadataModel.getRepositoryId() ) //
                    .addEqualsExpression( "namespaceId", artifactMetadataModel.getNamespace() ) //
                    .addEqualsExpression( "projectId", artifactMetadataModel.getProject() ) //
                    .addEqualsExpression( "projectVersion", artifactMetadataModel.getProjectVersion() ) //
                    .addEqualsExpression( "facetId", facetId ) //
                    .execute();

            for ( Row<String, String, String> row : result.get().getList() )
            {
                this.metadataFacetTemplate.deleteRow( row.getKey() );
            }

            Map<String, String> properties = metadataFacet.toProperties();

            for ( Map.Entry<String, String> entry : properties.entrySet() )
            {
                String key = new MetadataFacetModel.KeyBuilder().withKey( entry.getKey() ).withArtifactMetadataModel(
                    artifactMetadataModel ).withFacetId( facetId ).withName( metadataFacet.getName() ).build();
                Mutator<String> mutator = metadataFacetTemplate.createMutator() //
                    .addInsertion( key, cf, column( "repositoryName", artifactMetadataModel.getRepositoryId() ) ) //
                    .addInsertion( key, cf, column( "namespaceId", artifactMetadataModel.getNamespace() ) ) //
                    .addInsertion( key, cf, column( "projectId", artifactMetadataModel.getProject() ) ) //
                    .addInsertion( key, cf, column( "projectVersion", artifactMetadataModel.getProjectVersion() ) ) //
                    .addInsertion( key, cf, column( "facetId", facetId ) ) //
                    .addInsertion( key, cf, column( "key", entry.getKey() ) ) //
                    .addInsertion( key, cf, column( "value", entry.getValue() ) );

                if ( metadataFacet.getName() != null )
                {
                    mutator.addInsertion( key, cf, column( "name", metadataFacet.getName() ) );
                }

                mutator.execute();
            }
        }
View Full Code Here

Examples of org.apache.archiva.metadata.model.MetadataFacet

            .addEqualsExpression( "repositoryName", repositoryId ) //
            .addEqualsExpression( "facetId", facetId ) //
            .addEqualsExpression( "name", name ) //
            .execute();

        MetadataFacet metadataFacet = metadataFacetFactory.createMetadataFacet( repositoryId, name );
        int size = result.get().getCount();
        if ( size < 1 )
        {
            return null;
        }
        Map<String, String> map = new HashMap<>( size );
        for ( Row<String, String, String> row : result.get() )
        {
            ColumnSlice<String, String> columnSlice = row.getColumnSlice();
            map.put( getStringValue( columnSlice, "key" ), getStringValue( columnSlice, "value" ) );
        }
        metadataFacet.fromProperties( map );
        return metadataFacet;
    }
View Full Code Here

Examples of org.apache.archiva.metadata.model.MetadataFacet

                if ( metadataFacetFactory != null )
                {
                    List<MetadataFacetModel> facetModels = entry.getValue();
                    if ( !facetModels.isEmpty() )
                    {
                        MetadataFacet metadataFacet = metadataFacetFactory.createMetadataFacet();
                        Map<String, String> props = new HashMap<>( facetModels.size() );
                        for ( MetadataFacetModel metadataFacetModel : facetModels )
                        {
                            props.put( metadataFacetModel.getKey(), metadataFacetModel.getValue() );
                        }
                        metadataFacet.fromProperties( props );
                        artifactMetadata.addFacet( metadataFacet );
                    }
                }
            }
View Full Code Here

Examples of org.apache.archiva.metadata.model.MetadataFacet

            getProjectMetadata( groupId, artifactId, version, repositoryId );
        if ( projectVersionMetadata == null )
        {
            return Collections.emptyList();
        }
        MetadataFacet metadataFacet = projectVersionMetadata.getFacet( GenericMetadataFacet.FACET_ID );

        if ( metadataFacet == null )
        {
            return Collections.emptyList();
        }
        Map<String, String> map = metadataFacet.toProperties();
        List<Entry> entries = new ArrayList<>( map.size() );

        for ( Map.Entry<String, String> entry : map.entrySet() )
        {
            entries.add( new Entry( entry.getKey(), entry.getValue() ) );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.