How do I create/modify multiple nodes in the JCR with a single sling servlet post form?
What I'm trying to do is migrate assets into a CQ instance from a WordPress website using an automation suite, Kapow Katalyst, that handles all the grunt work of filling out individual sling post action forms for each content item. Originally I was lead to believe that simply posting the file to the monitored node specified in workflows (/content/dam(.*/)renditions/original) would be enough to make CQ handle the rest of the work of populating the metadata. The form below is used by Kapow for each individual asset and has FILE_NAME replaced with the name of the resource stored in a MySQL database, then the automation browser submits the form, receives a status 200, and continues on to the next asset in the database.
<html> <body> <form method="POST" action="http://localhost:4502/content/dam/MigrationProject/FILE_NAME/jcr:content/renditions" enctype="multipart/form-data"> <input type="file" name="original" /> <input type="hidden" name="original" value="nt:file" /> <input type="submit" /> </form> </body> </html>
The problem I'm having, however, is that the DAM is just seeing all of these newly created nodes as jcr:primaryType of sling:OrderedFolder and the workflows that try to run on these newly created nodes can be seen aborting in the console. When I recreated the same node structure as a sample DAM asset, using CRXDE, and then copied the uploaded node original to its proper place on my properly structured dam:Asset, CQ recognized it and immediately populated metadata. The structure I'm trying to create looks like this:
- somefile.jpg jcr:primaryType = dam:Asset
- jcr:content jcr:primaryType = dam:AssetContent
- renditions jcr:primaryType = nt:folder
- original jcr:primaryType = nt:file
- jcr:content jcr:primaryType = nt:resource
- original jcr:primaryType = nt:file
- renditions jcr:primaryType = nt:folder
- jcr:content jcr:primaryType = dam:AssetContent
Is it possible to do this inside of a single sling post form?