Commit fa3a1d82 authored by Klaus Hamberger's avatar Klaus Hamberger
Browse files

Improved and corrected update reports.

git-svn-id: svn+ssh://svn.code.sf.net/p/tip-puck/code/trunk@2336 fbf60bc9-78ff-467a-80f5-d9f1d8e511fc
parent aafc05cd
......@@ -272,6 +272,7 @@ public class UpdateWorker {
if ((targetIndividual.getFather() == null) && (sourceIndividual.getFather() != null)) {
//
errorReport.outputs().appendln(targetIndividual+"\tadded Father\t->\t"+sourceIndividual.getFather());
NetUtils.setFatherRelation(target, sourceIndividual.getFather().getId(), targetIndividual.getId());
}
......@@ -280,7 +281,7 @@ public class UpdateWorker {
//
if ((sourceIndividual.getMother() == null) || (!sourceIndividual.getMother().equals(targetIndividual.getMother()))) {
// Remove current mother.
errorReport.outputs().appendln(targetIndividual+"\tchanged Father\t"+targetIndividual.getMother()+"\t->\t"+sourceIndividual.getMother());
errorReport.outputs().appendln(targetIndividual+"\tchanged Mother\t"+targetIndividual.getMother()+"\t->\t"+sourceIndividual.getMother());
targetIndividual.getOriginFamily().getChildren().removeById(targetIndividual.getId());
targetIndividual.setOriginFamily(null);
}
......@@ -288,12 +289,16 @@ public class UpdateWorker {
if ((targetIndividual.getMother() == null) && (sourceIndividual.getMother() != null)) {
//
errorReport.outputs().appendln(targetIndividual+"\tadded Mother\t->\t"+sourceIndividual.getMother());
NetUtils.setMotherRelation(target, sourceIndividual.getMother().getId(), targetIndividual.getId());
}
// Overwrite partners.
for (Individual partner : sourceIndividual.getPartners()) {
//
if (!targetIndividual.getPartners().contains(partner)){
errorReport.outputs().appendln(targetIndividual+"\tadded Spouse\t->\t"+partner);
}
NetUtils.setSpouseRelationAndFixRoles(target, targetIndividual.getId(), partner.getId());
}
......@@ -309,6 +314,7 @@ public class UpdateWorker {
//
if (StringUtils.isBlank(targetIndividual.getName())){
targetIndividual.setName(sourceName);
errorReport.outputs().appendln(targetIndividual+"\tchanged Name\t"+targetIndividual.getName()+"\t->\t"+sourceName);
} else if (!targetIndividual.getName().equals(sourceName)){
errorReport.outputs().appendln(targetIndividual+"\tnot changed Name\t"+targetIndividual.getName()+"\t->|\t"+sourceName);
}
......@@ -319,15 +325,17 @@ public class UpdateWorker {
//
if (targetIndividual.getGender().isUnknown()){
targetIndividual.setGender(sourceIndividual.getGender());
errorReport.outputs().appendln(targetIndividual+"\tchanged Gender\t"+targetIndividual.getGender()+"\t->\t"+sourceIndividual.getGender());
} else if (!targetIndividual.getGender().equals(sourceIndividual.getGender())){
errorReport.outputs().appendln(targetIndividual+"\tnot changed Gender\t"+targetIndividual.getGender()+"\t->|\t"+sourceIndividual.getGender());
}
}
// Append birth order.
if (targetIndividual.getBirthOrder() == null) {
if (sourceIndividual.getBirthOrder()!=null && targetIndividual.getBirthOrder() == null) {
//
targetIndividual.setBirthOrder(sourceIndividual.getBirthOrder());
errorReport.outputs().appendln(targetIndividual+"\tchanged Birth Order\t"+targetIndividual.getBirthOrder()+"\t->\t"+sourceIndividual.getBirthOrder());
} else if (sourceIndividual.getBirthOrder() !=null && sourceIndividual.getBirthOrder()!=targetIndividual.getBirthOrder()){
errorReport.outputs().appendln(targetIndividual+"\tnot changed Birth Order\t"+targetIndividual.getBirthOrder()+"\t->|\t"+sourceIndividual.getBirthOrder());
}
......@@ -349,6 +357,7 @@ public class UpdateWorker {
if ((targetIndividual.getFather() == null) && (sourceIndividual.getFather() != null)) {
NetUtils.setFatherRelation(target, sourceIndividual.getFather().getId(), targetIndividual.getId());
errorReport.outputs().appendln(targetIndividual+"\tchanged Father\t"+targetIndividual.getMother()+"\t->\t"+sourceIndividual.getMother());
} else if (targetIndividual.getFather()!=null && sourceIndividual.getFather()!=null){
if (!targetIndividual.getFather().equals(sourceIndividual.getFather()) && (!NumberUtils.isNumber(sourceIndividual.getFather().getFirstName())|| Integer.parseInt(sourceIndividual.getFather().getFirstName())!=targetIndividual.getFather().getId()) && (!NumberUtils.isNumber(targetIndividual.getFather().getFirstName())|| Integer.parseInt(targetIndividual.getFather().getFirstName())!=sourceIndividual.getFather().getId())) {
errorReport.outputs().appendln("Father conflict for "+targetIndividual+":\t"+sourceIndividual.getFather()+" vs "+targetIndividual.getFather());
......@@ -357,6 +366,7 @@ public class UpdateWorker {
}
if ((targetIndividual.getMother() == null) && (sourceIndividual.getMother() != null)) {
NetUtils.setMotherRelation(target, sourceIndividual.getMother().getId(), targetIndividual.getId());
errorReport.outputs().appendln(targetIndividual+"\tchanged Mother\t"+targetIndividual.getMother()+"\t->\t"+sourceIndividual.getMother());
} else if (targetIndividual.getMother()!=null && sourceIndividual.getMother()!=null){
if (!targetIndividual.getMother().equals(sourceIndividual.getMother()) && (!NumberUtils.isNumber(sourceIndividual.getMother().getFirstName())|| Integer.parseInt(sourceIndividual.getMother().getFirstName())!=targetIndividual.getMother().getId())&& (!NumberUtils.isNumber(targetIndividual.getMother().getFirstName())|| Integer.parseInt(targetIndividual.getMother().getFirstName())!=sourceIndividual.getMother().getId())) {
errorReport.outputs().appendln("Mother conflict for "+targetIndividual+":\t"+sourceIndividual.getMother()+" vs "+targetIndividual.getMother());
......@@ -368,6 +378,9 @@ public class UpdateWorker {
// Append partners.
for (Individual partner : sourceIndividual.getPartners()) {
//
if (!targetIndividual.getPartners().contains(partner)){
errorReport.outputs().appendln(targetIndividual+"\tadded Spouse\t->\t"+partner);
}
NetUtils.setSpouseRelationAndFixRoles(target, targetIndividual.getId(), partner.getId());
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment