Hi Petr, To generate a UUID, use the UUID class from the java class library: http://docs.oracle.com/javase/1.5.0/docs/api/java/util/UUID.html
In our case, we generated the UUIDs in PHP, since that is the language used in our old CMS where we ran the exports. In PHP, we just generated strings conforming to the UUID pattern. While in theory it is possible that you generate a UUID that already exists in magnolia, it is extremely unlikely (unlikely, in this case, means you are far more likely to win the lottery, and could probably generate billions of UUIDs without ever creating a collision). So my advice would be not to worry about it. Also, if you generate the UUIDs using the correct algorithm (as implemented by the Java Class), the UUID contains a timestamp and a host-specific portion. That makes it quite impossible to generate the same UUIDs twice. Also, if you import the data using your own code, you can specify the behavior when a duplicate UUID is found. By setting this to throw an exception you would theoretically detect duplicate UUIDs (but it won't happen). See the class: javax.jcr.ImportUUIDBehavior. For us, it was a big help to generate the UUIDs in a "stable" way - basically we used a pre-defined, randomly generated UUID, and replaced some of the digits with the Database ID of the content being exported from the old CMS. In this way, if we ran the export another time, the same UUIDs get generated for the same content. That means, if we were not happy with the imported content we could change the exporter, re-run the export, and import it again (using ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING), replacing the previously imported version. Regards from Vienna, Richard -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]] Im Auftrag von Petr Kadlec (via Magnolia Forums) Gesendet: Mittwoch, 07. November 2012 21:41 An: Magnolia User List Betreff: [magnolia-user] Re: Data migration/import to Magnolia - internal links Hi Richard, thanks for the answer, so you generate the UUID of the nodes without magnolia? How do you do it? And what if the uuids already exist in magnolia, then links would get broken.. I actually planned to do this similarly, but only solution that came to my mind is: create portal xml (without nodes UUIDs) from old source -> import xml to magnolia ->magnolia generates UUIDs -> export portal to xml -> my script takes xml and converts all the internal path links to UUID links -> import xml back to magnolia But it seems a bit too complicated, I'd like to find cleaner solution, if there is one. -- Context is everything: http://forum.magnolia-cms.com/forum/thread.html?threadId=9497cbad-fc8b-4c17-aaf2-ac9671d96331 ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <[email protected]> ---------------------------------------------------------------- ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <[email protected]> ----------------------------------------------------------------
