Skip to content

Commit

Permalink
issue #75: add tag PLR
Browse files Browse the repository at this point in the history
  • Loading branch information
pkiraly committed Dec 18, 2020
1 parent 160d944 commit 1e88710
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
690, 692, 852$a (code list), 859, 909, 916, 917, 945, 950, 954, 955, 957, 959, 960,
961, 962, 963, 964, 966, 968, 970, 975, 976, 979, 980, 985, 990, 992, 996, 997,
A02, AQN, BGT, BUF, CFI, CNF, DGM, DRT, EST, EXP, FFP, FIN, LAS, LCS, LDO, LEO, LET,
MIS, MNI, MPX, NEG, NID, OBJ, OHC, ONS, ONX
MIS, MNI, MPX, NEG, NID, OBJ, OHC, ONS, ONX, PLR

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");
}
}
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,");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void testListTag() {
List<Class<? extends DataFieldDefinition>> tags = MarcTagLister.listTags();
assertNotNull(tags);
assertNotEquals(0, tags.size());
assertEquals(391, tags.size());
assertEquals(392, tags.size());
assertEquals("Tag010", tags.get(0).getSimpleName());
Map<String, Integer> versionCounter = new HashMap<>();
Map<MarcVersion, Integer> versionCounter2 = new HashMap<>();
Expand Down

0 comments on commit 1e88710

Please sign in to comment.