/**
  * Handle a submission element
  * @param $node DOMElement
  * @return array Array of ArticleGalley objects
  */
 function handleElement($node)
 {
     $deployment = $this->getDeployment();
     $context = $deployment->getContext();
     $submission = $deployment->getSubmission();
     assert(is_a($submission, 'Submission'));
     $representation = parent::handleElement($node);
     if ($node->getAttribute('available') == 'true') {
         $representation->setIsAvailable(true);
     }
     $galleyType = $node->getAttribute('galley_type');
     $representation->setGalleyType($galleyType);
     for ($n = $node->firstChild; $n !== null; $n = $n->nextSibling) {
         if (is_a($n, 'DOMElement')) {
             switch ($n->tagName) {
                 case 'remote_url':
                     $representation->setRemoteURL($n->textContent);
                     break;
                 case 'name':
                     // Labels are not localized in OJS ArticleGalleys, but we use the <name locale="....">...</name> structure.
                     $representation->setLabel($n->textContent);
                     $representation->setLocale($n->getAttribute('locale'));
                     break;
             }
         }
     }
     $representationDao = Application::getRepresentationDAO();
     $representationDao->insertObject($representation);
     // representation proof files
     return $representation;
 }
 /**
  * Handle a submission element
  * @param $node DOMElement
  * @return array Array of PublicationFormat objects
  */
 function handleElement($node)
 {
     $deployment = $this->getDeployment();
     $context = $deployment->getContext();
     $submission = $deployment->getSubmission();
     assert(is_a($submission, 'Submission'));
     $representation = parent::handleElement($node);
     if ($node->getAttribute('approved') == 'true') {
         $representation->setIsApproved(true);
     }
     if ($node->getAttribute('physical_format') == 'true') {
         $representation->setPhysicalFormat(true);
     }
     $representationDao = Application::getRepresentationDAO();
     $representationDao->insertObject($representation);
     // Handle metadata in subelements.  Do this after the insertObject() call because it
     // creates other DataObjects which depend on a representation id.
     for ($n = $node->firstChild; $n !== null; $n = $n->nextSibling) {
         if (is_a($n, 'DOMElement')) {
             switch ($n->tagName) {
                 case 'Product':
                     $this->_processProductNode($n, $this->getDeployment(), $representation);
                     break;
                 default:
             }
         }
     }
     // Update the object.
     $representationDao->updateObject($representation);
     return $representation;
 }
 /**
  * Handle a submission element
  * @param $node DOMElement
  * @return array Array of ArticleGalley objects
  */
 function handleElement($node)
 {
     $deployment = $this->getDeployment();
     $context = $deployment->getContext();
     $submission = $deployment->getSubmission();
     assert(is_a($submission, 'Submission'));
     $representation = parent::handleElement($node);
     $representationDao = Application::getRepresentationDAO();
     $representationDao->insertObject($representation);
     // Update the object.
     $representationDao->updateObject($representation);
     return $representation;
 }
 /**
  * Handle a submission element
  * @param $node DOMElement
  * @return array Array of ArticleGalley objects
  */
 function handleElement($node)
 {
     $deployment = $this->getDeployment();
     $context = $deployment->getContext();
     $submission = $deployment->getSubmission();
     assert(is_a($submission, 'Submission'));
     $submissionFileRefNodes = $node->getElementsByTagName('submission_file_ref');
     assert($submissionFileRefNodes->length <= 1);
     $addSubmissionFile = false;
     if ($submissionFileRefNodes->length == 1) {
         $fileNode = $submissionFileRefNodes->item(0);
         $fileId = $fileNode->getAttribute('id');
         $revisionId = $fileNode->getAttribute('revision');
         $dbFileId = $deployment->getFileDBId($fileId, $revisionId);
         if ($dbFileId) {
             $addSubmissionFile = true;
         }
     }
     $representation = parent::handleElement($node);
     for ($n = $node->firstChild; $n !== null; $n = $n->nextSibling) {
         if (is_a($n, 'DOMElement')) {
             switch ($n->tagName) {
                 case 'name':
                     // Labels are not localized in OJS ArticleGalleys, but we use the <name locale="....">...</name> structure.
                     $locale = $n->getAttribute('locale');
                     if (empty($locale)) {
                         $locale = $submission->getLocale();
                     }
                     $representation->setLabel($n->textContent);
                     $representation->setLocale($locale);
                     break;
             }
         }
     }
     $representationDao = Application::getRepresentationDAO();
     if ($addSubmissionFile) {
         $representation->setFileId($dbFileId);
     }
     $representationDao->insertObject($representation);
     if ($addSubmissionFile) {
         // Update the submission file.
         $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
         $submissionFile = $submissionFileDao->getRevision($dbFileId, $revisionId);
         $submissionFile->setAssocType(ASSOC_TYPE_REPRESENTATION);
         $submissionFile->setAssocId($representation->getId());
         $submissionFileDao->updateObject($submissionFile);
     }
     // representation proof files
     return $representation;
 }