Skip to content

Commit

Permalink
0002499: Add variable transform for system_timestamp_utc
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Feb 19, 2016
1 parent 6daa2a5 commit 090b75c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package org.jumpmind.symmetric.io.data.transform;

import java.util.Map;
import java.util.TimeZone;

import org.apache.commons.lang.time.DateFormatUtils;
import org.jumpmind.db.platform.IDatabasePlatform;
Expand All @@ -41,6 +42,8 @@ public class VariableColumnTransform implements ISingleValueColumnTransform, IBu

protected static final String OPTION_TIMESTAMP = "system_timestamp";

protected static final String OPTION_TIMESTAMP_UTC = "system_timestamp_utc";

protected static final String OPTION_DATE = "system_date";

protected static final String OPTION_SOURCE_NODE_ID = "source_node_id";
Expand All @@ -57,7 +60,7 @@ public class VariableColumnTransform implements ISingleValueColumnTransform, IBu

protected static final String OPTION_SOURCE_SCHEMA_NAME = "source_schema_name";

private static final String[] OPTIONS = new String[] { OPTION_TIMESTAMP, OPTION_DATE,
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_SCHEMA_NAME, OPTION_SOURCE_TABLE_NAME };

Expand Down Expand Up @@ -85,6 +88,8 @@ public String transform(IDatabasePlatform platform,
if (varName != null) {
if (varName.equalsIgnoreCase(OPTION_TIMESTAMP)) {
return DateFormatUtils.format(System.currentTimeMillis(), TS_PATTERN);
} else if (varName.equalsIgnoreCase(OPTION_TIMESTAMP_UTC)) {
return DateFormatUtils.format(System.currentTimeMillis(), TS_PATTERN, TimeZone.getTimeZone("GMT"));
} else if (varName.equalsIgnoreCase(OPTION_DATE)) {
return DateFormatUtils.format(System.currentTimeMillis(), DATE_PATTERN);
} else if (varName.equalsIgnoreCase(OPTION_SOURCE_NODE_ID)) {
Expand Down

0 comments on commit 090b75c

Please sign in to comment.