Skip to content

Commit

Permalink
0002306: Add a trim() column transform
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed May 29, 2015
1 parent 2fca3c4 commit 9f94417
Showing 1 changed file with 37 additions and 0 deletions.
@@ -0,0 +1,37 @@
package org.jumpmind.symmetric.io.data.transform;

import java.util.Map;

import org.jumpmind.db.platform.IDatabasePlatform;
import org.jumpmind.extension.IBuiltInExtensionPoint;
import org.jumpmind.symmetric.io.data.DataContext;

public class TrimColumnTransform implements ISingleNewAndOldValueColumnTransform, IBuiltInExtensionPoint {

public static final String NAME = "trim";

public String getName() {
return NAME;
}

public boolean isExtractColumnTransform() {
return true;
}

public boolean isLoadColumnTransform() {
return true;
}

public NewAndOldValue transform(IDatabasePlatform platform, DataContext context,
TransformColumn column, TransformedData data, Map<String, String> sourceValues, String newValue, String oldValue)
throws IgnoreColumnException, IgnoreRowException {
if (newValue != null) {
newValue = newValue.trim();
}
if (oldValue != null) {
oldValue = oldValue.trim();
}
return new NewAndOldValue(newValue, oldValue);
}

}

0 comments on commit 9f94417

Please sign in to comment.