Author: sevein
Date: Thu Jan  5 13:40:58 2012
New Revision: 10575

Log:
Add toString magic method to QubitProperty

Added:
   trunk/init/qubit-sword.sh
Modified:
   trunk/init/qubit-sword.conf
   trunk/lib/model/QubitProperty.php
   
trunk/plugins/qtSwordPlugin/lib/qtPackageExtractorMETSArchivematicaDIP.class.php
   trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/indexSuccess.php
   trunk/qubit_dev.php

Modified: trunk/init/qubit-sword.conf
==============================================================================
--- trunk/init/qubit-sword.conf Thu Jan  5 12:57:15 2012        (r10574)
+++ trunk/init/qubit-sword.conf Thu Jan  5 13:40:58 2012        (r10575)
@@ -26,13 +26,14 @@
 script
 
   USER="www-data"
+  LOCATION="/var/www/ica-atom"
   LOGFILE="/tmp/qubit-sword.log"
 
   # Running sudo twice permits the output redirection, fix this
   sudo sudo -u ${USER} php \
       -d memory_limit=-1 \
       -d error_reporting="E_ALL" \
-          /var/www/ica-atom/symfony \
+          ${LOCATION}/symfony \
               gearman:worker \
                   --config=sword \
                   --application=qubit \

Added: trunk/init/qubit-sword.sh
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/init/qubit-sword.sh   Thu Jan  5 13:40:58 2012        (r10575)
@@ -0,0 +1,30 @@
+# This file is part of Archivematica.
+#
+# Copyright 2010-2011 Artefactual Systems Inc. <http://artefactual.com>
+#
+# Archivematica is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# Archivematica is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Archivematica. If not, see <http://www.gnu.org/licenses/>.
+
+USER="www-data"
+LOCATION="/var/www/ica-atom"
+
+sudo -u ${USER} php \
+     -d memory_limit=-1 \
+     -d error_reporting="E_ALL" \
+         ${LOCATION}/symfony \
+             gearman:worker \
+                 --config=sword \
+                 --application=qubit \
+                 --connection=propel \
+                 --timeout=-1 \
+                 --count=0

Modified: trunk/lib/model/QubitProperty.php
==============================================================================
--- trunk/lib/model/QubitProperty.php   Thu Jan  5 12:57:15 2012        (r10574)
+++ trunk/lib/model/QubitProperty.php   Thu Jan  5 13:40:58 2012        (r10575)
@@ -31,6 +31,17 @@
 {
   public $indexOnSave = true;
 
+  public function __toString()
+  {
+    $string = $this->value;
+    if (!isset($string))
+    {
+      $string = $this->getValue(array('sourceCulture' => true));
+    }
+
+    return (string) $string;
+  }
+
   public function save($connection = null)
   {
     // TODO: $cleanObject = $this->object->clean;

Modified: 
trunk/plugins/qtSwordPlugin/lib/qtPackageExtractorMETSArchivematicaDIP.class.php
==============================================================================
--- 
trunk/plugins/qtSwordPlugin/lib/qtPackageExtractorMETSArchivematicaDIP.class.php
    Thu Jan  5 12:57:15 2012        (r10574)
+++ 
trunk/plugins/qtSwordPlugin/lib/qtPackageExtractorMETSArchivematicaDIP.class.php
    Thu Jan  5 13:40:58 2012        (r10575)
@@ -140,12 +140,18 @@
 
       closedir($handle);
     }
+    else
+    {
+      throw new sfException('METS XML file was not found.');
+    }
 
     if (!isset($this->document))
     {
-      throw new sfException('METS.xml file was not found.');
+      throw new sfException('METS document could not be opened.');
     }
 
+    $aipUUID = $this->getUUID($this->filename);
+
     // Main object
     if ($this->createParent && null != ($dmdSec = $this->getMainDmdSec()))
     {
@@ -158,20 +164,26 @@
     {
       $parts = pathinfo($item);
       $filename = $parts['basename'];
-      $uuid = $this->getUUID($filename);
+      $objectUUID = $this->getUUID($filename);
 
+      // Create child
       $child = new QubitInformationObject;
       $child->setPublicationStatus($publicationStatus);
 
-      if (null !== ($dmdSec = $this->searchFileDmdSec($uuid)))
+      // Process metatadata from METS file
+      if (null !== ($dmdSec = $this->searchFileDmdSec($objectUUID)))
       {
         $child = $this->processDmdSec($dmdSec, $child);
       }
 
+      // Storage UUID
+      $child->addProperty('objectUUID', $objectUUID);
+      $child->addProperty('aipUUID', $aipUUID);
+
+      // Add digital object
       $digitalObject = new QubitDigitalObject;
       $digitalObject->assets[] = new QubitAsset($item);
       $digitalObject->usageId = QubitTerm::MASTER_ID;
-
       $child->digitalObjects[] = $digitalObject;
 
       $this->resource->informationObjectsRelatedByparentId[] = $child;

Modified: 
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/indexSuccess.php
==============================================================================
--- trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/indexSuccess.php  
Thu Jan  5 12:57:15 2012        (r10574)
+++ trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/indexSuccess.php  
Thu Jan  5 13:40:58 2012        (r10575)
@@ -2,6 +2,8 @@
 
 <h1><?php echo __('View archival description') ?></h1>
 
+<?php echo $resource->getPropertyByName('aipUUID') ?>
+
 <h1 class="label">
   <?php echo link_to_if(QubitAcl::check($resource, 'update'), 
render_title($isad), array($resource, 'module' => 'informationobject', 'action' 
=> 'edit'), array('title' => __('Edit archival description'))) ?>
 

Modified: trunk/qubit_dev.php
==============================================================================
--- trunk/qubit_dev.php Thu Jan  5 12:57:15 2012        (r10574)
+++ trunk/qubit_dev.php Thu Jan  5 13:40:58 2012        (r10575)
@@ -4,7 +4,6 @@
 // feel free to remove this, extend it or make something more sophisticated.
 if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1')))
 {
-  die('You are not allowed to access this file. Check '.basename(__FILE__).' 
for more information.');
 }
 
 require_once(dirname(__FILE__).'/config/ProjectConfiguration.class.php');

-- 
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.

Reply via email to