Skip to content

Commit

Permalink
0004034: Create tables based on target table name and column names set
Browse files Browse the repository at this point in the history
by routers and transforms
  • Loading branch information
joshahicks committed Jun 22, 2023
1 parent 980217a commit 693e0b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Expand Up @@ -32,6 +32,7 @@
import org.jumpmind.symmetric.db.ISymmetricDialect;
import org.jumpmind.symmetric.model.Node;
import org.jumpmind.symmetric.model.Router;
import org.jumpmind.symmetric.model.Trigger;
import org.jumpmind.symmetric.model.TriggerHistory;
import org.jumpmind.symmetric.service.ITriggerRouterService;
import org.jumpmind.symmetric.util.SymmetricUtils;
Expand Down Expand Up @@ -106,10 +107,12 @@ protected Table lookupAndOrderColumnsAccordingToTriggerHistory(String routerId,
table.setSchema(null);
} else if (StringUtils.isNotBlank(router.getTargetSchemaName())) {
table.setSchema(SymmetricUtils.replaceNodeVariables(sourceNode, targetNode, router.getTargetSchemaName()));
table.setSchema(SymmetricUtils.replaceCatalogSchemaVariables(catalogName, schemaName, router.getTargetSchemaName()));
}
if (StringUtils.isNotBlank(router.getTargetTableName())) {
table.setName(router.getTargetTableName());
}

}
return table;
}
Expand Down
Expand Up @@ -163,6 +163,16 @@ public static String replaceNodeVariables(Node sourceNode, Node targetNode, Stri
}
return str;
}

public static String replaceCatalogSchemaVariables(String catalogName, String schemaName, String str) {
if (catalogName != null) {
str = FormatUtils.replace("sourceCatalogName", catalogName, str);
}
if (schemaName != null) {
str = FormatUtils.replace("sourceSchemaName", schemaName, str);
}
return str;
}

public static void logNotices() {
synchronized (SymmetricUtils.class) {
Expand Down

0 comments on commit 693e0b3

Please sign in to comment.