org.apache.maven.model.MailingList Java Examples

The following examples show how to use org.apache.maven.model.MailingList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocationAwareMavenXpp3Writer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void writeMailingList(MailingList mailingList, String tagName, XmlSerializer serializer)
        throws java.io.IOException {
    serializer.startTag(NAMESPACE, tagName);
    flush(serializer);
    StringBuffer b = b(serializer);
    int start = b.length();

    if (mailingList.getName() != null) {
        writeValue(serializer, "name", mailingList.getName(), mailingList);
    }
    if (mailingList.getSubscribe() != null) {
        writeValue(serializer, "subscribe", mailingList.getSubscribe(), mailingList);
    }
    if (mailingList.getUnsubscribe() != null) {
        writeValue(serializer, "unsubscribe", mailingList.getUnsubscribe(), mailingList);
    }
    if (mailingList.getPost() != null) {
        writeValue(serializer, "post", mailingList.getPost(), mailingList);
    }
    if (mailingList.getArchive() != null) {
        writeValue(serializer, "archive", mailingList.getArchive(), mailingList);
    }
    if ((mailingList.getOtherArchives() != null) && (mailingList.getOtherArchives().size() > 0)) {
        serializer.startTag(NAMESPACE, "otherArchives");
        flush(serializer);
        InputLocation otherLoc = mailingList.getLocation("otherArchives");
        int index = 0;
        for (Iterator<String> iter = mailingList.getOtherArchives().iterator(); iter.hasNext();) {
            String otherArchive = iter.next();
            writeValue(serializer, "otherArchive", otherArchive, otherLoc, index);
            index = index + 1;
        }
        serializer.endTag(NAMESPACE, "otherArchives");
    }
    serializer.endTag(NAMESPACE, tagName).flush();
    logLocation(mailingList, "", start, b.length());

}
 
Example #2
Source File: Maven2RepositoryStorage.java    From archiva with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #3
Source File: MavenHelper.java    From cyclonedx-gradle-plugin with Apache License 2.0 4 votes vote down vote up
/**
 * Extracts data from a project and adds the data to the component.
 * @param project the project to extract data from
 * @param component the component to add data to
 */
private void extractMetadata(MavenProject project, Component component) {
    if (component.getPublisher() == null) {
        // If we don't already have publisher information, retrieve it.
        if (project.getOrganization() != null) {
            component.setPublisher(project.getOrganization().getName());
        }
    }
    if (component.getDescription() == null) {
        // If we don't already have description information, retrieve it.
        component.setDescription(project.getDescription());
    }
    if (component.getLicenseChoice() == null || component.getLicenseChoice().getLicenses() == null || component.getLicenseChoice().getLicenses().isEmpty()) {
        // If we don't already have license information, retrieve it.
        if (project.getLicenses() != null) {
            component.setLicenseChoice(resolveMavenLicenses(project.getLicenses()));
        }
    }
    if (CycloneDxSchema.Version.VERSION_10 != schemaVersion) {
        if (project.getOrganization() != null && project.getOrganization().getUrl() != null) {
            if (!doesComponentHaveExternalReference(component, ExternalReference.Type.WEBSITE)) {
                addExternalReference(ExternalReference.Type.WEBSITE, project.getOrganization().getUrl(), component);
            }
        }
        if (project.getCiManagement() != null && project.getCiManagement().getUrl() != null) {
            if (!doesComponentHaveExternalReference(component, ExternalReference.Type.BUILD_SYSTEM)) {
                addExternalReference(ExternalReference.Type.BUILD_SYSTEM, project.getCiManagement().getUrl(), component);
            }
        }
        if (project.getDistributionManagement() != null && project.getDistributionManagement().getDownloadUrl() != null) {
            if (!doesComponentHaveExternalReference(component, ExternalReference.Type.DISTRIBUTION)) {
                addExternalReference(ExternalReference.Type.DISTRIBUTION, project.getDistributionManagement().getDownloadUrl(), component);
            }
        }
        if (project.getDistributionManagement() != null && project.getDistributionManagement().getRepository() != null) {
            if (!doesComponentHaveExternalReference(component, ExternalReference.Type.DISTRIBUTION)) {
                addExternalReference(ExternalReference.Type.DISTRIBUTION, project.getDistributionManagement().getRepository().getUrl(), component);
            }
        }
        if (project.getIssueManagement() != null && project.getIssueManagement().getUrl() != null) {
            if (!doesComponentHaveExternalReference(component, ExternalReference.Type.ISSUE_TRACKER)) {
                addExternalReference(ExternalReference.Type.ISSUE_TRACKER, project.getIssueManagement().getUrl(), component);
            }
        }
        if (project.getMailingLists() != null && project.getMailingLists().size() > 0) {
            for (MailingList list : project.getMailingLists()) {
                if (list.getArchive() != null) {
                    if (!doesComponentHaveExternalReference(component, ExternalReference.Type.MAILING_LIST)) {
                        addExternalReference(ExternalReference.Type.MAILING_LIST, list.getArchive(), component);
                    }
                } else if (list.getSubscribe() != null) {
                    if (!doesComponentHaveExternalReference(component, ExternalReference.Type.MAILING_LIST)) {
                        addExternalReference(ExternalReference.Type.MAILING_LIST, list.getSubscribe(), component);
                    }
                }
            }
        }
        if (project.getScm() != null && project.getScm().getUrl() != null) {
            if (!doesComponentHaveExternalReference(component, ExternalReference.Type.VCS)) {
                addExternalReference(ExternalReference.Type.VCS, project.getScm().getUrl(), component);
            }
        }
    }
}
 
Example #4
Source File: BaseCycloneDxMojo.java    From cyclonedx-maven-plugin with Apache License 2.0 4 votes vote down vote up
/**
 * Extracts data from a project and adds the data to the component.
 * @param project the project to extract data from
 * @param component the component to add data to
 */
private void extractMetadata(MavenProject project, Component component) {
    if (component.getPublisher() == null) {
        // If we don't already have publisher information, retrieve it.
        if (project.getOrganization() != null) {
            component.setPublisher(project.getOrganization().getName());
        }
    }
    if (component.getDescription() == null) {
        // If we don't already have description information, retrieve it.
        component.setDescription(project.getDescription());
    }
    if (component.getLicenseChoice() == null || component.getLicenseChoice().getLicenses() == null || component.getLicenseChoice().getLicenses().isEmpty()) {
        // If we don't already have license information, retrieve it.
        if (project.getLicenses() != null) {
            component.setLicenseChoice(resolveMavenLicenses(project.getLicenses()));
        }
    }
    if (CycloneDxSchema.Version.VERSION_10 != schemaVersion()) {
        if (project.getOrganization() != null && project.getOrganization().getUrl() != null) {
            if (!doesComponentHaveExternalReference(component, ExternalReference.Type.WEBSITE)) {
                addExternalReference(ExternalReference.Type.WEBSITE, project.getOrganization().getUrl(), component);
            }
        }
        if (project.getCiManagement() != null && project.getCiManagement().getUrl() != null) {
            if (!doesComponentHaveExternalReference(component, ExternalReference.Type.BUILD_SYSTEM)) {
                addExternalReference(ExternalReference.Type.BUILD_SYSTEM, project.getCiManagement().getUrl(), component);
            }
        }
        if (project.getDistributionManagement() != null && project.getDistributionManagement().getDownloadUrl() != null) {
            if (!doesComponentHaveExternalReference(component, ExternalReference.Type.DISTRIBUTION)) {
                addExternalReference(ExternalReference.Type.DISTRIBUTION, project.getDistributionManagement().getDownloadUrl(), component);
            }
        }
        if (project.getDistributionManagement() != null && project.getDistributionManagement().getRepository() != null) {
            if (!doesComponentHaveExternalReference(component, ExternalReference.Type.DISTRIBUTION)) {
                addExternalReference(ExternalReference.Type.DISTRIBUTION, project.getDistributionManagement().getRepository().getUrl(), component);
            }
        }
        if (project.getIssueManagement() != null && project.getIssueManagement().getUrl() != null) {
            if (!doesComponentHaveExternalReference(component, ExternalReference.Type.ISSUE_TRACKER)) {
                addExternalReference(ExternalReference.Type.ISSUE_TRACKER, project.getIssueManagement().getUrl(), component);
            }
        }
        if (project.getMailingLists() != null && project.getMailingLists().size() > 0) {
            for (MailingList list : project.getMailingLists()) {
                if (list.getArchive() != null) {
                    if (!doesComponentHaveExternalReference(component, ExternalReference.Type.MAILING_LIST)) {
                        addExternalReference(ExternalReference.Type.MAILING_LIST, list.getArchive(), component);
                    }
                } else if (list.getSubscribe() != null) {
                    if (!doesComponentHaveExternalReference(component, ExternalReference.Type.MAILING_LIST)) {
                        addExternalReference(ExternalReference.Type.MAILING_LIST, list.getSubscribe(), component);
                    }
                }
            }
        }
        if (project.getScm() != null && project.getScm().getUrl() != null) {
            if (!doesComponentHaveExternalReference(component, ExternalReference.Type.VCS)) {
                addExternalReference(ExternalReference.Type.VCS, project.getScm().getUrl(), component);
            }
        }
    }
}
 
Example #5
Source File: PomProperty.java    From flatten-maven-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public List<MailingList> get( Model model )
{
    return model.getMailingLists();
}
 
Example #6
Source File: PomProperty.java    From flatten-maven-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public void set( Model model, List<MailingList> value )
{
    model.setMailingLists( value );
}