Author: sevein
Date: Sat Dec 31 13:16:57 2011
New Revision: 10503
Log:
Process Create-Parent header so Qubit knows if an intermediary record must be
created without opening the package, necessary when job scheduling is being
used to get a resource URI immediately
Modified:
trunk/plugins/qtSwordPlugin/lib/qtPackageExtractorBase.class.php
trunk/plugins/qtSwordPlugin/lib/qtPackageExtractorMETSArchivematicaDIP.class.php
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/depositAction.class.php
Modified: trunk/plugins/qtSwordPlugin/lib/qtPackageExtractorBase.class.php
==============================================================================
--- trunk/plugins/qtSwordPlugin/lib/qtPackageExtractorBase.class.php Sat Dec
31 00:03:07 2011 (r10502)
+++ trunk/plugins/qtSwordPlugin/lib/qtPackageExtractorBase.class.php Sat Dec
31 13:16:57 2011 (r10503)
@@ -61,6 +61,8 @@
{
$this->checksumMd5 = $options['checksum_md5'];
}
+
+ $this->createParent = isset($options['create_parent']) &&
$options['create_parent'] === true;
}
public function run()
Modified:
trunk/plugins/qtSwordPlugin/lib/qtPackageExtractorMETSArchivematicaDIP.class.php
==============================================================================
---
trunk/plugins/qtSwordPlugin/lib/qtPackageExtractorMETSArchivematicaDIP.class.php
Sat Dec 31 00:03:07 2011 (r10502)
+++
trunk/plugins/qtSwordPlugin/lib/qtPackageExtractorMETSArchivematicaDIP.class.php
Sat Dec 31 13:16:57 2011 (r10503)
@@ -19,20 +19,8 @@
class qtPackageExtractorMETSArchivematicaDIP extends qtPackageExtractorBase
{
- public function __construct(array $options = array())
+ protected function processDmdSec($xml)
{
- parent::__construct($options);
-
- // ...
- }
-
- protected function processDmdSec($xml, $informationObject = null)
- {
- if (!isset($informationObject))
- {
- $informationObject = new QubitInformationObject;
- }
-
foreach ($xml->xpath('.//mdWrap/xmlData/dublincore/*') as $item)
{
$value = trim($item->__toString());
@@ -145,7 +133,7 @@
if (0 < preg_match('/^METS\..*\.xml$/', $entry))
{
$this->document = new
SimpleXMLElement(@file_get_contents($this->filename.DIRECTORY_SEPARATOR.$entry));
-
+
break;
}
}
@@ -159,7 +147,7 @@
}
// Main object
- if (null != ($dmdSec = $this->getMainDmdSec()))
+ if ($this->createParent && null != ($dmdSec = $this->getMainDmdSec()))
{
$this->resource = $this->processDmdSec($dmdSec, $this->resource);
}
Modified:
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/depositAction.class.php
==============================================================================
---
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/depositAction.class.php
Sat Dec 31 00:03:07 2011 (r10502)
+++
trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/actions/depositAction.class.php
Sat Dec 31 13:16:57 2011 (r10503)
@@ -89,16 +89,25 @@
$this->package['checksum_md5'] =
$request->getHttpHeader('Content-MD5');
}
- // New information object container
- $this->informationObject = new QubitInformationObject;
- $this->informationObject->parentId = $this->resource->id;
-
$this->informationObject->setPublicationStatus(sfConfig::get('app_defaultPubStatus',
QubitTerm::PUBLICATION_STATUS_DRAFT_ID));
- $this->informationObject->save();
+ if ('true' == $request->getHttpHeader('Create-Parent'))
+ {
+ // New information object container
+ $this->informationObject = new QubitInformationObject;
+ $this->informationObject->parentId = $this->resource->id;
+
$this->informationObject->setPublicationStatus(sfConfig::get('app_defaultPubStatus',
QubitTerm::PUBLICATION_STATUS_DRAFT_ID));
+ $this->informationObject->save();
+
+ $this->package['create_parent'] = true;
+ }
+ else
+ {
+ $this->informationObject = $this->resource;
+ }
try
{
// Put the job in the background if the queue support is enabled
- if (sfConfig::get('app_use_job_queue', false))
+ if (sfConfig::get('app_use_job_queue', true))
{
sfGearmanClient::getInstance()->background('depositSwordPackage',
$this->package + array('information_object_id' =>
$this->informationObject->id));
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.