use of org.jumpmind.symmetric.io.data.transform.TransformTable in project symmetric-ds by JumpMind.
the class DataExtractorService method createTransformDataWriter.
protected TransformWriter createTransformDataWriter(Node identity, Node targetNode, IDataWriter extractWriter) {
List<TransformTableNodeGroupLink> transformsList = null;
if (targetNode != null) {
transformsList = transformService.findTransformsFor(new NodeGroupLink(identity.getNodeGroupId(), targetNode.getNodeGroupId()), TransformPoint.EXTRACT);
}
TransformTable[] transforms = transformsList != null ? transformsList.toArray(new TransformTable[transformsList.size()]) : null;
TransformWriter transformExtractWriter = new TransformWriter(symmetricDialect.getPlatform(), TransformPoint.EXTRACT, extractWriter, transformService.getColumnTransforms(), transforms);
return transformExtractWriter;
}
use of org.jumpmind.symmetric.io.data.transform.TransformTable in project symmetric-ds by JumpMind.
the class JavaColumnTransformTest method testInnerClass.
@Test
public void testInnerClass() throws Exception {
String javaCode = "final DataContext ctx = context;" + "HashMap namedParams = new HashMap();" + "context.findTransaction().query(\"sql\", new ISqlRowMapper<Object>() {" + " public Object mapRow(Row row) {" + " ctx.put(\"a\", row.getString(\"b\"));" + " return null;" + " }" + "}, namedParams);" + "return \"transValue\";";
TransformColumn column = new TransformColumn("sColumn", "tColumn", false, "java", javaCode);
TransformTable table = new TransformTable("sTable", "tTable", TransformPoint.LOAD, column);
Map<String, String> sourceKeyValues = new HashMap<String, String>();
Map<String, String> sourceValues = new HashMap<String, String>();
sourceValues.put("sColumn", "aNewValue");
Map<String, String> oldSourceValues = new HashMap<String, String>();
oldSourceValues.put("sColumn", "anOldValue");
TransformedData data = new TransformedData(table, DataEventType.INSERT, sourceKeyValues, oldSourceValues, sourceValues);
JavaColumnTransform transform = new JavaColumnTransform(extensionService);
String out = transform.transform(platform, context, column, data, sourceValues, "aNewValue", "anOldValue");
assertEquals("transValue", out);
}
Aggregations