-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/main/java/de/gwdg/metadataqa/marc/definition/tags/bltags/Tag859.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package de.gwdg.metadataqa.marc.definition.tags.bltags; | ||
|
||
import de.gwdg.metadataqa.marc.definition.Cardinality; | ||
import de.gwdg.metadataqa.marc.definition.DataFieldDefinition; | ||
import de.gwdg.metadataqa.marc.definition.Indicator; | ||
import de.gwdg.metadataqa.marc.definition.general.validator.RegexValidator; | ||
|
||
/** | ||
* National Bibliography Issue Number | ||
*/ | ||
public class Tag859 extends DataFieldDefinition { | ||
|
||
private static Tag859 uniqueInstance; | ||
|
||
private Tag859() { | ||
initialize(); | ||
postCreation(); | ||
} | ||
|
||
public static Tag859 getInstance() { | ||
if (uniqueInstance == null) | ||
uniqueInstance = new Tag859(); | ||
return uniqueInstance; | ||
} | ||
|
||
private void initialize() { | ||
|
||
tag = "859"; | ||
label = "Digital Resource Flag"; | ||
mqTag = "digitalResourceFlag"; | ||
cardinality = Cardinality.Repeatable; | ||
obsolete = true; | ||
// descriptionUrl = "https://www.loc.gov/marc/bibliographic/bd037.html"; | ||
// setCompilanceLevels("O"); | ||
|
||
ind1 = new Indicator(); | ||
|
||
ind2 = new Indicator(); | ||
|
||
setSubfieldsWithCardinality( | ||
"a", "Digital resource flag", "NR", | ||
"b", "Category of digital resource", "R" | ||
); | ||
|
||
getSubfield("a") | ||
.setCodes( | ||
"ELD", "Online: Reading Room Only (e-Legal Deposit only)", | ||
"ORR", "Online: Reading Room Only (subscribed/licensed content specified to be only viewable in the reading rooms)", | ||
"XLD", "Online (non-Legal Deposit content which is freely available)" | ||
) | ||
.setMqTag("flag"); | ||
|
||
getSubfield("b") | ||
.setValidator(new RegexValidator("^.*[^\\.]$")) | ||
.setMqTag("category"); | ||
|
||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/test/java/de/gwdg/metadataqa/marc/definition/tags/bltags/Tag859Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package de.gwdg.metadataqa.marc.definition.tags.bltags; | ||
|
||
import de.gwdg.metadataqa.marc.DataField; | ||
import org.junit.Test; | ||
|
||
public class Tag859Test extends BLTagTest { | ||
|
||
public Tag859Test() { | ||
super(Tag859.getInstance()); | ||
} | ||
|
||
@Test | ||
public void testValidFields() { | ||
validField(new DataField(tag, " ", " ", "a", "ELD", "b", "ebook")); | ||
validField(new DataField(tag, " ", " ", "a", "ORR", "b", "Alexander Street Press")); | ||
validField(new DataField(tag, " ", " ", "a", "XLD", "b", "EUBookshop")); | ||
validField(new DataField(tag, " ", " ", "a", "XLD", | ||
"b", "GOOGLEBOOKS", | ||
"b", "France in the Americas Project")); | ||
} | ||
|
||
@Test | ||
public void testInvalidFields() { | ||
invalidField("c", "x(88-89)"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters