diff --git a/library/Opus/Model2/Identifier.php b/library/Opus/Model2/Identifier.php new file mode 100644 index 00000000..c2035405 --- /dev/null +++ b/library/Opus/Model2/Identifier.php @@ -0,0 +1,270 @@ + 'old', + 'Serial' => 'serial', + 'Uuid' => 'uuid', + 'Isbn' => 'isbn', + 'Urn' => 'urn', + 'Doi' => 'doi', + 'Handle' => 'handle', + 'Url' => 'url', + 'Issn' => 'issn', + 'StdDoi' => 'std-doi', + 'CrisLink' => 'cris-link', + 'SplashUrl' => 'splash-url', + 'Opus3' => 'opus3-id', + 'Opac' => 'opac-id', + 'Arxiv' => 'arxiv', + 'Pubmed' => 'pmid', + ]; + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + */ + public function setId($id) + { + $this->id = $id; + } + + /** + * @return int + */ + public function getDocument() + { + return $this->document; + } + + /** + * @param int $document + */ + public function setDocument($document) + { + $this->document = $document; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * @param string $value + */ + public function setValue($value) + { + $this->value = $value; + } + + /** + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * @param string $type + */ + public function setType($type) + { + $this->type = $type; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param string $status + */ + public function setStatus($status) + { + $this->status = $status; + } + + /** + * @return string + */ + public function getRegistrationTs() + { + return $this->registrationTs; + } + + /** + * @param string $registrationTs + */ + public function setRegistrationTs($registrationTs) + { + $this->registrationTs = $registrationTs; + } + + /** + * Returns the relevant properties of the class + * + * @return array + */ + protected static function describe() + { + return [ + 'Value', + 'Type', + 'Status', + 'RegistrationTs', + ]; + } + + /** + * @param string $fieldname + * @return string + */ + public static function getTypeForFieldname($fieldname) + { + return self::$identifierMapping[substr($fieldname, 10)]; + } + + /** + * @param string $type + * @return string + */ + public static function getFieldnameForType($type) + { + return 'Identifier' . array_search($type, self::$identifierMapping); + } + + /** + * @return string + */ + public function getModelType() + { + return 'identifier'; + } +} diff --git a/tests/Opus/IdentifierTest.php b/tests/Opus/IdentifierTest.php index 1039a691..1a807d51 100644 --- a/tests/Opus/IdentifierTest.php +++ b/tests/Opus/IdentifierTest.php @@ -43,10 +43,10 @@ use Opus\Document; use Opus\DocumentFinder; use Opus\Doi\Generator\DefaultGenerator; -use Opus\Identifier; use Opus\Identifier\DoiAlreadyExistsException; use Opus\Identifier\UrnAlreadyExistsException; use Opus\Model\ModelException; +use Opus\Model2\Identifier; use OpusTest\TestAsset\TestCase; use Zend_Config; use Zend_Exception; @@ -197,6 +197,8 @@ public function testCreateUrnCollisionUsingAddIdentifierUrn() public function testIsValidDoiPositive() { + $this->markTestSkipped('TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model'); + $doi = new Identifier(); $doi->setType('doi'); $doi->setValue('12.3456/opustest-789'); @@ -205,6 +207,8 @@ public function testIsValidDoiPositive() public function testIsValidDoiNegative() { + $this->markTestSkipped('TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model'); + $doiValuesToProbe = [ '10.000/äöüß-987', '10.000/opus~987', @@ -221,6 +225,11 @@ public function testIsValidDoiNegative() public function testIsLocalDoiPositiveWithGeneratorClass() { + $this->markTestSkipped( + 'TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model.' + . ' Document model still uses the old opus identifier model' + ); + // adapt configuration to allow detection local DOIs $doiConfig = [ 'generatorClass' => DefaultGenerator::class, @@ -235,6 +244,11 @@ public function testIsLocalDoiPositiveWithGeneratorClass() public function testIsLocalDoiPositiveWithGeneratorClassAndMissingPrefixShlash() { + $this->markTestSkipped( + 'TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model.' + . ' Document model still uses the old opus identifier model' + ); + // adapt configuration to allow detection local DOIs $doiConfig = [ 'generatorClass' => DefaultGenerator::class, @@ -249,6 +263,11 @@ public function testIsLocalDoiPositiveWithGeneratorClassAndMissingPrefixShlash() public function testIsLocalDoiPositiveWithoutGeneratorClass() { + $this->markTestSkipped( + 'TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model.' + . ' Document model still uses the old opus identifier model' + ); + // adapt configuration to allow detection local DOIs $doiConfig = [ 'generatorClass' => '', @@ -263,6 +282,11 @@ public function testIsLocalDoiPositiveWithoutGeneratorClass() public function testIsLocalDoiPositiveWithoutGeneratorClassAndMissingPrefixSlash() { + $this->markTestSkipped( + 'TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model.' + . ' Document model still uses the old opus identifier model' + ); + // adapt configuration to allow detection local DOIs $doiConfig = [ 'generatorClass' => '', @@ -277,6 +301,11 @@ public function testIsLocalDoiPositiveWithoutGeneratorClassAndMissingPrefixSlash public function testIsLocalDoiNegativeWithGeneratorClass() { + $this->markTestSkipped( + 'TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model.' + . ' Document model still uses the old opus identifier model' + ); + // adapt configuration to allow detection local DOIs $doiConfig = [ 'generatorClass' => DefaultGenerator::class, @@ -291,6 +320,11 @@ public function testIsLocalDoiNegativeWithGeneratorClass() public function testIsLocalDoiNegativeWithGeneratorClassAlt() { + $this->markTestSkipped( + 'TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model.' + . ' Document model still uses the old opus identifier model' + ); + // adapt configuration to allow detection local DOIs $doiConfig = [ 'generatorClass' => DefaultGenerator::class, @@ -305,6 +339,11 @@ public function testIsLocalDoiNegativeWithGeneratorClassAlt() public function testIsLocalDoiNegativeWithMissingGeneratorClass() { + $this->markTestSkipped( + 'TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model.' + . ' Document model still uses the old opus identifier model' + ); + // adapt configuration to allow detection local DOIs $doiConfig = [ 'generatorClass' => 'Opus\Doi\Generator\MissingGenerator', @@ -319,6 +358,11 @@ public function testIsLocalDoiNegativeWithMissingGeneratorClass() public function testIsLocalDoiNegativeWithoutGeneratorClass() { + $this->markTestSkipped( + 'TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model.' + . ' Document model still uses the old opus identifier model' + ); + // adapt configuration to allow detection local DOIs $doiConfig = [ 'generatorClass' => '', @@ -333,6 +377,11 @@ public function testIsLocalDoiNegativeWithoutGeneratorClass() public function testIsLocalDoiNegativeWithoutPrefixAndWithoutGeneratorClass() { + $this->markTestSkipped( + 'TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model.' + . ' Document model still uses the old opus identifier model' + ); + // adapt configuration to allow detection local DOIs $doiConfig = [ 'generatorClass' => '', @@ -347,6 +396,11 @@ public function testIsLocalDoiNegativeWithoutPrefixAndWithoutGeneratorClass() public function testIsLocalDoiNegativeWithoutPrefixAndWithGeneratorClass() { + $this->markTestSkipped( + 'TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model.' + . ' Document model still uses the old opus identifier model' + ); + // adapt configuration to allow detection local DOIs $doiConfig = [ 'generatorClass' => DefaultGenerator::class, @@ -361,6 +415,11 @@ public function testIsLocalDoiNegativeWithoutPrefixAndWithGeneratorClass() public function testIsDoiUniquePositive() { + $this->markTestSkipped( + 'TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model.' + . ' Document model still uses the old opus identifier model' + ); + $doiConfig = [ 'generatorClass' => DefaultGenerator::class, 'prefix' => '12.3456/', @@ -386,6 +445,11 @@ public function testIsDoiUniquePositive() public function testIsDoiUniqueNegative() { + $this->markTestSkipped( + 'TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model.' + . ' Document model still uses the old opus identifier model' + ); + $doiConfig = [ 'generatorClass' => DefaultGenerator::class, 'prefix' => '12.3456/', @@ -422,6 +486,11 @@ public function testIsDoiUniqueNegative() public function testIsUrnUniquePositive() { + $this->markTestSkipped( + 'TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model.' + . ' Document model still uses the old opus identifier model' + ); + $doc1 = $this->createDocumentWithIdentifierUrn('urn:987654321'); $doc1Id = $doc1->store(); @@ -442,6 +511,11 @@ public function testIsUrnUniquePositive() public function testIsUrnUniqueNegative() { + $this->markTestSkipped( + 'TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model.' + . ' Document model still uses the old opus identifier model' + ); + $doc1 = $this->createDocumentWithIdentifierUrn('urn:987654321'); $doc1Id = $doc1->store(); @@ -519,6 +593,11 @@ private function adaptDoiConfiguration($doiConfig) public function testCheckDoiCollisionFalse() { + $this->markTestSkipped( + 'TODO DOCTRINE Issue #187 - DOI and URN functions have been removed from the model.' + . ' Document model still uses the old opus identifier model' + ); + $doiConfig = [ 'generatorClass' => DefaultGenerator::class, 'prefix' => '12.3456/',