-
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
80 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
53 changes: 53 additions & 0 deletions
53
src/main/java/de/gwdg/metadataqa/marc/definition/tags/bltags/TagPLR.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,53 @@ | ||
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.codelist.LanguageCodes; | ||
import de.gwdg.metadataqa.marc.definition.general.validator.RegexValidator; | ||
|
||
/** | ||
* PRIMO Large Record | ||
*/ | ||
public class TagPLR extends DataFieldDefinition { | ||
|
||
private static TagPLR uniqueInstance; | ||
|
||
private TagPLR() { | ||
initialize(); | ||
postCreation(); | ||
} | ||
|
||
public static TagPLR getInstance() { | ||
if (uniqueInstance == null) | ||
uniqueInstance = new TagPLR(); | ||
return uniqueInstance; | ||
} | ||
|
||
private void initialize() { | ||
|
||
tag = "PLR"; | ||
label = "PRIMO Large Record"; | ||
mqTag = "PRIMOLargeRecord"; | ||
cardinality = Cardinality.Nonrepeatable; | ||
// descriptionUrl = "https://www.loc.gov/marc/bibliographic/bd037.html"; | ||
// setCompilanceLevels("O"); | ||
|
||
ind1 = new Indicator(); | ||
|
||
ind2 = new Indicator(); | ||
|
||
setSubfieldsWithCardinality( | ||
"a", "Code", "NR", | ||
"b", "System number of associated records", "NR" | ||
); | ||
|
||
getSubfield("a") | ||
.setCodes("Y", "Y") | ||
.setMqTag("code"); | ||
|
||
getSubfield("b") | ||
.setValidator(new RegexValidator("^\\d+(,\\d+)*$")) | ||
.setMqTag("systemNumber"); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/test/java/de/gwdg/metadataqa/marc/definition/tags/bltags/TagPLRTest.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,25 @@ | ||
package de.gwdg.metadataqa.marc.definition.tags.bltags; | ||
|
||
import org.junit.Test; | ||
|
||
public class TagPLRTest extends BLTagTest { | ||
|
||
public TagPLRTest() { | ||
super(TagPLR.getInstance()); | ||
} | ||
|
||
@Test | ||
public void testValidFields() { | ||
validField("a", "Y"); | ||
validField("a", "Y", "b", "007188719,013745028,013745031"); | ||
validField("a", "Y", "b", "007188719"); | ||
} | ||
|
||
@Test | ||
public void testInvalidFields() { | ||
invalidField("1", "a", "1"); | ||
invalidField("a", "X"); | ||
invalidField("b", "a"); | ||
invalidField("b", "1,"); | ||
} | ||
} |
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