Java 类org.apache.maven.model.Contributor 实例源码

项目:extra-enforcer-rules    文件:RequireRolesTest.java   
/**
 * Test of getRolesFromMaven method, of class AbstractRequireRoles.
 */
@Test
public void testGetRolesFromMaven()
{
    HashSet<String> expResult = new HashSet<String>( Arrays.asList( 
            "quality manager", "product owner", "business engineer" ) );
    final Contributor singleHero = new Contributor();
    singleHero.addRole( "quality manager" );
    singleHero.addRole( "business engineer" );
    singleHero.addRole( "product owner" );
    List<Contributor> listFromMaven = Arrays.asList( singleHero );
    final HashSet<String> result = new HashSet<String>();
    for ( final Contributor contributor : listFromMaven )
    {
        @SuppressWarnings( "unchecked" )
        List<String> roles = contributor.getRoles();
        for ( String role : roles )
        {
            result.add( role );
        }
    }
    assertEquals( expResult, result );
}
项目:oceano    文件:ModelMerger.java   
protected void mergeContributor_Properties( Contributor target, Contributor source, boolean sourceDominant,
                                            Map<Object, Object> context )
{
    Properties merged = new Properties();
    if ( sourceDominant )
    {
        merged.putAll( target.getProperties() );
        merged.putAll( source.getProperties() );
    }
    else
    {
        merged.putAll( source.getProperties() );
        merged.putAll( target.getProperties() );
    }
    target.setProperties( merged );
    target.setLocation( "properties", InputLocation.merge( target.getLocation( "properties" ),
                                                           source.getLocation( "properties" ), sourceDominant ) );
}
项目:afc    文件:ExtendedArtifact.java   
/** Constructor.
 * @param artifact the artifact.
 * @param name name of the artifact.
 * @param website website.
 * @param organization organization.
 * @param scmRevision url of the SCM.
 * @param scm SCM.
 * @param developers developers.
 * @param contributors constributors.
 * @param licenses licenses.
 */
public ExtendedArtifact(
        Artifact artifact, String name,
        String website, Organization organization,
        String scmRevision,
        Scm scm,
        List<? extends Developer> developers,
        List<? extends Contributor> contributors,
        List<? extends License> licenses) {
    this.original = artifact;
    this.artifactName = name;
    this.developers = developers;
    this.contributors = contributors;
    this.website = website;
    this.organization = organization;
    this.scm = scm;
    this.scmRevision = scmRevision;
    this.licenses = licenses;
}
项目:apache-maven-shade-plugin    文件:MavenJDOMWriter.java   
/**
 * Method updateContributor
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateContributor( Contributor value, String xmlTag, Counter counter, Element element )
{
    Element root = element;
    Counter innerCount = new Counter( counter.getDepth() + 1 );
    findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
    findAndReplaceSimpleElement( innerCount, root, "email", value.getEmail(), null );
    findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
    findAndReplaceSimpleElement( innerCount, root, "organization", value.getOrganization(), null );
    findAndReplaceSimpleElement( innerCount, root, "organizationUrl", value.getOrganizationUrl(), null );
    findAndReplaceSimpleLists( innerCount, root, value.getRoles(), "roles", "role" );
    findAndReplaceSimpleElement( innerCount, root, "timezone", value.getTimezone(), null );
    findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
}
项目:xmvn    文件:DefaultModelProcessor.java   
private void visitContributor( ModelVisitor visitor, Contributor contributor )
{
    List<String> roles = contributor.getRoles();
    if ( roles != null )
    {
        ListIterator<String> roleIterator = roles.listIterator();
        while ( roleIterator.hasNext() )
        {
            String role = roleIterator.next();
            visitor.visitContributorRole( role );
            role = visitor.replaceContributorRole( role );
            if ( role == null )
                roleIterator.remove();
            else
                roleIterator.set( role );
        }
    }

    Properties properties = contributor.getProperties();
    if ( properties != null )
    {
        Iterator<Entry<Object, Object>> propertyIterator = properties.entrySet().iterator();
        while ( propertyIterator.hasNext() )
        {
            Entry<Object, Object> property = propertyIterator.next();
            String propertyKey = (String) property.getKey();
            String propertyValue = (String) property.getKey();
            visitor.visitContributorProperty( propertyKey, propertyValue );
            propertyValue = visitor.replaceContributorProperty( propertyKey, propertyValue );
            if ( propertyValue == null )
                propertyIterator.remove();
            else
                property.setValue( propertyValue );
        }
    }
}
项目:extra-enforcer-rules    文件:RequireRolesTest.java   
private void addProjectHavingAnArchitectAsDeveloperAndABusinessEngineerAsContributorToHelper() throws Exception
{
    final MavenProject mavenProject = new MavenProject();
    final Developer developer = new Developer();
    developer.addRole( "architect" );
    mavenProject.addDeveloper( developer );
    final Contributor contributor = new Contributor();
    contributor.addRole( "business engineer" );
    mavenProject.addContributor( contributor );
    Mockito.when( helper.evaluate( "${project}" ) ).thenReturn( mavenProject );
}
项目:maven-shade-plugin    文件:MavenJDOMWriter.java   
/**
 * Method updateContributor
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateContributor( Contributor value, String xmlTag, Counter counter, Element element )
{
    Element root = element;
    Counter innerCount = new Counter( counter.getDepth() + 1 );
    findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
    findAndReplaceSimpleElement( innerCount, root, "email", value.getEmail(), null );
    findAndReplaceSimpleElement( innerCount, root, "url", value.getUrl(), null );
    findAndReplaceSimpleElement( innerCount, root, "organization", value.getOrganization(), null );
    findAndReplaceSimpleElement( innerCount, root, "organizationUrl", value.getOrganizationUrl(), null );
    findAndReplaceSimpleLists( innerCount, root, value.getRoles(), "roles", "role" );
    findAndReplaceSimpleElement( innerCount, root, "timezone", value.getTimezone(), null );
    findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
}
项目:oceano    文件:ModelMerger.java   
protected void mergeContributor( Contributor target, Contributor source, boolean sourceDominant,
                                 Map<Object, Object> context )
{
    mergeContributor_Name( target, source, sourceDominant, context );
    mergeContributor_Email( target, source, sourceDominant, context );
    mergeContributor_Url( target, source, sourceDominant, context );
    mergeContributor_Organization( target, source, sourceDominant, context );
    mergeContributor_OrganizationUrl( target, source, sourceDominant, context );
    mergeContributor_Timezone( target, source, sourceDominant, context );
    mergeContributor_Roles( target, source, sourceDominant, context );
    mergeContributor_Properties( target, source, sourceDominant, context );
}
项目:oceano    文件:ModelMerger.java   
protected void mergeContributor_Name( Contributor target, Contributor source, boolean sourceDominant,
                                      Map<Object, Object> context )
{
    String src = source.getName();
    if ( src != null )
    {
        if ( sourceDominant || target.getName() == null )
        {
            target.setName( src );
            target.setLocation( "name", source.getLocation( "name" ) );
        }
    }
}
项目:oceano    文件:ModelMerger.java   
protected void mergeContributor_Email( Contributor target, Contributor source, boolean sourceDominant,
                                       Map<Object, Object> context )
{
    String src = source.getEmail();
    if ( src != null )
    {
        if ( sourceDominant || target.getEmail() == null )
        {
            target.setEmail( src );
            target.setLocation( "email", source.getLocation( "email" ) );
        }
    }
}
项目:oceano    文件:ModelMerger.java   
protected void mergeContributor_Url( Contributor target, Contributor source, boolean sourceDominant,
                                     Map<Object, Object> context )
{
    String src = source.getUrl();
    if ( src != null )
    {
        if ( sourceDominant || target.getUrl() == null )
        {
            target.setUrl( src );
            target.setLocation( "url", source.getLocation( "url" ) );
        }
    }
}
项目:oceano    文件:ModelMerger.java   
protected void mergeContributor_Organization( Contributor target, Contributor source, boolean sourceDominant,
                                              Map<Object, Object> context )
{
    String src = source.getOrganization();
    if ( src != null )
    {
        if ( sourceDominant || target.getOrganization() == null )
        {
            target.setOrganization( src );
            target.setLocation( "organization", source.getLocation( "organization" ) );
        }
    }
}
项目:oceano    文件:ModelMerger.java   
protected void mergeContributor_OrganizationUrl( Contributor target, Contributor source, boolean sourceDominant,
                                                 Map<Object, Object> context )
{
    String src = source.getOrganizationUrl();
    if ( src != null )
    {
        if ( sourceDominant || target.getOrganizationUrl() == null )
        {
            target.setOrganizationUrl( src );
            target.setLocation( "organizationUrl", source.getLocation( "organizationUrl" ) );
        }
    }
}
项目:oceano    文件:ModelMerger.java   
protected void mergeContributor_Timezone( Contributor target, Contributor source, boolean sourceDominant,
                                          Map<Object, Object> context )
{
    String src = source.getTimezone();
    if ( src != null )
    {
        if ( sourceDominant || target.getTimezone() == null )
        {
            target.setTimezone( src );
            target.setLocation( "timezone", source.getLocation( "timezone" ) );
        }
    }
}
项目:oceano    文件:ModelMerger.java   
protected void mergeContributor_Roles( Contributor target, Contributor source, boolean sourceDominant,
                                       Map<Object, Object> context )
{
    List<String> src = source.getRoles();
    if ( !src.isEmpty() )
    {
        List<String> tgt = target.getRoles();
        List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
        merged.addAll( tgt );
        merged.addAll( src );
        target.setRoles( merged );
    }
}
项目:oceano    文件:MavenModelMerger.java   
@Override
protected void mergeModel_Contributors( Model target, Model source, boolean sourceDominant,
                                        Map<Object, Object> context )
{
    if ( target.getContributors().isEmpty() )
    {
        target.setContributors( new ArrayList<Contributor>( source.getContributors() ) );
    }
}
项目:xmvn    文件:AbstractModelVisitor.java   
@Override
public Contributor replaceContributor( Contributor contributor )
{
    return contributor;
}
项目:xmvn    文件:AbstractModelVisitor.java   
@Override
public void visitContributor( Contributor contributor )
{
}
项目:maven-confluence-plugin    文件:ProjectTeamRenderer.java   
/**
 * @param units contributors and developers to check
 * @return required headers
 */
private Map<String, Boolean> checkRequiredHeaders( List<? extends Contributor> units )
{
    Map<String, Boolean> requiredHeaders = new HashMap<String, Boolean>();

    requiredHeaders.put( IMAGE, Boolean.FALSE );
    requiredHeaders.put( ID, Boolean.FALSE );
    requiredHeaders.put( NAME, Boolean.FALSE );
    requiredHeaders.put( EMAIL, Boolean.FALSE );
    requiredHeaders.put( URL, Boolean.FALSE );
    requiredHeaders.put( ORGANIZATION, Boolean.FALSE );
    requiredHeaders.put( ORGANIZATION_URL, Boolean.FALSE );
    requiredHeaders.put( ROLES, Boolean.FALSE );
    requiredHeaders.put( TIME_ZONE, Boolean.FALSE );
    requiredHeaders.put( PROPERTIES, Boolean.FALSE );

    for ( Contributor unit : units )
    {
        if ( unit instanceof Developer )
        {
            Developer developer = (Developer) unit;
            if ( StringUtils.isNotEmpty( developer.getId() ) )
            {
                requiredHeaders.put( ID, Boolean.TRUE );
            }
        }
        if ( StringUtils.isNotEmpty( unit.getName() ) )
        {
            requiredHeaders.put( NAME, Boolean.TRUE );
        }
        if ( StringUtils.isNotEmpty( unit.getEmail() ) )
        {
            requiredHeaders.put( EMAIL, Boolean.TRUE );
            requiredHeaders.put( IMAGE, Boolean.TRUE );
        }
        if ( StringUtils.isNotEmpty( unit.getUrl() ) )
        {
            requiredHeaders.put( URL, Boolean.TRUE );
        }
        if ( StringUtils.isNotEmpty( unit.getOrganization() ) )
        {
            requiredHeaders.put( ORGANIZATION, Boolean.TRUE );
        }
        if ( StringUtils.isNotEmpty( unit.getOrganizationUrl() ) )
        {
            requiredHeaders.put( ORGANIZATION_URL, Boolean.TRUE );
        }
        if ( !isEmpty( unit.getRoles() ) )
        {
            requiredHeaders.put( ROLES, Boolean.TRUE );
        }
        if ( StringUtils.isNotEmpty( unit.getTimezone() ) )
        {
            requiredHeaders.put( TIME_ZONE, Boolean.TRUE );
        }
        Properties properties = unit.getProperties();
        boolean hasPicUrl = properties.containsKey( "picUrl" );
        if ( hasPicUrl )
        {
            requiredHeaders.put( IMAGE, Boolean.TRUE );
        }
        boolean isJustAnImageProperty = properties.size() == 1 && hasPicUrl;
        if ( !isJustAnImageProperty && !properties.isEmpty() )
        {
            requiredHeaders.put( PROPERTIES, Boolean.TRUE );
        }
    }
    return requiredHeaders;
}
项目:extra-enforcer-rules    文件:RequireContributorRoles.java   
@Override
protected List<Contributor> getRoles( MavenProject mavenProject )
{
    return mavenProject.getContributors();
}
项目:flatten-maven-plugin    文件:PomProperty.java   
@Override
public List<Contributor> get( Model model )
{
    return model.getContributors();
}
项目:flatten-maven-plugin    文件:PomProperty.java   
@Override
public void set( Model model, List<Contributor> value )
{
    model.setContributors( value );
}
项目:maven-shade-plugin    文件:MavenJDOMWriter.java   
/**
 * Method iterateContributor
 *
 * @param counter
 * @param childTag
 * @param parentTag
 * @param list
 * @param parent
 */
protected void iterateContributor( Counter counter, Element parent, java.util.Collection list,
                                   java.lang.String parentTag, java.lang.String childTag )
{
    boolean shouldExist = list != null && list.size() > 0;
    Element element = updateElement( counter, parent, parentTag, shouldExist );
    if ( shouldExist )
    {
        Iterator it = list.iterator();
        Iterator elIt = element.getChildren( childTag, element.getNamespace() ).iterator();
        if ( !elIt.hasNext() )
        {
            elIt = null;
        }
        Counter innerCount = new Counter( counter.getDepth() + 1 );
        while ( it.hasNext() )
        {
            Contributor value = (Contributor) it.next();
            Element el;
            if ( elIt != null && elIt.hasNext() )
            {
                el = (Element) elIt.next();
                if ( !elIt.hasNext() )
                {
                    elIt = null;
                }
            }
            else
            {
                el = factory.element( childTag, element.getNamespace() );
                insertAtPreferredLocation( element, el, innerCount );
            }
            updateContributor( value, childTag, innerCount, el );
            innerCount.increaseCount();
        }
        if ( elIt != null )
        {
            while ( elIt.hasNext() )
            {
                elIt.next();
                elIt.remove();
            }
        }
    }
}
项目:spdx-maven-plugin    文件:SpdxDependencyInformation.java   
/**
 * Create an SPDX package from the information in an SPDX Pom file
 * @param pomFile
 * @return
 * @throws XmlPullParserException 
 * @throws IOException 
 * @throws SpdxCollectionException 
 * @throws NoSuchAlgorithmException 
 * @throws LicenseMapperException 
 */
private SpdxPackage createSpdxPackage( File pomFile ) throws IOException, XmlPullParserException, SpdxCollectionException, NoSuchAlgorithmException, LicenseMapperException
{
    MavenXpp3Reader pomReader = new MavenXpp3Reader();
    Model model;

    model = pomReader.read( ReaderFactory.newXmlReader( pomFile ) );
    SpdxDefaultFileInformation fileInfo = new SpdxDefaultFileInformation();

    // initialize the SPDX information from the POM file
    String packageName = model.getName();
    if ( packageName == null || packageName.isEmpty() ) {
        packageName = model.getArtifactId();
    }
    List<Contributor> contributors = model.getContributors();
    ArrayList<String> fileContributorList = new ArrayList<String>();
    if ( contributors != null ) {
        for ( Contributor contributor:contributors ) {
            fileContributorList.add( contributor.getName() );
        }
    }
    String copyright = "UNSPECIFIED";
    String notice = "UNSPECIFIED";
    String downloadLocation = "NOASSERTION";
    AnyLicenseInfo declaredLicense = mavenLicensesToSpdxLicense( model.getLicenses() );
    fileInfo.setComment( "" );
    fileInfo.setConcludedLicense( new SpdxNoAssertionLicense() );
    fileInfo.setContributors( fileContributorList.toArray(new String[fileContributorList.size()]) );
    fileInfo.setCopyright( copyright );
    fileInfo.setDeclaredLicense( declaredLicense );
    fileInfo.setLicenseComment( "" );
    fileInfo.setNotice( notice );

    SpdxPackage retval = new SpdxPackage(packageName, new SpdxNoAssertionLicense(), 
                                         new AnyLicenseInfo[] {new SpdxNoAssertionLicense()},
                                         copyright, declaredLicense, downloadLocation,
                                         new SpdxFile[0], 
                                         new SpdxPackageVerificationCode(SpdxDocumentBuilder.NULL_SHA1, new String[0]));
    if ( model.getVersion() != null ) {
        retval.setVersionInfo( model.getVersion() );
    }
    if (model.getDescription() != null) {
        retval.setDescription( model.getDescription() );
        retval.setSummary( model.getDescription() );
    }
    if (model.getOrganization() != null) {
        retval.setOriginator( SpdxRdfConstants.CREATOR_PREFIX_ORGANIZATION +  model.getOrganization().getName() );
    }
    if (model.getUrl() != null) {
        retval.setHomepage( model.getUrl() );
    }
    return retval;
}
项目:oceano    文件:MavenProject.java   
public void setContributors( List<Contributor> contributors )
{
    getModel().setContributors( contributors );
}
项目:oceano    文件:MavenProject.java   
public List<Contributor> getContributors()
{
    return getModel().getContributors();
}
项目:oceano    文件:MavenProject.java   
public void addContributor( Contributor contributor )
{
    getModel().addContributor( contributor );
}
项目:oceano    文件:ModelMerger.java   
protected Object getContributorKey( Contributor object )
{
    return object;
}
项目:jwrapper-maven-plugin    文件:MavenProjectDelegate.java   
@Override
public void addContributor(final Contributor contributor) {
    getDelegate().addContributor(contributor);
}
项目:Pogamut3    文件:DependencyProjectStub.java   
public void addContributor( Contributor contributor )
{

}
项目:afc    文件:ExtendedArtifact.java   
/** Replies the list of contributors.
 *
 * @return the list of contributors.
 */
public List<? extends Contributor> getContributors() {
    return this.contributors == null ? Collections.<Contributor>emptyList() : this.contributors;
}
项目:afc    文件:ExtendedArtifact.java   
/** Replies the people with the given login.
 * This function checks the peoples replied
 * by {@link #getDevelopers()} and
 * {@link #getContributors()}.
 *
 * @param login contributor login
 * @return the people or <code>null</code>
 */
public Contributor getPeople(String login) {
    return getPeople(login, null);
}
项目:xmvn    文件:ModelVisitor.java   
Contributor replaceContributor( Contributor contributor );
项目:xmvn    文件:ModelVisitor.java   
void visitContributor( Contributor contributor );