Search in sources :

Example 6 with MailingList

use of org.apache.maven.model.MailingList in project archiva by apache.

the class Maven2RepositoryStorage method convertMailingLists.

private List<org.apache.archiva.metadata.model.MailingList> convertMailingLists(List<MailingList> mailingLists) {
    List<org.apache.archiva.metadata.model.MailingList> l = new ArrayList<>();
    for (MailingList mailingList : mailingLists) {
        org.apache.archiva.metadata.model.MailingList newMailingList = new org.apache.archiva.metadata.model.MailingList();
        newMailingList.setName(mailingList.getName());
        newMailingList.setMainArchiveUrl(mailingList.getArchive());
        newMailingList.setPostAddress(mailingList.getPost());
        newMailingList.setSubscribeAddress(mailingList.getSubscribe());
        newMailingList.setUnsubscribeAddress(mailingList.getUnsubscribe());
        newMailingList.setOtherArchives(mailingList.getOtherArchives());
        l.add(newMailingList);
    }
    return l;
}
Also used : MailingList(org.apache.maven.model.MailingList) ArrayList(java.util.ArrayList)

Example 7 with MailingList

use of org.apache.maven.model.MailingList in project maven-plugins by apache.

the class MavenJDOMWriter method iterateMailingList.

// -- void iterateLicense(Counter, Element, java.util.Collection, java.lang.String, java.lang.String)
/**
 * Method iterateMailingList
 *
 * @param counter
 * @param childTag
 * @param parentTag
 * @param list
 * @param parent
 */
protected void iterateMailingList(Counter counter, Element parent, Collection<MailingList> 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<?> elIt = element.getChildren(childTag, element.getNamespace()).iterator();
        if (!elIt.hasNext()) {
            elIt = null;
        }
        Counter innerCount = new Counter(counter.getDepth() + 1);
        for (MailingList value : list) {
            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);
            }
            updateMailingList(value, childTag, innerCount, el);
            innerCount.increaseCount();
        }
        if (elIt != null) {
            while (elIt.hasNext()) {
                elIt.next();
                elIt.remove();
            }
        }
    }
}
Also used : Element(org.jdom.Element) MailingList(org.apache.maven.model.MailingList)

Example 8 with MailingList

use of org.apache.maven.model.MailingList in project maven-archetype by apache.

the class MavenJDOMWriter method iterateMailingList.

// -- void iterateLicense(Counter, Element, java.util.Collection, java.lang.String,
// java.lang.String)
/**
 * Method iterateMailingList.
 *
 * @param counter
 * @param childTag
 * @param parentTag
 * @param list
 * @param parent
 */
protected void iterateMailingList(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()) {
            MailingList value = (MailingList) 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);
            }
            updateMailingList(value, childTag, innerCount, el);
            innerCount.increaseCount();
        }
        if (elIt != null) {
            while (elIt.hasNext()) {
                elIt.next();
                elIt.remove();
            }
        }
    }
}
Also used : Element(org.jdom.Element) ListIterator(java.util.ListIterator) Iterator(java.util.Iterator) MailingList(org.apache.maven.model.MailingList)

Aggregations

MailingList (org.apache.maven.model.MailingList)8 Element (org.jdom.Element)4 Iterator (java.util.Iterator)3 ImmutableMap (com.google.common.collect.ImmutableMap)1 IOException (java.io.IOException)1 Reader (java.io.Reader)1 StringReader (java.io.StringReader)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 ListIterator (java.util.ListIterator)1 Map (java.util.Map)1 Properties (java.util.Properties)1 XmlStreamReader (org.apache.commons.io.input.XmlStreamReader)1 ParseException (org.apache.maven.doxia.parser.ParseException)1 ParserNotFoundException (org.apache.maven.doxia.parser.manager.ParserNotFoundException)1 SinkAdapter (org.apache.maven.doxia.sink.impl.SinkAdapter)1 DecorationXpp3Reader (org.apache.maven.doxia.site.decoration.io.xpp3.DecorationXpp3Reader)1 Build (org.apache.maven.model.Build)1 CiManagement (org.apache.maven.model.CiManagement)1 Contributor (org.apache.maven.model.Contributor)1