Search in sources :

Example 1 with ADDITIONAL_SPRING_NAMESPACES_PROP

use of com.mulesoft.tools.migration.library.mule.steps.spring.SpringContributions.ADDITIONAL_SPRING_NAMESPACES_PROP in project mule-migration-assistant by mulesoft.

the class PreprocessNamespaces method addReportEntries.

public void addReportEntries(Document document, MigrationReport report, ApplicationModel applicationModel) {
    List<Namespace> unsupportedNamespaces = document.getRootElement().getAdditionalNamespaces().stream().filter(n -> !getElementsWithNamespace(document, n, applicationModel).isEmpty() && !containsNamespace(n, applicationModel.getSupportedNamespaces())).collect(toList());
    AtomicInteger processedElements = new AtomicInteger(0);
    unsupportedNamespaces.forEach(ns -> {
        // Ignore nested elements of the same pass to not distort statistics or clutter the report
        applicationModel.getNodes("//*[namespace-uri() = '" + ns.getURI() + "' and namespace-uri(..) != '" + ns.getURI() + "']").forEach(node -> {
            processedElements.incrementAndGet();
            if (ns.getURI().startsWith("http://www.mulesoft.org")) {
                report.report("components.unsupported", node, node, ns.getPrefix());
            } else {
                report.report("components.unknown", node, node, ns.getPrefix(), ns.getURI(), ADDITIONAL_SPRING_NAMESPACES_PROP);
            }
            report.addComponentFailure(node);
        });
    });
    report.addProcessedElements(processedElements.get());
}
Also used : Document(org.jdom2.Document) Collectors.toList(java.util.stream.Collectors.toList) List(java.util.List) ADDITIONAL_SPRING_NAMESPACES_PROP(com.mulesoft.tools.migration.library.mule.steps.spring.SpringContributions.ADDITIONAL_SPRING_NAMESPACES_PROP) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ApplicationModel.getElementsWithNamespace(com.mulesoft.tools.migration.project.model.ApplicationModel.getElementsWithNamespace) NamespaceContribution(com.mulesoft.tools.migration.step.category.NamespaceContribution) Namespace(org.jdom2.Namespace) AdditionalNamespacesFactory.containsNamespace(com.mulesoft.tools.migration.xml.AdditionalNamespacesFactory.containsNamespace) MigrationReport(com.mulesoft.tools.migration.step.category.MigrationReport) ApplicationModel(com.mulesoft.tools.migration.project.model.ApplicationModel) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ApplicationModel.getElementsWithNamespace(com.mulesoft.tools.migration.project.model.ApplicationModel.getElementsWithNamespace) Namespace(org.jdom2.Namespace) AdditionalNamespacesFactory.containsNamespace(com.mulesoft.tools.migration.xml.AdditionalNamespacesFactory.containsNamespace)

Aggregations

ADDITIONAL_SPRING_NAMESPACES_PROP (com.mulesoft.tools.migration.library.mule.steps.spring.SpringContributions.ADDITIONAL_SPRING_NAMESPACES_PROP)1 ApplicationModel (com.mulesoft.tools.migration.project.model.ApplicationModel)1 ApplicationModel.getElementsWithNamespace (com.mulesoft.tools.migration.project.model.ApplicationModel.getElementsWithNamespace)1 MigrationReport (com.mulesoft.tools.migration.step.category.MigrationReport)1 NamespaceContribution (com.mulesoft.tools.migration.step.category.NamespaceContribution)1 AdditionalNamespacesFactory.containsNamespace (com.mulesoft.tools.migration.xml.AdditionalNamespacesFactory.containsNamespace)1 List (java.util.List)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Collectors.toList (java.util.stream.Collectors.toList)1 Document (org.jdom2.Document)1 Namespace (org.jdom2.Namespace)1