need to call updateEntityReferences from all site copy / import operations

Description

There are many ways to copy content in Sakai: In site info, duplicate site, import content from site, using a site as template when creating a new one, and archive / restore.

When a tool (I'm thinking specifically of Lessons) refers to instances of another tool, those references need to be updated to refer to the copies in the new site. Duplicate site calls each tool twice. The first time it copies itself. The second time is updateEntityReferences. This causes the tool to update any references to other tools. It is called as part of a second pass, after all tools have copied themselves.

Unfortunately updateEntityReferences is only called by the duplicate site code. None of the other import or restore mechanisms use it. Furthermore, it passes a map of old to new references, which only a few tools build.

Currently Lessons depends upon updateEntityReferences to update references. I use an approach that makes use of the map where there are entries, but uses another approach where there are not. But still, this only works for Duplciate Site. It was quite clear at the Conference that users want it to work for all the cases.

I'd like to see updateEntityReferences called for all types of content copy / import.

Some content copying only copies some of the content. It's certainly possible that someone could import just Lessons content from another site, and not any of the other tools. Obviously there are some problems we can't solve. If there's a reference to something that doesn't exist, we can't update it. But I'd like updateEntityReferences to be called with the best information it has. Let the tool fix up what it can.

Activity

Show:

Narasi Narasi June 17, 2013 at 2:19 PM

During the Apereo 13 conf it was suggested that one can build something like a first module using LB and then attempt the import from the old site that has content in LB. However that did not bring the content we just get an error " please select a tool to import" despite all relevant tools being selected.
Any suggestions here would help.
Thanks

Bryan Holladay October 25, 2012 at 10:59 AM

How would it handle the Resources tool? Looking at the code in updateEntityReferences, it looks like it wouldn't find a LB reference and default the variable "e" to "forumEntity". Then forumEntity (e) would be used to look up the Resource entity when e.findObject() is called, and I'd assume it wouldn't find it.

Charles Hedrick October 25, 2012 at 10:51 AM

No, LB uses entity references where they exist. It first checks for an entry in the map. If that fails, it does a lookup by title. If that fails, it leaves a special marker that will cause the UI to show a note that an entity is undefined. My concern is that titles are not guaranteed to be unique, particularly if data from more than one site are merged. I believe it would be cleaner to generate a map in all cases.

Bryan Holladay October 25, 2012 at 10:46 AM

So it sounds like LB is self contained when it comes to updating it's entity references. What is the underlining issue here? LB only adds references to the map that it needs to update, then after all the tools migrate, LB uses updateEntityReferences to pass in the LB references to itself then look up the new Ids and saves it, completely ignoring any other reference passed in. In this case, I only see this as a LB issue and not an issue with the API hooks.

Charles Hedrick October 25, 2012 at 10:24 AM
Edited

you're right about the catch. If it actually triggers, the following lookup will fail and nothing will happen. However for that catch to happen, we'd need something in the map with a syntax error. Since I'm the only one that puts /lessonbuilder items in the map, it's not at all clear how that would happen The only reason the try-catch is there is because the compiler demanded it. But if a fixup actually had an unreadable item number, there would be no way to do the fixup, so I claim that the code would do the right thing. Probably the lookup should be inside the try, so we don't try it in a case (-1) where it can't possibly work. But I claim that the case we're talking about is provably impossible unless another tool is creating fake /lessonbulder entries.

Details

Priority

Affects versions

Components

Assignee

Reporter

Created June 18, 2012 at 8:08 AM
Updated October 20, 2015 at 10:06 AM

Flag notifications