String filename = hier.pget(defectLogKey).getDefectLog();
if (!StringUtils.hasValue(filename)) {
AbortImport.showError("Hierarchy_Changed", selectedPath);
return;
}
DefectLog defectLog = new DefectLog(
dashboard.getDirectory() + filename, defectLogPath,
dashboardContext.getData());
int addedCount = 0;
int updatedCount = 0;
int unchangedCount = 0;
for (Iterator i = defects.iterator(); i.hasNext();) {
Defect newDefect = (Defect) i.next();
Defect oldDefect = defectLog.getDefect(newDefect.number);
if (oldDefect == null) {
addedCount++;
defectLog.writeDefect(newDefect);
} else {
Defect originalDefect = (Defect) oldDefect.clone();
oldDefect.defect_type = merge(oldDefect.defect_type, newDefect.defect_type);
oldDefect.phase_injected = merge(oldDefect.phase_injected, newDefect.phase_injected);
oldDefect.phase_removed = merge(oldDefect.phase_removed, newDefect.phase_removed);
oldDefect.description = merge(oldDefect.description, newDefect.description);
oldDefect.fix_time = merge(oldDefect.fix_time, newDefect.fix_time);
oldDefect.fix_defect = merge(oldDefect.fix_defect, newDefect.fix_defect);
if (originalDefect.equals(oldDefect)) {
unchangedCount++;
} else {
updatedCount++;
defectLog.writeDefect(oldDefect);
}
}
}
if (addedCount == 0 && updatedCount == 0) {