templates.oai_dc.vm Maven / Gradle / Ivy
#macro(showElementDC $tag $field $attr $label)
#set($valueMap = $util.getList($item, $field))
#foreach($key in $valueMap.keySet())
#set($value = $valueMap.get($key))
#if ($label != "")
#set($value = $value.get($label))
<$tag$attr>$util.encodeXml($value)$tag>
#else
#set($value = $value.get($key))
<$tag$attr>$util.encodeXml($value)$tag>
#end
#end
#end
#macro(showSingleElement $json $tag $field $attr)
#set($value = $util.get($json, $field))
#if ($value != "")
<$tag$attr>$util.encodeXml($value)$tag>
#end
#end
#macro(showSingleMapElement $map $tag $field $attr)
#set($value = $map.get($field))
#if ($value != "")
<$tag$attr>$util.encodeXml($value)$tag>
#end
#end
#showSingleElement($item, "dc:title" "dc:title", "")
#showSingleElement($item, "dc:description" "dc:description", "")
#showSingleElement($item, "dc:type" "dc:type", "")
#showSingleElement($item, "dc:created" "dc:created", "")
#showSingleElement($item, "dc:modified" "dc:modified", "")
#showSingleElement($item, "dc:language" "dc:language", "")
#showElementDC("dc:subject" "dc:subject.keywords", "", "")
#showElementDC("dc:subject" "dc:subject.anzsrc:for", "", "skos:prefLabel")
#showElementDC("dc:subject" "dc:subject.anzsrc:seo", "", "skos:prefLabel")
#set($creatorList = $util.getList($item, "dc:creator.foaf:Person"))
#foreach($key in $creatorList.keySet())
#set($creator = $creatorList.get($key))
#set($givenName = $creator.get("foaf:givenName").trim())
#set($familyName = $creator.get("foaf:familyName").trim())
$util.encodeXml("${givenName} ${familyName}")
#showSingleMapElement($creator, "dc:relation", "dc:identifier", "")
#showSingleMapElement($creator, "dc:relation", "association", "")
#showSingleMapElement($creator, "dc:relation", "association.skos:prefLabel", "")
#end