Skip to content

Commit

Permalink
Make record deletion in generated data opt-in instead of mandatory.
Browse files Browse the repository at this point in the history
  • Loading branch information
jannistsiroyannis committed May 25, 2018
1 parent 60cd1a1 commit dcbae04
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Exportprofilen reglerar vissa delar av hur export-filerna ska se ut, t ex ifall

### Andra inställningar

Ni behöver också skapa filen etc/config_xl.properties. I dom alra flesta fall räcker det att kopiera etc/config_xl.properties.in till etc/config_xl.properties, eftersom standardinställningarna bör vara korrekta. Vill man däremot hämta uppdateringar från någon av Libris testmiljöer behöver man ändra innehållet i den här filen.
Ni behöver också skapa filen etc/config_xl.properties. I dom alra flesta fall räcker det att kopiera etc/config_xl.properties.in till etc/config_xl.properties, eftersom standardinställningarna bör vara korrekta. Vill man däremot hämta uppdateringar från någon av Libris testmiljöer behöver man ändra innehållet i den här filen. Detsamma gäller om man vill aktivera post-borttagning, dvs att poster som raderats ur libris också ska finnas med i utdata (med deleted-flagga satt). För att göra detta ändras inställningen ´IncludeDeletions=false´ till ´IncludeDeletions=true´. Detta medför även att bibliografiska poster för vilka man inte (längre) har bestånd kommer att dyka upp som deleted i utdata.

### Steg för steg

Expand Down
1 change: 1 addition & 0 deletions etc/config_xl.properties.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ OaiPmhBaseUrl="https://libris.kb.se/api/oaipmh/"
URIBase="https://libris.kb.se/"
User=""
Password=""
IncludeDeletions=false
6 changes: 4 additions & 2 deletions src/main/groovy/GetRecords_xl.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def get(url) {

def getRecord(id) {
id = java.net.URLEncoder.encode(id, "UTF-8")
def url = "${config.OaiPmhBaseUrl}?verb=GetRecord&metadataPrefix=marcxml_includehold_expanded&identifier=${id}&x-withDeletedData=true"
def url = "${config.OaiPmhBaseUrl}?verb=GetRecord&metadataPrefix=marcxml_includehold_expanded&identifier=${id}"
if (config.IncludeDeletions == true)
url = "${config.OaiPmhBaseUrl}?verb=GetRecord&metadataPrefix=marcxml_includehold_expanded&identifier=${id}&x-withDeletedData=true"
return xml = new XmlSlurper(false, false).parseText(get(url)).GetRecord.record
}

Expand Down Expand Up @@ -84,7 +86,7 @@ def getMerged(bib_id) {
}
}

if (holdings.isEmpty())
if (config.IncludeDeletions == true && holdings.isEmpty())
bib.setLeader(5, 'd' as char)

return profile.mergeRecord(bib, holdings, auths)
Expand Down

0 comments on commit dcbae04

Please sign in to comment.