diff --git a/catalogue-binding-plugin/src/test/java/geoportal_to_catalogue/d4gna_to_catalogue_template.ftl b/catalogue-binding-plugin/src/test/java/geoportal_to_catalogue/d4gna_to_catalogue_template.ftl index d84b96c..46e63cd 100644 --- a/catalogue-binding-plugin/src/test/java/geoportal_to_catalogue/d4gna_to_catalogue_template.ftl +++ b/catalogue-binding-plugin/src/test/java/geoportal_to_catalogue/d4gna_to_catalogue_template.ftl @@ -151,8 +151,21 @@ Starting document mapping to Catalogue -<#-- Mapping first "Immagine Rappresentativa" as resource --> -<#if theDocument.immaginiRappresentative?? && theDocument.immaginiRappresentative[0]?? && theDocument.immaginiRappresentative[0].fileset?? && theDocument.immaginiRappresentative[0].fileset._payloads??> +<#-- Mapping "Immagine Rappresentative" as resource --> +<#if theDocument.immaginiRappresentative??> +<#if theDocument.immaginiRappresentative?is_sequence && theDocument.immaginiRappresentative?size gt 0> + <#list theDocument.immaginiRappresentative as the_image> + <#if the_image.fileset?? && the_image.fileset._payloads??> + <#assign payloads = the_image.fileset._payloads> + <#if payloads?size!=0> + <#-- Getting the first payload --> + <#assign payload = payloads[0]> + <@assignResource name=payload._name url=payload._link description=the_image.didascalia format=payload._mimetype> + + + + + <#assign payloads = theDocument.immaginiRappresentative[0].fileset._payloads> <#if payloads?size!=0> <#-- Getting the first payload --> @@ -252,12 +265,12 @@ Starting document mapping to Catalogue <#-- spatial field --> <#if jsonProj._identificationReferences?? && jsonProj._identificationReferences?size!=0 && jsonProj._identificationReferences[0].geoJSON??> <#assign geoJSON = jsonProj._identificationReferences[0].geoJSON> +<#-- if coordinates exists, managing it as a Point --> <#if geoJSON.coordinates?? && geoJSON.coordinates?is_sequence && geoJSON.coordinates?size gt 2> -<#assign point_Coordinates = [geoJSON.coordinates[0], geoJSON.coordinates[1]]> -<#assign spatialField = '{\\"type\\": \\"${geoJSON.type}\\", \\"coordinates\\": [${point_Coordinates?join(", ")}]}'> -<@assignExtraField key="spatial" value=spatialField asObject=false> + <#assign point_Coordinates = [geoJSON.coordinates[0], geoJSON.coordinates[1]]> + <#assign spatialField = '{\\"type\\": \\"${geoJSON.type}\\", \\"coordinates\\": [${point_Coordinates?join(", ")}]}'> + <@assignExtraField key="spatial" value=spatialField asObject=false> -