$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();
$referee->setFirstName('Gyro' . randString($counter++));
$referee->setLastName('Gearloose' . randString($counter++));
$referee->setAcademicTitle('Prof. Dr.' . randString($counter++));
$advisor->setFirstName('Fred');
$advisor->setLastName('Clever');
$advisor->store();
$doc->addPersonAdvisor($advisor);
$translator = new Opus_Person();
$translator->setFirstName('Erika');
$translator->setLastName('Fuchs');
$translator->store();
$doc->addPersonTranslator($translator);
$contributor = new Opus_Person();
$contributor->setFirstName('Jeff');
$contributor->setLastName('Smart');
$contributor->store();
$doc->addPersonContributor($contributor);
$doc->setCreatingCorporation('Walt Disney Creation Laboratories');
$doc->setContributingCorporation('Pixar Animation Studio');
$swd = $doc->addSubject()->setType('swd');
$swd->setValue('Test');
$freeSubjectDeu = $doc->addSubject()->setType('uncontrolled');
$freeSubjectDeu->setLanguage('deu')->setValue('Maustest');
$freeSubjectEng = $doc->addSubject()->setType('uncontrolled');
$freeSubjectEng->setLanguage('eng')->setValue('mouse test');
$note = $doc->addNote();
$note->setVisibility('public')->setMessage('ein Dokument, dass noch eine Bemerkung braucht, weil im Abstract nicht alles gesagt wurde...');
$noteTwo = $doc->addNote();
$noteTwo->setVisibility('private')->setMessage('und noch eine Bemerkung zum Bearbeitungsstand.');
$licences = Opus_Licence::getAll();
if (count($licences) >= 1) {
    $lic = $licences[0];
} else {
    $lic = new Opus_Licence();