Author: sevein
Date: Fri Jan  6 11:07:35 2012
New Revision: 10583

Log:
Update archivematica:dip-import to get dipUUID from the DIP directory name

Modified:
   trunk/lib/task/archivematicaDipImportTask.class.php

Modified: trunk/lib/task/archivematicaDipImportTask.class.php
==============================================================================
--- trunk/lib/task/archivematicaDipImportTask.class.php Fri Jan  6 00:03:31 
2012        (r10582)
+++ trunk/lib/task/archivematicaDipImportTask.class.php Fri Jan  6 11:07:35 
2012        (r10583)
@@ -83,12 +83,22 @@
 
     $this->logSection("Link digital objects from {$arguments['filename']}...");
 
-    // If DIP folder is specified then digital objects will be in the
-    // "objects" subfolder
+    // If DIP directory is specified then digital objects will be in the
+    // "objects" subfolder. Capture dipUUID from the DIP directory name.
     if (file_exists(rtrim($arguments['path'], '/').'/objects'))
     {
+      $dipUUID = $this->getUUID(basename($arguments['path']));
       $arguments['path'] = rtrim($arguments['path'], '/').'/objects';
     }
+    else
+    {
+      $dipUUID = $this->getUUID(basename($arguments['path']));
+    }
+
+    if (null === $dipUUID)
+    {
+      throw new sfException('The DIP UUID could not be found');
+    }
 
     // Create a lookup table to match original file name (foo.TIF) with DIP
     // filename (979c4458-21f3-11e1-a4bd-001d09282b9d-foo.jpg)
@@ -147,9 +157,11 @@
       {
         self::addDigitalObject($informationObject, $item, $conn);
 
+        $informationObject->addProperty('dipUUID', $dipUUID);
         if (null !== $objectUUID = $this->getUUID(basename($item)))
         {
           $informationObject->addProperty('objectUUID', $objectUUID);
+
         }
       }
       else
@@ -163,6 +175,7 @@
           $informationObject->parent = QubitInformationObject::getById($key);
           $informationObject->title = basename($item[$i]);
 
+          $informationObject->addProperty('dipUUID', $dipUUID);
           if (null !== $objectUUID = $this->getUUID(basename($item)))
           {
             $informationObject->addProperty('objectUUID', $objectUUID);
@@ -175,7 +188,7 @@
       }
     }
 
-    $this->logSection('Successfully Loaded '.self::$count.' digital objects.');
+    $this->logSection('Successfully loaded '.self::$count.' digital objects.');
   }
 
   protected function addDigitalObject($informationObject, $filepath, $conn)

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