private function processRow($row) { $doc = new Opus_Document(); $oldId = $row[self::OLD_ID]; try { $doc->setLanguage(trim($row[self::LANGUAGE])); // Dokumenttyp muss kleingeschrieben werden (bei Fromm aber groß) $doc->setType(lcfirst(trim($row[self::TYPE]))); $doc->setServerState(trim($row[self::SERVER_STATE])); $doc->setVolume(trim($row[self::VOL_ID])); // speichere die oldId als Identifier old ab, so dass später nach dieser gesucht werden kann // und die Verbindung zwischen Ausgangsdatensatz und importiertem Datensatz erhalten bleibt $this->addIdentifier($doc, 'old', $oldId); $this->processTitlesAndAbstract($row, $doc, $oldId); $this->processDate($row, $doc, $oldId); $this->processIdentifier($row, $doc, $oldId); $this->processNote($row, $doc, $oldId); $this->processCollections($row, $doc); $this->processLicence($row, $doc, $oldId); $this->processSeries($row, $doc); $this->processEnrichmentKindofpublication($row, $doc, $oldId); // TODO Fromm verwendet aktuell sieben Enrichments (muss noch generalisiert werden) $enrichementkeys = array(self::ENRICHMENT_AVAILABILITY, self::ENRICHMENT_FORMAT, self::ENRICHMENT_KINDOFPUBLICATION, self::ENRICHMENT_IDNO, self::ENRICHMENT_COPYRIGHTPRINT, self::ENRICHMENT_COPYRIGHTEBOOK, self::ENRICHMENT_RELEVANCE); foreach ($enrichementkeys as $enrichmentkey) { $this->processEnrichment($enrichmentkey, $row, $doc); } $file = $this->processFile($row, $doc, $oldId); $doc->store(); if (!is_null($file) && $file instanceof Opus_File && !is_null($this->_guestRole)) { $this->_guestRole->appendAccessFile($file->getId()); $this->_guestRole->store(); } } catch (Exception $e) { echo "import of document " . $oldId . " was not successful: " . $e->getMessage() . "\n"; } try { $this->processPersons($row, $doc, $oldId); $doc->store(); return true; } catch (Exception $e) { echo "import of person(s) for document " . $oldId . " was not successful: " . $e->getMessage() . "\n"; } return false; }
$doc = new Opus_Document(); $doc->setType(randString($counter++)); $doc->setServerState('published'); $doc->setServerDatePublished('01.01.1900'); $doc->setLanguage('deu' . randString($counter++)); $doc->setThesisDateAccepted('01.02.2003'); $doc->setPublishedYear('2010'); $doc->setPublishedDate('28.09.2010'); $doc->setCompletedYear('2010'); $doc->setCompletedDate('27.09.2010'); $doc->setPublisherName(randString($counter++)); $doc->setPublisherPlace(randString($counter++)); $doc->setPageNumber(randString($counter++)); $doc->setPageFirst(randString($counter++)); $doc->setPageLast(randString($counter++)); $doc->setVolume(randString($counter++)); $doc->setIssue(randString($counter++)); $doc->setCreatingCorporation(randString($counter++)); $doc->setContributingCorporation(randString($counter++)); // // Persons // $submitter = new Opus_Person(); $submitter->getField('Email')->setValidator(null); $submitter->setFirstName(randString($counter++))->setLastName(randString($counter++))->setEmail(randString($counter++))->setAcademicTitle(randString($counter++))->setDateOfBirth(randString($counter++))->setPlaceOfBirth(randString($counter++)); $doc->addPersonSubmitter($submitter); $author = new Opus_Person(); $author->getField('Email')->setValidator(null); $author->setFirstName(randString($counter++))->setLastName(randString($counter++))->setEmail(randString($counter++))->setAcademicTitle(randString($counter++))->setDateOfBirth(randString($counter++))->setPlaceOfBirth(randString($counter++)); $doc->addPersonAuthor($author); $referee = new Opus_Person();
$abstract = $doc->addTitleAbstract(); $abstract->setValue('Dokument, dass alle Daten enhält, um testen zu können, wie die OAI-Schnittstelle sie ausgibt.'); $abstract->setLanguage('deu'); $titleSub = $doc->addTitleSub(); $titleSub->setValue('Beispielhaft erleutert an OPUS 4.0.0'); $titleSub->setLanguage('deu'); $titleAdditional = $doc->addTitleAdditional(); $titleAdditional->setValue('OAI-Schnittstellen empirisch testen am Beispiel von OPUS 4.0'); $titleAdditional->setLanguage('deu'); $titleParent = $doc->addTitleParent(); $titleParent->setValue('Tester interface d\'OAI en OPUS 4.0'); $titleParent->setLanguage('fra'); $doc->setPageNumber('123'); $doc->setPageFirst('122'); $doc->setPageLast('124'); $doc->setVolume('4'); $doc->setIssue('18'); $instituteName = 'Institut für empirische Forschung'; $institutesRole = Opus_CollectionRole::fetchByName('institutes'); if (is_null($institutesRole) === true) { $institutesRole = new Opus_CollectionRole(); $institutesRole->setName('institutes')->setOaiName('institutes')->setPosition(1)->setVisible(1)->setVisibleBrowsingStart(1)->setDisplayBrowsing('Name')->setVisibleFrontdoor(1)->setDisplayFrontdoor('Name')->setVisibleOai('Name')->setDisplayOai('Name')->store(); } $instituteCollections = Opus_Collection::fetchCollectionsByRoleName($institutesRole->getId(), $instituteName); if (count($instituteCollections) >= 1) { $instituteCollection = $instituteCollections[0]; } else { $rootCollection = $institutesRole->getRootCollection(); if (is_null($rootCollection) === true) { $rootCollection = $institutesRole->addRootCollection(); $rootCollection->setVisible(1)->store();