Extension:GWToolset/Technical Implementation/Handlers/MetadataMappingHandler


 * 1) Validates the  ’ed edit token
 * 2) if invalid, a user error message is displayed.
 * 3) if valid, calls

The expected outcome of ’ing the metadata mapping form is that the extension will receive several items from the form:
 * 1) A   that identifies the root element in the metadatafile, which contains the mediafile’s metadata.
 * 2) A   that will be used when mapping the metadata found in the metadatafile.
 * 3) A   to a wiki title previously saved as a metadata mapping ( optional ).
 * 4) A   that indicates the number of mediafiles that will be added to the job queue each time a batch upload job is run ( optional, default is 10 ).
 * 5) A , which is a relative URL reference to the backend metadata file uploaded in step 1: metadata detection.
 * 6) A   based on step 1: metadata detection.
 * 7) Metadata mapping field/values
 * 8) Global categories ( optional )
 * 9) Item specific categories ( optional )
 * 10) A partner template ( optional )
 * 11) A summary ( optional )
 * 12) Whether or not to re-upload the mediafile ( optional )

Step 2: Metadata Mapping
This handler is used between step 2: metadata mapping, and step 3: batch preview, in the upload process. The following describes what happens within the  method:


 * 1) In this scenario $user_options['preview'] === true
 * 2)   retrieves the metadatafile based on the relative   provided in step 1; this is the metadata file provided by the user.
 * 3) * if an exception is thrown a user message is displayed.
 * 4)   is sent:
 * 5) * the ’ed form variables as
 * 6) * the FS path to the uploaded stash file
 * 7)   is sent:
 * 8) * the ’ed form variables as
 * 9) * the FS path to the uploaded metadatafile
 * 10) * a callback method in the XmlMappingHandler
 * 11)    starts a read process that will:
 * 12) * use the callback method provided to process the metadata records found during the read process.
 * 13) * continue to the end of the metadata file or stop reading if  is set to true.
 * , the callback passed to  will:
 * 1) * Determine if XmlHandler->readXmlAsFile is on the record it should start processing
 * 2) * Set  if the   has been reached
 * 3) * Use  to handle a metadata record if the   has not been reached
 * 4)   will:
 * 5) * Use  to save the mediafile to the wiki and return the Title to XmlMappingHandler, which will return it to XmlHandler, which will add it to an array of successfully created mediafile Titles.
 * 6) When   sends   to , it returns its array of Titles back to.
 * 7)   then uses   to set up the HTML form and returns it to   to be displayed.

Step 3: Batch preview
This handler is used between step 3: Batch preview, and step 4: Batch upload, in the upload process. The following describes what happens within the  method:


 * 1) In this scenario   is empty.
 * 2) * Creates a new
 * 3) * Uses  to place it in the JobQueue.
 * 4) ** If the job is successfully added to the job queue a user message is created and sent to  to be displayed as step 4: Batch upload.
 * 5) ** If the job is not successfully created an error message is displayed.
 * 1) ** If the job is not successfully created an error message is displayed.