Skip to content

Connects to external sources and generates a file-system structure that can be loaded by the Alfresco File Import Tool

Notifications You must be signed in to change notification settings

philipmeadows/alfresco-migration-preprocessor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is it

Alfresco Migration Preprocessor is an incredibly long name for such a simple feature! This tool provides a marshaller object that is (currently) able to

  • Unmarshal one or more XML sources and transform them into a FS file/folder structure
  • Invoke the File Import (shipped with Alfresco 4.** versions) pointing to the previously created FS structure
  • Post-process recorded peer associations and create them accordingly, as soon as the import have finished

How does it work

The Migration preprocessor extends XStream - the famous XML (de)serializer library - providing an AlfrescoXStreamMarshaller object which accepts the following inputs:

It also provides an XmlBulkImporter which executes the XML unmarshalling and later invokes the FileImport to populate an Alfresco repository.

You can see how to use it in our JUnit test

Still not convinced? Imagine that you want to import the following 3 entities (1 cm:folder and 2 cm:content) into Alfresco:

<folder>
  <name>foldername</name>
  <title>Folder Title</title>
  <description>the most awesome folder ever</description>
  <isVersionable>true</isVersionable>
  <children>
    <content>
      <name>contentname1</name>
      <title>Content Title 1</title>
      <description>the most awesome content ever 1</description>
      <isVersionable>true</isVersionable>
      <contentUrl>http://www.scala-lang.org/docu/files/ScalaByExample.pdf</contentUrl>
    </content>
    <content>
      <name>contentname2</name>
      <title>Content Title 2</title>
      <description>the most awesome content ever 2</description>
      <isVersionable>true</isVersionable>
      <contentUrl>http://www.tug.org/pracjourn/2005-4/mertz/mertz.pdf</contentUrl>
      <referenceNames>
        <string>contentname1</string>
      </referenceNames>
    </content>
  </children>
</folder>

Now you can do it without writing one single line of code.
You have a different input XML? Define Java Beans with fields and annotations that map your XML structure and you're ready to go!

Run

To run the test

mvn clean test -Ppurge
  • Files are created in alf_data_dev/xml
  • XML files being imported are located in src/test/resources

Contribute

About

Connects to external sources and generates a file-system structure that can be loaded by the Alfresco File Import Tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages