|
|
@ -254,15 +254,21 @@ public class TasksXmlImporter {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// if the task's name and creation date match an existing task, skip
|
|
|
|
// if the task's name and creation date match an existing task, skip
|
|
|
|
TodorooCursor<Task> cursor = taskService.query(Query.select(Task.ID).
|
|
|
|
long existingTask = 0;
|
|
|
|
|
|
|
|
TodorooCursor<Task> cursor = taskService.query(Query.select(Task.ID, Task.COMPLETION_DATE).
|
|
|
|
where(Criterion.and(Task.TITLE.eq(title),
|
|
|
|
where(Criterion.and(Task.TITLE.eq(title),
|
|
|
|
Task.CREATION_DATE.eq(created),
|
|
|
|
Task.CREATION_DATE.eq(created))));
|
|
|
|
Task.DUE_DATE.eq(dueDate),
|
|
|
|
|
|
|
|
Task.COMPLETION_DATE.eq(completionDate))));
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if(cursor.getCount() > 0) {
|
|
|
|
if(cursor.getCount() > 0) {
|
|
|
|
skipCount++;
|
|
|
|
if(version < UpgradeService.V4_0_6 &&
|
|
|
|
return;
|
|
|
|
!completionDate.equals("0") && //$NON-NLS-1$
|
|
|
|
|
|
|
|
!completionDate.equals(Long.toString(cursor.get(Task.COMPLETION_DATE)))) {
|
|
|
|
|
|
|
|
// fix for failed migration in 4.0.6
|
|
|
|
|
|
|
|
existingTask = cursor.get(Task.ID);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
skipCount++;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
cursor.close();
|
|
|
|
cursor.close();
|
|
|
@ -272,7 +278,11 @@ public class TasksXmlImporter {
|
|
|
|
deserializeModel(currentTask, Task.PROPERTIES);
|
|
|
|
deserializeModel(currentTask, Task.PROPERTIES);
|
|
|
|
if(version < UpgradeService.V4_0_6)
|
|
|
|
if(version < UpgradeService.V4_0_6)
|
|
|
|
adjustDueDateScheme(currentTask);
|
|
|
|
adjustDueDateScheme(currentTask);
|
|
|
|
currentTask.setId(Task.NO_ID);
|
|
|
|
|
|
|
|
|
|
|
|
if(existingTask > 0)
|
|
|
|
|
|
|
|
currentTask.setId(existingTask);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
currentTask.setId(Task.NO_ID);
|
|
|
|
|
|
|
|
|
|
|
|
// Save the task to the database.
|
|
|
|
// Save the task to the database.
|
|
|
|
taskService.save(currentTask);
|
|
|
|
taskService.save(currentTask);
|
|
|
|