Author: mcantelon
Date: Tue Jan 3 11:25:06 2012
New Revision: 10533
Log:
Added support for name access points to csv import.
Modified:
trunk/lib/task/csvImportTask.class.php
Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php Tue Jan 3 11:22:57 2012
(r10532)
+++ trunk/lib/task/csvImportTask.class.php Tue Jan 3 11:25:06 2012
(r10533)
@@ -185,7 +185,7 @@
// add subject access points
$accessPointColumns = array(
'subjectAccessPoints' => QubitTaxonomy::SUBJECT_ID,
- 'placeAccessPoints' => QubitTaxonomy::PLACE_ID
+ 'placeAccessPoints' => QubitTaxonomy::PLACE_ID,
);
foreach($accessPointColumns as $columnName => $taxonomyId)
@@ -199,6 +199,17 @@
}
}
+ // add name access points
+ foreach($self->rowStatusVars['nameAccessPoints'] as $name) {
+ $actor = $self->createOrFetchActor($name);
+ $relation = new QubitRelation;
+ $relation->subjectId = $self->informationObject->id;
+ $relation->objectId = $actor->id;
+ $relation->typeId = QubitTerm::NAME_ACCESS_POINT_ID;
+ $relation->save();
+# "relation" table (relation.subject_id = information_object.id,
relation.object_id = actor.id).
+ }
+
// add accessions
if (
isset($self->rowStatusVars['accessionNumbers'])
@@ -313,6 +324,14 @@
}
});
+ $import->addColumnHandler('nameAccessPoints', function(&$self, $data)
+ {
+ if ($data)
+ {
+ $self->rowStatusVars['nameAccessPoints'] = explode('|', $data);
+ }
+ });
+
$import->csv($fh);
}
}
--
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.