map.put(wp.getName(), wp);
}
for (GanttTask t : tasks) {
//ProgressUtils.displayProgress(String.format("Importing task %s into project %s", t.getName(), p.getName()), pi.current++);
WorkPackage wp = map.get(t.getName());
if (wp != null) { // WorkPackage gefunden
wp.setStart(t.getStart());
wp.setEnd(t.getEnd());
wp.setMilestone(t.isMilestone());
wp.setCompleted(t.isCompleted());
info.updatedObjects++;
} else { // WorkPackage nicht gefunden - neu erstellen
WorkPackageData wpd = new WorkPackageData();
wpd.completed = t.isCompleted();
wpd.milestone = t.isMilestone();
wpd.name = t.getName();
wpd.start = t.getStart();
wpd.end = t.getEnd();
wpd.project = p.getId();
wpd.manager = p.getManagerId();
if (t.getParent() != null) {
wpd.parent = matchList.get(t.getParent()).getId();
}
wp = ((ClientDBControl) p.getDBControl()).synchroneousCreateWorkPackage(wpd);
info.newObjects++;
}
if (wp != null) {
// Übereinstimmung wurde gefunden, Abbildung hinzufügen
matchList.put(t, wp);
info.importedTasks++;
// Die Kinder rekursiv updaten / hinzufügen
//if (!wp.isNew())
Logic.lockReading();
List<WorkPackage> subs;
try {
subs = wp.getSubWorkPackages();
} finally {
Logic.unlockReading();
}
importTasks(p, subs, t.getChildren(), matchList, info, pi);
}