function handleElement($node)
{
$deployment = $this->getDeployment();
$context = $deployment->getContext();
$user = $deployment->getUser();
// Create and insert the submission (ID needed for other entities)
$submissionDao = Application::getSubmissionDAO();
$submission = $submissionDao->newDataObject();
$submission->setContextId($context->getId());
$submission->setStatus(STATUS_QUEUED);
$submissionLocale = $node->getAttribute('locale');
if (empty($submissionLocale)) {
$submissionLocale = $context->getPrimaryLocale();
}
$submission->setLocale($submissionLocale);
$submission->setSubmissionProgress(0);
$workflowStageDao = DAORegistry::getDAO('WorkflowStageDAO');
$submission->setStageId(WorkflowStageDAO::getIdFromPath($node->getAttribute('stage')));
$submissionDao->insertObject($submission);
$deployment->setSubmission($submission);
// Handle any additional attributes etc.
$submission = $this->populateObject($submission, $node);
for ($n = $node->firstChild; $n !== null; $n = $n->nextSibling) {
if (is_a($n, 'DOMElement')) {
$this->handleChildElement($n, $submission);
}
}
$submissionDao->updateObject($submission);
// Persist setters
return $submission;
}