Search in sources :

Example 6 with DefaultMelCompatibilityResolver

use of com.mulesoft.tools.migration.library.tools.mel.DefaultMelCompatibilityResolver in project mule-migration-assistant by mulesoft.

the class DbSelect method execute.

@Override
public void execute(Element object, MigrationReport report) throws RuntimeException {
    migrateSql(object);
    migrateInputParams(object);
    if (object.getAttribute("streaming") == null || "false".equals(object.getAttributeValue("streaming"))) {
        report.report("db.streaming", object, object);
    }
    object.removeAttribute("streaming");
    if (object.getAttribute("source") != null) {
        report.report("db.source", object, object);
        object.removeAttribute("source");
    }
    migrateOperationStructure(getApplicationModel(), object, report, false, getExpressionMigrator(), new DefaultMelCompatibilityResolver());
}
Also used : DefaultMelCompatibilityResolver(com.mulesoft.tools.migration.library.tools.mel.DefaultMelCompatibilityResolver)

Example 7 with DefaultMelCompatibilityResolver

use of com.mulesoft.tools.migration.library.tools.mel.DefaultMelCompatibilityResolver in project mule-migration-assistant by mulesoft.

the class DbStoredProcedure method execute.

@Override
public void execute(Element object, MigrationReport report) throws RuntimeException {
    migrateSql(object);
    migrateInputParamTypes(object);
    migrateInputParams(object);
    List<Element> outParams = object.getChildren("out-param", DB_NAMESPACE).stream().map(ip -> new Element("output-parameter", DB_NAMESPACE).setAttribute("key", ip.getAttributeValue("name"))).collect(toList());
    if (!outParams.isEmpty()) {
        object.addContent(new Element("output-parameters", DB_NAMESPACE).addContent(outParams));
    }
    object.removeChildren("out-param", DB_NAMESPACE);
    List<Element> inoutParams = object.getChildren("inout-param", DB_NAMESPACE).stream().map(ip -> new Element("in-out-parameter", DB_NAMESPACE).setAttribute("key", ip.getAttributeValue("name")).setAttribute("value", ip.getAttributeValue("value"))).collect(toList());
    if (!inoutParams.isEmpty()) {
        object.addContent(new Element("in-out-parameters", DB_NAMESPACE).addContent(inoutParams));
    }
    object.removeChildren("inout-param", DB_NAMESPACE);
    if (object.getAttribute("streaming") == null || "false".equals(object.getAttributeValue("streaming"))) {
        report.report("db.streaming", object, object);
    }
    object.removeAttribute("streaming");
    if (object.getAttribute("source") != null) {
        report.report("db.source", object, object);
        object.removeAttribute("source");
    }
    migrateOperationStructure(getApplicationModel(), object, report, false, getExpressionMigrator(), new DefaultMelCompatibilityResolver());
}
Also used : Collectors.toList(java.util.stream.Collectors.toList) DefaultMelCompatibilityResolver(com.mulesoft.tools.migration.library.tools.mel.DefaultMelCompatibilityResolver) List(java.util.List) XmlDslUtils.migrateOperationStructure(com.mulesoft.tools.migration.step.util.XmlDslUtils.migrateOperationStructure) MigrationReport(com.mulesoft.tools.migration.step.category.MigrationReport) Element(org.jdom2.Element) Element(org.jdom2.Element) DefaultMelCompatibilityResolver(com.mulesoft.tools.migration.library.tools.mel.DefaultMelCompatibilityResolver)

Example 8 with DefaultMelCompatibilityResolver

use of com.mulesoft.tools.migration.library.tools.mel.DefaultMelCompatibilityResolver in project mule-migration-assistant by mulesoft.

the class DbUpdate method execute.

@Override
public void execute(Element object, MigrationReport report) throws RuntimeException {
    migrateSql(object);
    if ("true".equals(object.getAttributeValue("bulkMode"))) {
        object.setName("bulk-update");
        object.removeAttribute("bulkMode");
        migrateBulkInputParams(object);
    } else {
        migrateInputParams(object);
    }
    if (object.getAttribute("source") != null) {
        report.report("db.source", object, object);
        object.removeAttribute("source");
    }
    migrateOperationStructure(getApplicationModel(), object, report, false, getExpressionMigrator(), new DefaultMelCompatibilityResolver());
}
Also used : DefaultMelCompatibilityResolver(com.mulesoft.tools.migration.library.tools.mel.DefaultMelCompatibilityResolver)

Aggregations

DefaultMelCompatibilityResolver (com.mulesoft.tools.migration.library.tools.mel.DefaultMelCompatibilityResolver)8 Element (org.jdom2.Element)5 MigrationReport (com.mulesoft.tools.migration.step.category.MigrationReport)3 List (java.util.List)3 Collectors.toList (java.util.stream.Collectors.toList)3 XmlDslUtils.migrateOperationStructure (com.mulesoft.tools.migration.step.util.XmlDslUtils.migrateOperationStructure)2 com.mulesoft.tools (com.mulesoft.tools)1 PluginsVersions.targetVersion (com.mulesoft.tools.migration.library.tools.PluginsVersions.targetVersion)1 MelCompatibilityResolver (com.mulesoft.tools.migration.library.tools.mel.MelCompatibilityResolver)1 ApplicationModel (com.mulesoft.tools.migration.project.model.ApplicationModel)1 Dependency (com.mulesoft.tools.migration.project.model.pom.Dependency)1 XmlDslUtils.addCompatibilityNamespace (com.mulesoft.tools.migration.step.util.XmlDslUtils.addCompatibilityNamespace)1 ExpressionMigrator (com.mulesoft.tools.migration.util.ExpressionMigrator)1 String.format (java.lang.String.format)1 Arrays (java.util.Arrays)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 Function (java.util.function.Function)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 Collectors (java.util.stream.Collectors)1