Skip to content

Commit

Permalink
Revert isShownAt mapping changes for MWDL
Browse files Browse the repository at this point in the history
  • Loading branch information
moltude committed Dec 19, 2023
1 parent c2dccf6 commit e3ddee0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class MwdlMapping extends XmlMapping with XmlExtractor {

override val enforceDuplicateIds: Boolean = false

private val baseIsShownAt = "https://utah-primoprod.hosted.exlibrisgroup.com/primo-explore/fulldisplay?docid="
private val suffixIsShownAt = "&context=L&vid=MWDL"

val formatBlockList: Set[String] =
DigitalSurrogateBlockList.termList ++
FormatTypeValuesBlockList.termList
Expand Down Expand Up @@ -114,12 +117,12 @@ class MwdlMapping extends XmlMapping with XmlExtractor {
.flatMap(extractStrings)
.map(URI)

override def isShownAt(data: Document[NodeSeq]): ZeroToMany[EdmWebResource] = {
// PrimoNMBib > record > display > identifier.
(data \\ "display" \ "identifier")
override def isShownAt(data: Document[NodeSeq]): ZeroToMany[EdmWebResource] =
// baseIsShownAt + control\recordid
(data \\ "control" \ "recordid")
.flatMap(extractStrings)
.map(baseIsShownAt + _.trim + suffixIsShownAt)
.map(stringOnlyWebResource)
}

override def iiifManifest(data: Document[NodeSeq]): ZeroToMany[URI] =
// links > lln02
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ class MwdlMappingTest extends FlatSpec with BeforeAndAfter {
it should "extract the correct isShownAt" in {
val xml: NodeSeq = <PrimoNMBib xmlns="http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib">
<record>
<display>
<identifier>
http://libarchive.slcc.edu/islandora/object/works%3A598
</identifier>
</display>
<control>
<recordid>
digcoll_slc_27works_598
</recordid>
</control>
</record>
</PrimoNMBib>
val expected = Seq(uriOnlyWebResource(URI("http://libarchive.slcc.edu/islandora/object/works%3A598")))
val expected = Seq(uriOnlyWebResource(URI("https://utah-primoprod.hosted.exlibrisgroup.com/primo-explore/fulldisplay?docid=digcoll_slc_27works_598&context=L&vid=MWDL")))
assert(extractor.isShownAt(Document(xml)) === expected)
}
it should "extract the correct preview" in {
Expand Down

0 comments on commit e3ddee0

Please sign in to comment.