Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/3.8' into 3.9
Conflicts: symmetric-client/src/main/java/org/jumpmind/symmetric/io/MsSqlBulkDatabaseWriter.java symmetric-client/src/main/java/org/jumpmind/symmetric/io/MySqlBulkDatabaseWriter.java symmetric-client/src/main/java/org/jumpmind/symmetric/io/PostgresBulkDatabaseWriter.java symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/MultiBatchStagingWriter.java
- Loading branch information
Showing
14 changed files
with
475 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
symmetric-client/src/main/java/org/jumpmind/symmetric/io/AbstractBulkDatabaseWriter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.jumpmind.symmetric.io; | ||
|
||
import org.jumpmind.db.platform.IDatabasePlatform; | ||
import org.jumpmind.symmetric.io.data.Batch; | ||
import org.jumpmind.symmetric.io.data.CsvData; | ||
import org.jumpmind.symmetric.io.data.writer.DatabaseWriterSettings; | ||
import org.jumpmind.symmetric.io.data.writer.DefaultDatabaseWriter; | ||
import org.jumpmind.symmetric.model.IncomingBatch; | ||
|
||
public abstract class AbstractBulkDatabaseWriter extends DefaultDatabaseWriter{ | ||
|
||
protected boolean useDefaultDataWriter; | ||
|
||
public AbstractBulkDatabaseWriter(IDatabasePlatform platform){ | ||
super(platform); | ||
} | ||
|
||
public AbstractBulkDatabaseWriter(IDatabasePlatform platform, DatabaseWriterSettings settings) { | ||
super(platform, settings); | ||
} | ||
|
||
public final void write(CsvData data) { | ||
if (useDefaultDataWriter) { | ||
writeDefault(data); | ||
}else{ | ||
bulkWrite(data); | ||
} | ||
} | ||
|
||
protected final void writeDefault(CsvData data) { | ||
super.write(data); | ||
} | ||
|
||
protected abstract void bulkWrite(CsvData data); | ||
|
||
@Override | ||
public void start(Batch batch) { | ||
super.start(batch); | ||
IncomingBatch currentBatch = (IncomingBatch) context.get("currentBatch"); | ||
useDefaultDataWriter = currentBatch == null ? false : currentBatch.isErrorFlag(); | ||
} | ||
} |
Oops, something went wrong.