Author: mcantelon
Date: Thu Feb 16 11:02:53 2012
New Revision: 10916

Log:
Added overridable utility logic for processing data before it enters Qubit.

Modified:
   trunk/lib/QubitFlatfileImport.class.php

Modified: trunk/lib/QubitFlatfileImport.class.php
==============================================================================
--- trunk/lib/QubitFlatfileImport.class.php     Thu Feb 16 10:46:00 2012        
(r10915)
+++ trunk/lib/QubitFlatfileImport.class.php     Thu Feb 16 11:02:53 2012        
(r10916)
@@ -117,6 +117,12 @@
    * Utility function to filter data, with a function that can be optionally
    * overridden, before it enters Qubit
    *
+   * This function will be automatically applied to data handled by the
+   * standardColumns, columnMap, propertyMap, and noteMap handlers
+   *
+   * This function will not be applied to data handled by variableColumns
+   * or arrayColumns or other handlers allowing the user to do ad-hoc things
+   *
    * @param string $text  Text to process
    */
   public function content($text)
@@ -520,7 +526,7 @@
       {
         $self->object->addProperty(
           $self->propertyMap[$columnName], 
-          $value
+          $this->content($value)
         );
       }
       else if (
@@ -540,7 +546,7 @@
       )
       {
         // otherwise, if column is data and it's a standard column, use it
-        $self->object->{$self->columnNames[$index]} = $value;
+        $self->object->{$self->columnNames[$index]} = $this->content($value);
       }
     });
   }
@@ -563,7 +569,11 @@
         $transformationLogic = 
(isset($self->noteMap[$columnName]['transformationLogic']))
           ? $self->noteMap[$columnName]['transformationLogic']
           : false;
-        $self->createNote($self->noteMap[$columnName]['typeId'], $value, 
$transformationLogic);
+        $self->createNote(
+          $self->noteMap[$columnName]['typeId'],
+          $this->content($value),
+          $transformationLogic
+        );
       }
     });
   }
@@ -679,12 +689,14 @@
         if (is_callable($mapDefinition['transformationLogic']))
         {
           $this->object->{$mapDefinition['column']}
-            = $mapDefinition['transformationLogic']($this, $value);
+            = $this->content(
+                $mapDefinition['transformationLogic']($this, $value)
+              );
         } else {
-          $this->object->{$mapDefinition['column']} = $value;
+          $this->object->{$mapDefinition['column']} = $this->content($value);
         }
       } else {
-        $this->object->{$mapDefinition} = $value;
+        $this->object->{$mapDefinition} = $this->content($value);
       }
     }
   }

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