Skip to content

Commit

Permalink
0005449: Add SOURCE_NODE_ID_FROM_DATA to VariableColumnTransform to
Browse files Browse the repository at this point in the history
allow using the source_node_id from the data
  • Loading branch information
Philip Marzullo committed Sep 7, 2022
1 parent 1d4fca8 commit 2e0091d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Expand Up @@ -100,8 +100,9 @@ The variable name is placed in transform expression. The following variables are
|system_date|current system date
|system_timestamp|current system date and time using default timezone
|system_timestamp_utc|current system date and time using UTC timezone
|source_node_id|node id of the source
|target_node_id|node id of the target
|source_node_id|node id of the source (from the batch)
|target_node_id|node id of the target (from the batch)
|source_node_id_from_data|source_node_id value from sym_data (source of a captured synchronization data change)
|null|null value
|old_column_value|column's old value prior to the DML operation.

Expand Down
Expand Up @@ -27,6 +27,7 @@
import org.jumpmind.db.platform.IDatabasePlatform;
import org.jumpmind.extension.IBuiltInExtensionPoint;
import org.jumpmind.symmetric.common.Constants;
import org.jumpmind.symmetric.io.data.CsvData;
import org.jumpmind.symmetric.io.data.DataContext;
import org.jumpmind.symmetric.io.data.DataEventType;
import org.jumpmind.symmetric.model.Data;
Expand All @@ -41,6 +42,7 @@ public class VariableColumnTransform implements ISingleNewAndOldValueColumnTrans
protected static final String OPTION_DATE = "system_date";
protected static final String OPTION_SOURCE_NODE_ID = "source_node_id";
protected static final String OPTION_TARGET_NODE_ID = "target_node_id";
protected static final String OPTION_SOURCE_NODE_ID_FROM_DATA = "source_node_id_from_data";
protected static final String OPTION_NULL = "null";
protected static final String OPTION_OLD_VALUE = "old_column_value";
protected static final String OPTION_SOURCE_TABLE_NAME = "source_table_name";
Expand All @@ -51,7 +53,8 @@ public class VariableColumnTransform implements ISingleNewAndOldValueColumnTrans
protected static final String OPTION_BATCH_START_TIME = "batch_start_time";
protected static final String OPTION_DELETE_INDICATOR_FLAG = "delete_indicator_flag";
private static final String[] OPTIONS = new String[] { OPTION_TIMESTAMP, OPTION_TIMESTAMP_UTC, OPTION_DATE,
OPTION_SOURCE_NODE_ID, OPTION_TARGET_NODE_ID, OPTION_NULL, OPTION_OLD_VALUE, OPTION_SOURCE_CATALOG_NAME,
OPTION_SOURCE_NODE_ID, OPTION_TARGET_NODE_ID, OPTION_SOURCE_NODE_ID_FROM_DATA,
OPTION_NULL, OPTION_OLD_VALUE, OPTION_SOURCE_CATALOG_NAME,
OPTION_SOURCE_SCHEMA_NAME, OPTION_SOURCE_TABLE_NAME, OPTION_SOURCE_DML_TYPE, OPTION_BATCH_ID, OPTION_BATCH_START_TIME,
OPTION_DELETE_INDICATOR_FLAG };

Expand Down Expand Up @@ -88,6 +91,8 @@ public NewAndOldValue transform(IDatabasePlatform platform,
value = context.getBatch().getSourceNodeId();
} else if (varName.equalsIgnoreCase(OPTION_TARGET_NODE_ID)) {
value = context.getBatch().getTargetNodeId();
} else if (varName.equalsIgnoreCase(OPTION_SOURCE_NODE_ID_FROM_DATA)) {
value = context.getData().getAttribute(CsvData.ATTRIBUTE_SOURCE_NODE_ID);
} else if (varName.equalsIgnoreCase(OPTION_OLD_VALUE)) {
value = oldValue;
} else if (varName.equals(OPTION_NULL)) {
Expand Down

0 comments on commit 2e0091d

Please sign in to comment.