Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 196029 - support import/export of local tasks
Summary: support import/export of local tasks
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 2000
: P2 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Jevgeni Holodkov CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 196031 204509 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-07-10 13:26 EDT by Jevgeni Holodkov CLA
Modified: 2007-10-02 12:29 EDT (History)
2 users (show)

See Also:


Attachments
Task exporting/importing core (27.29 KB, patch)
2007-08-10 12:42 EDT, Jevgeni Holodkov CLA
no flags Details | Diff
mylyn/context/zip (22.00 KB, application/octet-stream)
2007-08-10 12:42 EDT, Jevgeni Holodkov CLA
no flags Details
Task exporting/importing core + d&d (32.89 KB, patch)
2007-08-15 15:22 EDT, Jevgeni Holodkov CLA
no flags Details | Diff
mylyn/context/zip (33.02 KB, application/octet-stream)
2007-08-15 15:22 EDT, Jevgeni Holodkov CLA
no flags Details
Task exporting/import core tests (7.11 KB, patch)
2007-08-15 15:23 EDT, Jevgeni Holodkov CLA
no flags Details | Diff
Patch with some alterations (77.11 KB, text/plain)
2007-08-29 17:54 EDT, Robert Elves CLA
no flags Details
Task export action for task list view (6.16 KB, patch)
2007-09-08 14:20 EDT, Jevgeni Holodkov CLA
no flags Details | Diff
mylyn/context/zip (36.32 KB, application/octet-stream)
2007-09-08 14:20 EDT, Jevgeni Holodkov CLA
no flags Details
Task import action for task list view (11.17 KB, patch)
2007-09-17 12:05 EDT, Jevgeni Holodkov CLA
no flags Details | Diff
mylyn/context/zip (53.66 KB, application/octet-stream)
2007-09-17 12:05 EDT, Jevgeni Holodkov CLA
no flags Details
mylyn/context/zip (62.32 KB, application/octet-stream)
2007-09-26 13:53 EDT, Mik Kersten CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jevgeni Holodkov CLA 2007-07-10 13:26:25 EDT
It should be possible to export and import a local task using drag&drop, context menu and through file's menu
Comment 1 Jevgeni Holodkov CLA 2007-07-26 12:54:01 EDT
I suggest creating a xml.zip file with two type of xmls inside:
one type describes tasks (mini version of a tasklist.xml)
another type describes the context of a single task that is described in a first type of xml(so there can be many of these xmls).
Comment 2 Jevgeni Holodkov CLA 2007-07-26 12:55:01 EDT
The above described zip file is supposed to be a transfer object in task export/import operations.
Comment 3 Eugene Kuleshov CLA 2007-07-26 13:51:48 EDT
Usually when you drag multiple selected objects they transfered as multiple, so it is confusing to archive them all together when doing drag and drop.
Import/export wizard is probably different story, as long as it would allow to choose which tasks should be imported (as opposed to blindly import them all)
Comment 4 Jevgeni Holodkov CLA 2007-07-27 03:05:17 EDT
(In reply to comment #3)
> Usually when you drag multiple selected objects they transfered as multiple, so
> it is confusing to archive them all together when doing drag and drop.

Yes, you are right. One file per task is better, we'll be able to naturally select only these tasks that we are interested in. I will create a single archive for each task, but I still want to keep these xmls separate (tasklist, context, in case of a repository task - repositories) - it will dramatically decrease a number of changes.
Comment 5 Eugene Kuleshov CLA 2007-07-27 10:15:41 EDT
I think it is ok to have multiple files in the archive. Also, it seems like you are also need repository configuration in there, just in case repository does not exist when task is imported.
Comment 6 Mik Kersten CLA 2007-07-27 10:20:40 EDT
Yes, do it something like this:
- mylyn-data-12345.xml.zip
  - tasklist-fragment.xml (task/query xml)
  - repositories-fragment.xml (repo you needed to externalize)
  - contexts (directory)
     - http%3A...zip (context file)
     
This way you are mirroring the current structure in these transfer/import fragments.
Comment 7 Eugene Kuleshov CLA 2007-07-27 10:29:56 EDT
-1 for any directories in archives
Comment 8 Jevgeni Holodkov CLA 2007-08-10 12:42:09 EDT
Created attachment 75866 [details]
Task exporting/importing core

- InteractionContextExternalizer: extracted writeContext() functionality
- InteractionContextManager: added loadContext() method to load context from external files and added importContext() that adds context to the system and activates it. saveContext()&activateContext() doesn't work, since they change the original context.
- SaxContextReader: fixed reading context from a file where there is more than one ZipEntry. Also have fixed ContextExternalizerTest.
- TaskRepositoriesExternalizer: renamed writeRepositoriesToZipEntry() to writeRepositories(), also fixed QueryExportImportTest
- Added TaskExportImportTest and updated AllTasksTests

TaskListWriter:
- added contextExternalizer
- encapsulated TaskList Document creation and TaskList root in a single method (to reuse in writeTask())
- added writeTask and readTask to read/write task + context.

Currently, task's child tasks are not read, this will be fixed in next patch (if needed? How do I create a child task?). Also, context is not saved under 'contexts' folder, since one file can contain only one context right now.
Comment 9 Jevgeni Holodkov CLA 2007-08-10 12:42:12 EDT
Created attachment 75867 [details]
mylyn/context/zip
Comment 10 Robert Elves CLA 2007-08-10 17:17:01 EDT
Either myself or Mik will have a look at this early next week Jevgeni.  I think we should initially ignore subtasks, Mik?
Comment 11 Jevgeni Holodkov CLA 2007-08-15 15:22:50 EDT
Created attachment 76148 [details]
Task exporting/importing core + d&d

This patch includes all previous changes plus:
Separated reading and adding to the taskList process. These required me to add a categoryHandle property in AbstractTask, which is populated during reading and used during writing. After that, I have removed the dependency on taskList when reading the Task from the file.
This patch also contains D&D support for tasks. If task doesn't exists - it is inserted to the task list. If it does, user confirms that he wants to override this task's context.
Comment 12 Jevgeni Holodkov CLA 2007-08-15 15:22:54 EDT
Created attachment 76149 [details]
mylyn/context/zip
Comment 13 Jevgeni Holodkov CLA 2007-08-15 15:23:46 EDT
Created attachment 76150 [details]
Task exporting/import core tests

Tests that are covering previous patch (export-import-tasks-core_1_1.txt)
Comment 14 Robert Elves CLA 2007-08-16 21:45:10 EDT
Jevgeni, I haven't had a chance to review your latest patches. Depending on how my Friday morning goes I may get a chance but if not it won't be until Monday. Let me know if this is blocking you.  

 Note that I've committed changes to QueryExportImportTest to fix subsequent failing tests in the test suite.  QueryExportImportTest was a) setting synchronization manager to asynchronous and b) replacing the tasklist externalizers with mock externalizer but never resetting them back.
Comment 15 Robert Elves CLA 2007-08-29 17:50:39 EDT
Sorry for the delay Jevgeni, this is good work!  My only concern here is addition of categoryHandle to AbstractTask. My initial thinking on this is that we should make createCategoryElement work similar to createQueryElement in the sense that it contains its members. Then deprecate AbstractTask.getParentContainers() all together moving this to the TaskList. Then as part of import export include any necessary parent Category nodes with the task id contained minus those that aren't being exported.  This is a rough idea and we will obviously have migration and api issues but I want to your feedback on this.

Pointers:
- Before submitting a patch, try to ensure Mylyn AllTests passes. This is tricky as currently there are 4 tests that fail when run as part of the suite but pass when run individually. Ideally we want this test suite to always pass so this won't be such a trick in the near future.  

Changes I made to get all tests passing (except for those pesky 4):
- Updated context externalization tests so that they pass. Once patch is applied these tests were failing since the contained context must have a proper handle.
- TaskListWriter.readTaskList updated to only add task to tasklist if delegating task externalizer returns a non-null value
Comment 16 Robert Elves CLA 2007-08-29 17:54:58 EDT
Created attachment 77313 [details]
Patch with some alterations 

Alterations minus reqd binarys for tests to pass.  Updated to avoid a collision with TaskListDropAdapter.
Comment 17 Jevgeni Holodkov CLA 2007-09-08 14:20:21 EDT
Created attachment 77945 [details]
Task export action for task list view

If one task is selected, then File dialog is used, otherwise user will specify the directory, there to save selected tasks. This patch depends on the previous "Task exporting/importing core" patch. The last one, as I understand, previous is not yet applied so in order to test this, both patches should be used.
Comment 18 Jevgeni Holodkov CLA 2007-09-08 14:20:23 EDT
Created attachment 77946 [details]
mylyn/context/zip
Comment 19 Jevgeni Holodkov CLA 2007-09-08 14:27:16 EDT
Rob, I think category can be included to the exported file. Otherwise, if mylyn sees that there are no such category, when importing the task, then such category can be created (category name is known from the task tag). However, if you were planning to make heavier this concept and introduce new attributes, then I prefer going the first way right now.
Comment 20 Mik Kersten CLA 2007-09-11 12:37:00 EDT
Rob: please review.
Comment 21 Robert Elves CLA 2007-09-11 18:11:24 EDT
Patches applied ip log updated. I think we'll need to export the repositories.xml along with the other data exported as part of task export since the repository task's repository may not exists in the target (much like query import/export). Added deprecated note to get/setCategoryHandle() methods on AbstractTask.
Comment 22 Jevgeni Holodkov CLA 2007-09-17 12:05:30 EDT
Created attachment 78563 [details]
Task import action for task list view

TaskList is refreshed on import. Imported task is not activated.
Comment 23 Jevgeni Holodkov CLA 2007-09-17 12:05:33 EDT
Created attachment 78564 [details]
mylyn/context/zip
Comment 24 Mik Kersten CLA 2007-09-20 15:49:21 EDT
Jevgeni: patch applied, some quick manual testing done, and things are looking good!  I will iterate on the UI for this (e.g. consider making a sub-menu in the Task List and/or a view menu) and then report back.  Could you outline anything else that you think needs to be done on this for next week's 2.1 release?
Comment 25 Jevgeni Holodkov CLA 2007-09-25 12:26:34 EDT
(In reply to comment #24)
> Jevgeni: patch applied, some quick manual testing done, and things are looking
> good!  I will iterate on the UI for this (e.g. consider making a sub-menu in
> the Task List and/or a view menu) and then report back.  Could you outline
> anything else that you think needs to be done on this for next week's 2.1
> release?
> 

Thanks! According to my notes, I have to add an icon to export actions and implement saving a context before exporting it (for active tasks, if the context was changed, then the old one is currently used). The rest of activities are code refactorings. Could I miss something?
Comment 26 Mik Kersten CLA 2007-09-25 18:36:32 EDT
*** Bug 204509 has been marked as a duplicate of this bug. ***
Comment 27 Mik Kersten CLA 2007-09-26 13:53:10 EDT
I've done the following:
* Grouped these 4 actions and the 2 duplicate actions into an Operations menu.  The name is not ideal, but these need to be nested in a submenu since they are infrequently used, the word File is not appropriate, and calling it something like "Task Operations" is not suitable because other creations are not there.  I made enablement toggle, not visibility, so it that the user know what the full set of operations is (matches the our policy for not hiding actions in submenus).
* Added icons for export and did additional clean-up of the actions.

Jevgeni: I removed definitionId (org.eclipse.ui.query.clone) from the query clone action.  Was this used for anything?
Comment 28 Mik Kersten CLA 2007-09-26 13:53:16 EDT
Created attachment 79224 [details]
mylyn/context/zip
Comment 29 Jevgeni Holodkov CLA 2007-09-27 12:02:19 EDT
Mik: no, definitionId was not used, so it is ok to delete it.
Comment 30 Jevgeni Holodkov CLA 2007-10-02 12:29:40 EDT
*** Bug 196031 has been marked as a duplicate of this bug. ***