Skip to content
Permalink
Browse files

0003838: Ability to resolve a row in error on the incoming side and

provide resolve data
  • Loading branch information...
jumpmind-josh committed Dec 19, 2018
1 parent b5a3c4c commit 9aaf4fda0146bdd21267c6ddee3152c089bffec9
@@ -38,6 +38,7 @@
import org.jumpmind.symmetric.io.data.DataEventType;
import org.jumpmind.symmetric.io.data.IDataWriter;
import org.jumpmind.symmetric.io.data.writer.Conflict.DetectConflict;
import org.jumpmind.symmetric.io.data.writer.Conflict.PingBack;
import org.jumpmind.util.Statistics;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -230,10 +231,20 @@ public void write(CsvData data) {
rollback();
throw ex;
} catch (RuntimeException ex) {
DatabaseWriterSettings writerSettings = getWriterSettings();
Statistics batchStatistics = getStatistics().get(getBatch());
long statementCount = batchStatistics.get(DataWriterStatisticConstants.ROWCOUNT);
long lineNumber = batchStatistics.get(DataWriterStatisticConstants.LINENUMBER);
ResolvedData resolvedData = getWriterSettings().getResolvedData(statementCount);

if (conflictResolver != null && conflictResolver.isIgnoreRow(this, data)) {
statistics.get(batch).increment(DataWriterStatisticConstants.IGNOREROWCOUNT);
} else if (conflictResolver != null && resolvedData != null) {
Conflict conflict = new Conflict();
conflict.setPingBack(PingBack.REMAINING_ROWS);
conflictResolver.attemptToResolve(resolvedData, data, this, conflict);
} else {
if (filterError(data, ex)) {
if (filterError(data, ex)) {
if (!(ex instanceof SqlException)) {
/*
* SQL exceptions should have already been logged
@@ -227,7 +227,7 @@ protected void ignore(AbstractDatabaseWriter writer, Conflict conflict) {
}
}

protected void attemptToResolve(ResolvedData resolvedData, CsvData data, AbstractDatabaseWriter writer, Conflict conflict) {
public void attemptToResolve(ResolvedData resolvedData, CsvData data, AbstractDatabaseWriter writer, Conflict conflict) {
if (resolvedData != null) {
if (!resolvedData.isIgnoreRow()) {
data.putCsvData(CsvData.ROW_DATA, resolvedData.getResolvedData());
@@ -30,4 +30,5 @@

public boolean isIgnoreRow(AbstractDatabaseWriter writer, CsvData data);

public void attemptToResolve(ResolvedData resolvedData, CsvData data, AbstractDatabaseWriter writer, Conflict conflict);
}

0 comments on commit 9aaf4fd

Please sign in to comment.
You can’t perform that action at this time.