String mainTableName = object.getMainTableName();
String childTableName = object.getChildTableName();
Iterator newCellIter = newRow.getNewCells().iterator();
Iterator oldCellIter = newRow.getOldCells().iterator();
try {
Cell newCell = (Cell)newCellIter.next();
Cell oldCell = (Cell)oldCellIter.next();
if (newCell.getTableName().equals(childTableName)) {
newCell.setColumnValue(null);
oldCell.setColumnValue(null);
}
} catch (Exception e) {
e.printStackTrace();
}
Iterator pkColumnIter = object.getPkColumns().iterator();
while (pkColumnIter.hasNext()) {
Column pkColumn = (Column)pkColumnIter.next();
if (pkColumn.getTableName().equals(mainTableName)) {
Cell childPkOldCell = ObjectUtil.findOldCell(newRow, childTableName, pkColumn.getColumnName());
//found
if (childPkOldCell != null) {
Cell childPkNewCell = ObjectUtil.findNewCell(newRow, childTableName, pkColumn.getColumnName());
Cell mainPkNewCell = ObjectUtil.findNewCell(newRow, mainTableName, pkColumn.getColumnName());
childPkOldCell.setColumnValue(mainPkNewCell.getColumnValue());
childPkNewCell.setColumnValue(mainPkNewCell.getColumnValue());
}
}
}
return newRow;
}