Package org.apache.maven.model

Examples of org.apache.maven.model.Contributor


            {
                Element listElement = element;
                listElement = element.addElement( "contributors" );
                for ( Iterator iter = model.getContributors().iterator(); iter.hasNext(); )
                {
                    Contributor o = (Contributor) iter.next();
                    writeContributor( o, "contributor", listElement );
                }
            }
            if ( model.getLicenses() != null && model.getLicenses().size() > 0 )
            {
View Full Code Here


                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() )
View Full Code Here

     */
    private Contributor parseContributor( XmlPullParser parser, boolean strict )
        throws IOException, XmlPullParserException
    {
        String tagName = parser.getName();
        Contributor contributor = new Contributor();
        for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
        {
            String name = parser.getAttributeName( i );
            String value = parser.getAttributeValue( i );

            if ( name.indexOf( ':' ) >= 0 )
            {
                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
            }
            else
            {
                checkUnknownAttribute( parser, name, tagName, strict );
            }
        }
        java.util.Set parsed = new java.util.HashSet();
        while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
        {
            if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
            {
                contributor.setName( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "email", null, parsed ) )
            {
                contributor.setEmail( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
            {
                contributor.setUrl( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "organization", "organisation", parsed ) )
            {
                contributor.setOrganization( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "organizationUrl", "organisationUrl", parsed ) )
            {
                contributor.setOrganizationUrl( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "roles", null, parsed ) )
            {
                java.util.List roles = new java.util.ArrayList/*<String>*/();
                contributor.setRoles( roles );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( "role".equals( parser.getName() ) )
                    {
                        roles.add( getTrimmedValue( parser.nextText() ) );
                    }
                    else
                    {
                        checkUnknownElement( parser, strict );
                    }
                }
            }
            else if ( checkFieldWithDuplicate( parser, "timezone", null, parsed ) )
            {
                contributor.setTimezone( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
            {
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    String key = parser.getName();
                    String value = parser.nextText().trim();
                    contributor.addProperty( key, value );
                }
            }
            else
            {
                checkUnknownElement( parser, strict );
View Full Code Here

        if ( ( model.getContributors() != null ) && ( model.getContributors().size() > 0 ) )
        {
            serializer.startTag( NAMESPACE, "contributors" );
            for ( Iterator iter = model.getContributors().iterator(); iter.hasNext(); )
            {
                Contributor o = (Contributor) iter.next();
                writeContributor( o, "contributor", serializer );
            }
            serializer.endTag( NAMESPACE, "contributors" );
        }
        if ( ( model.getMailingLists() != null ) && ( model.getMailingLists().size() > 0 ) )
View Full Code Here

     */
    private Contributor parseContributor( XmlPullParser parser, boolean strict, InputSource source )
        throws IOException, XmlPullParserException
    {
        String tagName = parser.getName();
        Contributor contributor = new Contributor();
        InputLocation _location;
        _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
        contributor.setLocation( "", _location );
        for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
        {
            String name = parser.getAttributeName( i );
            String value = parser.getAttributeValue( i );

            if ( name.indexOf( ':' ) >= 0 )
            {
                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
            }
            else
            {
                checkUnknownAttribute( parser, name, tagName, strict );
            }
        }
        java.util.Set parsed = new java.util.HashSet();
        while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
        {
            if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                contributor.setLocation( "name", _location );
                contributor.setName( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "email", null, parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                contributor.setLocation( "email", _location );
                contributor.setEmail( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                contributor.setLocation( "url", _location );
                contributor.setUrl( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "organization", "organisation", parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                contributor.setLocation( "organization", _location );
                contributor.setOrganization( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "organizationUrl", "organisationUrl", parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                contributor.setLocation( "organizationUrl", _location );
                contributor.setOrganizationUrl( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "roles", null, parsed ) )
            {
                java.util.List roles = new java.util.ArrayList/*<String>*/();
                contributor.setRoles( roles );
                InputLocation _locations;
                _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                contributor.setLocation( "roles", _locations );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    if ( "role".equals( parser.getName() ) )
                    {
                        _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                        _locations.setLocation( Integer.valueOf( roles.size() ), _location );
                        roles.add( getTrimmedValue( parser.nextText() ) );
                    }
                    else
                    {
                        checkUnknownElement( parser, strict );
                    }
                }
            }
            else if ( checkFieldWithDuplicate( parser, "timezone", null, parsed ) )
            {
                _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                contributor.setLocation( "timezone", _location );
                contributor.setTimezone( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
            {
                InputLocation _locations;
                _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                contributor.setLocation( "properties", _locations );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    String key = parser.getName();
                    _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                    _locations.setLocation( key, _location );
                    String value = parser.nextText().trim();
                    contributor.addProperty( key, value );
                }
            }
            else
            {
                checkUnknownElement( parser, strict );
View Full Code Here

        assertEquals( "jvanzyl", dev0.getId() );
        assertEquals( "Jason van Zyl", dev0.getName() );

        // Contributors
        List<Contributor> contributors = model.getContributors();
        Contributor con0 = contributors.get( 0 );
        assertEquals( "Will Price", con0.getName() );

        // DependencyManagement
        List<Dependency> depManDependencies = model.getDependencyManagement().getDependencies();
        assertEquals( 2, depManDependencies.size() );
View Full Code Here

TOP

Related Classes of org.apache.maven.model.Contributor

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.