WITH related_objects AS (
SELECT hierarchy.id as object_id,
relation.objectcsid,
- relation.subjectcsid as repatriation_csid
+ relation.subjectcsid as inventory_csid
FROM relations_common relation
INNER JOIN hierarchy on hierarchy.name = relation.objectcsid
WHERE relation.objectdocumenttype = 'CollectionObject'
$P!{whereclause_cte}
),
related_exits AS (
- SELECT DISTINCT ON (objs.repatriation_csid, hierarchy.id) objs.objectcsid,
- objs.repatriation_csid,
+ SELECT DISTINCT ON (objs.inventory_csid, hierarchy.id) objs.objectcsid,
+ objs.inventory_csid,
hierarchy.id as exit_id,
relation.subjectcsid as exit_csid
FROM related_objects objs
-- Related Object - Object count
-- Use regex matching because the refnames can contain subsets of the others
-- a word boundary (\y) allows us to match start/ends of refnames easily
- SELECT objs.repatriation_csid,
+ SELECT objs.inventory_csid,
sum(
CASE
WHEN ocg.objectcounttype ~ 'minimum' THEN ocg.objectcount
INNER JOIN related_objects objs ON objs.object_id = ocg_hierarchy.parentid
INNER JOIN objectcountgroup ocg ON ocg.id = ocg_hierarchy.id
WHERE ocg_hierarchy.name = 'collectionobjects_common:objectCountGroupList'
- GROUP BY objs.repatriation_csid
- ) object_count ON object_count.repatriation_csid = inv_hierarchy.name
+ GROUP BY objs.inventory_csid
+ ) object_count ON object_count.inventory_csid = inv_hierarchy.name
LEFT JOIN (
-- Related Object - Field Collection Sites
- SELECT objs.repatriation_csid,
+ SELECT objs.inventory_csid,
array_agg(fcs.item) AS sites
FROM collectionobjects_common_fieldcollectionsites fcs
INNER JOIN related_objects objs ON objs.object_id = fcs.id
- GROUP BY objs.repatriation_csid
- ) field_collection_sites ON field_collection_sites.repatriation_csid = inv_hierarchy.name
+ GROUP BY objs.inventory_csid
+ ) field_collection_sites ON field_collection_sites.inventory_csid = inv_hierarchy.name
LEFT JOIN (
-- Related Consultations (Inventory -> Consultation)
-- Number of Consultation Log Entries
-- Related Object Exits (Object -> ObjectExit (New))
-- Current owner with exit date
-- Allows NULL values to aggregate so we don't lose track of pairs
- SELECT related_exits.repatriation_csid,
+ SELECT related_exits.inventory_csid,
array_agg(exit.exitdate) as exit_dates,
array_agg(owners.item) AS exit_owners
FROM exits_common exit
INNER JOIN related_exits on related_exits.exit_id = exit.id
LEFT JOIN exits_common_owners owners on owners.id = exit.id AND owners.pos = 0
- GROUP BY related_exits.repatriation_csid
- ) exits ON exits.repatriation_csid = inv_hierarchy.name
+ GROUP BY related_exits.inventory_csid
+ ) exits ON exits.inventory_csid = inv_hierarchy.name
$P!{whereclause}]]>
</queryString>
<field name="inventorynumber" class="java.lang.String">
<band splitType="Stretch" />
</background>
<columnHeader>
- <band height="44" splitType="Stretch">
+ <band height="60" splitType="Stretch">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout" />
<property name="com.jaspersoft.studio.unit.height" value="px" />
<staticText>
- <reportElement style="Column header" x="0" y="0" width="100" height="44" uuid="581e80a8-aa61-4dda-b9f5-7f2155efb0c9">
+ <reportElement style="Column header" x="0" y="0" width="100" height="60" uuid="581e80a8-aa61-4dda-b9f5-7f2155efb0c9">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Organization(s)]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="100" y="0" width="100" height="44" uuid="6b5ebc64-5ae1-45c2-a327-0aeff2b2dbf5">
+ <reportElement style="Column header" x="100" y="0" width="100" height="60" uuid="6b5ebc64-5ae1-45c2-a327-0aeff2b2dbf5">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[NAGPRA Inventory Origination Date]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="200" y="0" width="100" height="44" uuid="24339136-4f9e-47d7-93f2-c16421e86c3d">
+ <reportElement style="Column header" x="200" y="0" width="100" height="60" uuid="24339136-4f9e-47d7-93f2-c16421e86c3d">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
- <text><![CDATA[Inventory/Documentation Number]]></text>
+ <text><![CDATA[Inventory / Documentation Number]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="300" y="0" width="100" height="44" uuid="8413cd45-695a-4b51-8cab-df5cf012e78e">
+ <reportElement style="Column header" x="300" y="0" width="100" height="60" uuid="8413cd45-695a-4b51-8cab-df5cf012e78e">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Inventory Title]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="400" y="0" width="100" height="44" uuid="b279c2bd-3ba8-42e1-ab37-e39960f788d0">
+ <reportElement style="Column header" x="400" y="0" width="100" height="60" uuid="b279c2bd-3ba8-42e1-ab37-e39960f788d0">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[NAGPRA Inventory - Inventory Status]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="500" y="0" width="100" height="44" uuid="fe192ec5-2760-4e5f-80bf-6babeb8e2516">
+ <reportElement style="Column header" x="500" y="0" width="100" height="60" uuid="fe192ec5-2760-4e5f-80bf-6babeb8e2516">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[MNI Count]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="600" y="0" width="100" height="44" uuid="2fb0a6b9-bb96-44a8-9575-cb34cee53de2">
+ <reportElement style="Column header" x="600" y="0" width="100" height="60" uuid="2fb0a6b9-bb96-44a8-9575-cb34cee53de2">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
- <text><![CDATA[AFO Lot Count]]></text>
+ <text><![CDATA[AFO Count]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="700" y="0" width="100" height="44" uuid="c3bc7e35-43d8-4446-acba-f7ef559a54b2">
+ <reportElement style="Column header" x="700" y="0" width="100" height="60" uuid="c3bc7e35-43d8-4446-acba-f7ef559a54b2">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Archaeological Sites Related to NAGPRA Inventory]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="800" y="0" width="100" height="44" uuid="1ccb6b44-add8-4be3-8b1e-6babd829939c">
+ <reportElement style="Column header" x="800" y="0" width="100" height="60" uuid="1ccb6b44-add8-4be3-8b1e-6babd829939c">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Number of Associated Consultation Log Entries]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="900" y="0" width="100" height="44" uuid="77fe4cfa-6cd6-406e-9125-dd513caf64db">
+ <reportElement style="Column header" x="900" y="0" width="100" height="60" uuid="77fe4cfa-6cd6-406e-9125-dd513caf64db">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
<textFieldExpression>
- <![CDATA[$F{originationdate} !== null ? java.lang.String.format("%tF", $F{originationdate}) : '']]>
+ <![CDATA[$F{originationdate} !== null ? $F{originationdate}.toLocalDateTime().toLocalDate() : '']]>
</textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement style="Detail" x="400" y="0" width="100" height="30" uuid="09a21589-e9f4-4b31-8dcd-d989540c1b77">
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
- <textFieldExpression><![CDATA[$F{inventorystatus}]]></textFieldExpression>
+ <textFieldExpression><![CDATA[
+ var date = $F{inventorydate} !== null ? '(' + $F{inventorydate}.toLocalDateTime().toLocalDate() + ')' : '';
+ $F{inventorystatus} !== null ? $F{inventorystatus} + ' ' + date : date]]>
+ </textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement style="Detail" x="500" y="0" width="100" height="30" uuid="c2c43e42-0fc1-4fad-b5bb-d8c62b534524">
if (!owner) {
return null;
}
- return dates[index] === null ? owner : java.lang.String.format("%s (%tF)", owner, dates[index]);
+ return dates[index] === null ? owner : owner + ' (' + dates[index].toLocalDateTime().toLocalDate() + ')';
}).filter(owner => !!owner).join('; ')
]]>
</textFieldExpression>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.20.1.final using JasperReports Library version 6.20.1-7584acb244139816654f64e2fd57a00d3e31921e -->
-<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="repatriation_request_consultation" language="javascript" pageWidth="1500" pageHeight="800" orientation="Landscape" columnWidth="100" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isIgnorePagination="true" uuid="6a52b090-4ec9-4176-a09a-8af53b7323f0">
+<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="repatriation_request_consultation" language="javascript" pageWidth="1600" pageHeight="800" orientation="Landscape" columnWidth="100" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isIgnorePagination="true" uuid="6a52b090-4ec9-4176-a09a-8af53b7323f0">
<property name="com.jaspersoft.studio.data.sql.tables" value="" />
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="nuxeo" />
<property name="com.jaspersoft.studio.data.sql.SQLQueryDesigner.sash.w1" value="193" />
<style name="Column header" fontName="SansSerif" fontSize="12" isBold="true" />
<style name="Detail" fontName="SansSerif" fontSize="12" />
<parameter name="deurnfields" class="java.lang.String" isForPrompting="false">
- <defaultValueExpression><![CDATA["onbehalfof,cultures"]]></defaultValueExpression>
+ <defaultValueExpression><![CDATA["onbehalfof,cultures,sites"]]></defaultValueExpression>
</parameter>
<parameter name="tenantid" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["1"]]></defaultValueExpression>
coalesce(object_count.afo_count, 0) AS afo_count,
coalesce(object_count.ufo_count, 0) AS ufo_count,
coalesce(object_count.ethnographic_count, 0) AS ethnographic_count,
+ coalesce(archaeological_sites.sites, '{}') AS sites,
coalesce(inventories.titles, '{}') AS inventory_titles,
coalesce(inventory_count.count, 0) AS inventory_count,
coalesce(summaries.titles, '{}') AS summary_titles,
WHERE ocg_hierarchy.name = 'collectionobjects_common:objectCountGroupList'
GROUP BY objs.repatriation_csid
) object_count ON object_count.repatriation_csid = rr_hierarchy.name
+ LEFT JOIN (
+ SELECT related_objects.repatriation_csid,
+ array_agg(fcs.item) as sites
+ FROM collectionobjects_common_fieldcollectionsites fcs
+ INNER JOIN related_objects on related_objects.object_id = fcs.id
+ GROUP BY related_objects.repatriation_csid
+ ) archaeological_sites ON archaeological_sites.repatriation_csid = rr_hierarchy.name
LEFT JOIN (
-- Related NAGPRA Inventory (Claim -> Object -> Inventory)
-- Number of associated NAGPRA inventory records.
<property name="com.jaspersoft.studio.field.name" value="log_total" />
<property name="com.jaspersoft.studio.field.label" value="log_total" />
</field>
+ <field name="sites" class="java.sql.Array">
+ <property name="com.jaspersoft.studio.field.name" value="sites" />
+ <property name="com.jaspersoft.studio.field.label" value="sites" />
+ </field>
<background>
<band splitType="Stretch" />
</background>
<columnHeader>
- <band height="44" splitType="Stretch">
+ <band height="60" splitType="Stretch">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout" />
<property name="com.jaspersoft.studio.unit.height" value="px" />
<staticText>
- <reportElement style="Column header" x="0" y="0" width="100" height="44" uuid="8b729164-1e04-4ea5-8f0e-6be11fcd24a9">
+ <reportElement style="Column header" x="0" y="0" width="100" height="60" uuid="8b729164-1e04-4ea5-8f0e-6be11fcd24a9">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Organization(s)]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="100" y="0" width="100" height="44" uuid="888a4b38-9b27-457e-91e1-ffa1882b659a">
+ <reportElement style="Column header" x="100" y="0" width="100" height="60" uuid="888a4b38-9b27-457e-91e1-ffa1882b659a">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Repatriation Request Origination Date]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="200" y="0" width="100" height="44" uuid="fef83b09-5b96-45cc-8a9a-2e59fc3baf60">
+ <reportElement style="Column header" x="200" y="0" width="100" height="60" uuid="fef83b09-5b96-45cc-8a9a-2e59fc3baf60">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Repatriation Request Number]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="300" y="0" width="100" height="44" uuid="f3636866-52a2-49ac-b609-2a58bcc53047">
+ <reportElement style="Column header" x="300" y="0" width="100" height="60" uuid="f3636866-52a2-49ac-b609-2a58bcc53047">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Repatriation Request Name]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="400" y="0" width="100" height="44" uuid="0efc36d1-4e40-46e9-b650-71afe6d73692">
+ <reportElement style="Column header" x="400" y="0" width="100" height="60" uuid="0efc36d1-4e40-46e9-b650-71afe6d73692">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[MNI Count]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="500" y="0" width="100" height="44" uuid="edfbd25f-31aa-49c9-aa15-3834efc57ac1">
+ <reportElement style="Column header" x="500" y="0" width="100" height="60" uuid="edfbd25f-31aa-49c9-aa15-3834efc57ac1">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
- <text><![CDATA[AFO Lot Count]]></text>
+ <text><![CDATA[AFO Count]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="600" y="0" width="100" height="44" uuid="906e84f6-068d-4e6b-bb09-99c6aae85fbc">
+ <reportElement style="Column header" x="600" y="0" width="100" height="60" uuid="906e84f6-068d-4e6b-bb09-99c6aae85fbc">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[UFO Count]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="700" y="0" width="100" height="44" uuid="2daa4c02-9105-4701-ad08-c28a0830725a">
+ <reportElement style="Column header" x="700" y="0" width="100" height="60" uuid="2daa4c02-9105-4701-ad08-c28a0830725a">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Ethnographic Belongings Repatriation Request]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="800" y="0" width="100" height="44" uuid="a672b0d8-60c7-4ad6-a47e-abe724790fe8">
+ <reportElement style="Column header" x="800" y="0" width="100" height="60" uuid="a672b0d8-60c7-4ad6-a47e-abe724790fe8">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Culture(s) Related to Repatriation Request]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="900" y="0" width="100" height="44" uuid="8d8d804b-e4f2-4cb7-84a1-0fc343babd25">
+ <reportElement style="Column header" x="900" y="0" width="100" height="60" uuid="4db40578-bd05-4689-935f-4c6c00dc6f2a">
+ <property name="com.jaspersoft.studio.unit.width" value="px"/>
+ </reportElement>
+ <textElement markup="styled"/>
+ <text><![CDATA[Site(s) Related to Repatriation Request]]></text>
+ </staticText>
+ <staticText>
+ <reportElement style="Column header" x="1000" y="0" width="100" height="60" uuid="8d8d804b-e4f2-4cb7-84a1-0fc343babd25">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Number of Associated NAGPRA Inventory Record(s)]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="1000" y="0" width="100" height="44" uuid="9ba161bf-860a-4d46-9914-34ccd4072209">
+ <reportElement style="Column header" x="1100" y="0" width="100" height="60" uuid="9ba161bf-860a-4d46-9914-34ccd4072209">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Title of NAGPRA Inventory Record(s)]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="1100" y="0" width="100" height="44" uuid="dd4ef24d-c3fd-4f1c-ac95-bbe21171030a">
+ <reportElement style="Column header" x="1200" y="0" width="100" height="60" uuid="dd4ef24d-c3fd-4f1c-ac95-bbe21171030a">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Number of Associated Summary Documentation Records]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="1200" y="0" width="100" height="44" uuid="711eac26-05f5-4868-bbab-9a77bfb223d0">
+ <reportElement style="Column header" x="1300" y="0" width="100" height="60" uuid="711eac26-05f5-4868-bbab-9a77bfb223d0">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Summary Documentation Title]]></text>
</staticText>
<staticText>
- <reportElement style="Column header" x="1300" y="0" width="100" height="44" uuid="3806b552-a19e-4535-b2f5-cee59f3410b4">
+ <reportElement style="Column header" x="1400" y="0" width="100" height="60" uuid="3806b552-a19e-4535-b2f5-cee59f3410b4">
<property name="com.jaspersoft.studio.unit.width" value="px" />
</reportElement>
<textElement markup="styled" />
<text><![CDATA[Number of Associated Consultation Log Entries]]></text>
</staticText>
- <!--
- <staticText>
- <reportElement style="Column header" x="1400" y="0" width="100" height="44" uuid="4db40578-bd05-4689-935f-4c6c00dc6f2a">
- <property name="com.jaspersoft.studio.unit.width" value="px"/>
- </reportElement>
- <textElement markup="styled"/>
- <text><![CDATA[Site(s) Related to Repatriation Request]]></text>
- </staticText>
- -->
</band>
</columnHeader>
<detail>
<reportElement style="Detail" x="100" y="0" width="100" height="30" uuid="89b571d2-50e1-47bf-bf2d-f8a24b944ec8">
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
- <textFieldExpression><![CDATA[$F{requestdate} !== null ? java.lang.String.format("%tF", $F{requestdate}) : '']]></textFieldExpression>
+ <textFieldExpression><![CDATA[$F{requestdate} !== null ? $F{requestdate}.toLocalDateTime().toLocalDate() : '']]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement style="Detail" x="200" y="0" width="100" height="30" uuid="f7d5770e-a729-457b-a39f-9b1f05c980d3">
<textFieldExpression><![CDATA[$F{cultures}.getArray().filter((val) => !!val).join('; ')]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
- <reportElement style="Detail" x="900" y="0" width="100" height="30" uuid="7d87ad02-5a25-4e8c-88ae-537ecd7a1fe1">
+ <reportElement style="Detail" x="900" y="0" width="100" height="30" uuid="af734fab-e383-4813-b108-1d1e70e7989e">
+ <property name="com.jaspersoft.studio.unit.y" value="px"/>
+ </reportElement>
+ <textFieldExpression><![CDATA[$F{sites}.getArray().filter((site) => !!site).join('; ')]]></textFieldExpression>
+ </textField>
+ <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+ <reportElement style="Detail" x="1000" y="0" width="100" height="30" uuid="7d87ad02-5a25-4e8c-88ae-537ecd7a1fe1">
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
<textFieldExpression><![CDATA[$F{inventory_count}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
- <reportElement style="Detail" x="1000" y="0" width="100" height="30" uuid="a8f2a24f-31fc-46e8-a52d-175e372223a8">
+ <reportElement style="Detail" x="1100" y="0" width="100" height="30" uuid="a8f2a24f-31fc-46e8-a52d-175e372223a8">
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
<textFieldExpression><![CDATA[$F{inventory_titles}.getArray().filter(val => !!val).join('; ')]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
- <reportElement style="Detail" x="1100" y="0" width="100" height="30" uuid="a84fbf28-7959-412f-b391-d7a1a222c9d0">
+ <reportElement style="Detail" x="1200" y="0" width="100" height="30" uuid="a84fbf28-7959-412f-b391-d7a1a222c9d0">
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
<textFieldExpression><![CDATA[$F{summary_count}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
- <reportElement style="Detail" x="1200" y="0" width="100" height="30" uuid="38c63f53-35bf-4b7b-8e17-11287df5e98c">
+ <reportElement style="Detail" x="1300" y="0" width="100" height="30" uuid="38c63f53-35bf-4b7b-8e17-11287df5e98c">
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
<textFieldExpression><![CDATA[$F{summary_titles}.getArray().filter((val) => !!val).join('; ')]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
- <reportElement style="Detail" x="1300" y="0" width="100" height="30" uuid="c39e0311-64b2-425e-a63d-31279c0eeb07">
+ <reportElement style="Detail" x="1400" y="0" width="100" height="30" uuid="c39e0311-64b2-425e-a63d-31279c0eeb07">
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
<textFieldExpression><![CDATA[$F{log_total}]]></textFieldExpression>
</textField>
- <!--
- <textField textAdjust="StretchHeight" isBlankWhenNull="true">
- <reportElement style="Detail" x="1400" y="0" width="100" height="30" uuid="af734fab-e383-4813-b108-1d1e70e7989e">
- <property name="com.jaspersoft.studio.unit.y" value="px"/>
- </reportElement>
- <textFieldExpression><![CDATA[$F{}]]></textFieldExpression>
- </textField>
- -->
</band>
</detail>
</jasperReport>
<![CDATA[WITH related_objects AS (
SELECT hierarchy.id as object_id,
relation.objectcsid,
- relation.subjectcsid as repatriation_csid
+ relation.subjectcsid as summary_csid
FROM relations_common relation
INNER JOIN hierarchy on hierarchy.name = relation.objectcsid
- INNER JOIN misc ON misc.id = relation.id
- AND misc.lifecyclestate != 'deleted'
+ INNER JOIN misc ON misc.id = relation.id
+ AND misc.lifecyclestate != 'deleted'
WHERE relation.objectdocumenttype = 'CollectionObject'
AND relation.subjectdocumenttype = 'SummaryDocumentation'
$P!{whereclause_relation}
),
related_exits AS (
- SELECT DISTINCT ON (objs.repatriation_csid, hierarchy.id) objs.objectcsid,
- objs.repatriation_csid,
+ SELECT DISTINCT ON (objs.summary_csid, hierarchy.id) objs.objectcsid,
+ objs.summary_csid,
hierarchy.id as exit_id,
relation.subjectcsid as exit_csid
FROM related_objects objs
INNER join relations_common relation on relation.objectcsid = objs.objectcsid
AND relation.subjectdocumenttype = 'Exit'
INNER JOIN hierarchy on hierarchy.name = relation.subjectcsid
- INNER JOIN misc ON misc.id = relation.id
- AND misc.lifecyclestate != 'deleted'
+ INNER JOIN misc ON misc.id = relation.id
+ AND misc.lifecyclestate != 'deleted'
)
SELECT summary.documentationnumber,
- summary.originationdate,
- coalesce(titles.titles, '{}') AS titles,
- coalesce(summarytypes.summary_types, '{}') AS summary_types,
- coalesce(partiesinvolved.onbehalfof, '{}') AS onbehalfof,
- coalesce(culturalgroup.cultures, '{}') AS cultures,
- summary_status.status,
- summary_status.statusdate,
- coalesce(object_count.sacred_object_count, 0) AS sacred_object_count,
- coalesce(object_count.ufo_count, 0) AS ufo_count,
- coalesce(object_count.cultural_patrimony_count, 0) AS cultural_patrimony_count,
- coalesce(object_count.lineal_descendent_count, 0) AS lineal_descendent_count,
- coalesce(archaeological_sites.sites, '{}') AS sites,
- coalesce(consultations.log_total, 0) AS log_total,
- coalesce(exits.exit_owners, '{}') AS exit_owners,
- coalesce(exits.exit_dates, '{}') AS exit_dates
+ summary.originationdate,
+ coalesce(titles.titles, '{}') AS titles,
+ coalesce(summarytypes.summary_types, '{}') AS summary_types,
+ coalesce(partiesinvolved.onbehalfof, '{}') AS onbehalfof,
+ coalesce(culturalgroup.cultures, '{}') AS cultures,
+ summary_status.status,
+ summary_status.statusdate,
+ coalesce(object_count.sacred_object_count, 0) AS sacred_object_count,
+ coalesce(object_count.ufo_count, 0) AS ufo_count,
+ coalesce(object_count.cultural_patrimony_count, 0) AS cultural_patrimony_count,
+ coalesce(object_count.lineal_descendant_count, 0) AS lineal_descendant_count,
+ coalesce(archaeological_sites.sites, '{}') AS sites,
+ coalesce(consultations.log_total, 0) AS log_total,
+ coalesce(exits.exit_owners, '{}') AS exit_owners,
+ coalesce(exits.exit_dates, '{}') AS exit_dates
FROM hierarchy summary_hierarchy
INNER JOIN misc ON misc.id = summary_hierarchy.id
AND misc.lifecyclestate != 'deleted'
GROUP BY hierarchy.parentid
) culturalgroup ON culturalgroup.parentid = summary.id
LEFT JOIN (
- -- Related archaeological sites
- SELECT hierarchy.parentid,
- array_agg(asg.archaeologicalsite) AS sites
- FROM hierarchy
- INNER JOIN archaeologicalsitegroup asg ON asg.id = hierarchy.id
- WHERE hierarchy.name = 'summarydocumentations_common:archaeologicalSiteGroupList'
- GROUP BY hierarchy.parentid
- ) archaeological_sites ON archaeological_sites.parentid = summary.id
+ SELECT related_objects.summary_csid,
+ array_agg(fcs.item) as sites
+ FROM collectionobjects_common_fieldcollectionsites fcs
+ INNER JOIN related_objects on related_objects.object_id = fcs.id
+ GROUP BY related_objects.summary_csid
+ ) archaeological_sites ON archaeological_sites.summary_csid = summary_hierarchy.name
LEFT JOIN (
-- Current Status: most recent
SELECT DISTINCT ON (hierarchy.parentid) hierarchy.parentid,
-- type is sacred object, cultural partrimony, UFO and lineal descent
-- Use regex matching because the refnames can contain subsets of the others,
-- so occasionally do things like use a word boundary (\y) to avoid overlaps
- SELECT objs.repatriation_csid,
+ SELECT objs.summary_csid,
sum(
CASE
WHEN ocg.objectcounttype ~ 'sacred_object' THEN ocg.objectcount
) AS cultural_patrimony_count,
sum(
CASE
- WHEN ocg.objectcounttype ~ 'lineal_descendent' THEN ocg.objectcount
+ WHEN ocg.objectcounttype ~ 'lineal_descendant' THEN ocg.objectcount
ELSE 0
END
- ) AS lineal_descendent_count
+ ) AS lineal_descendant_count
FROM hierarchy ocg_hierarchy
INNER JOIN related_objects objs ON objs.object_id = ocg_hierarchy.parentid
INNER JOIN objectcountgroup ocg ON ocg.id = ocg_hierarchy.id
WHERE ocg_hierarchy.name = 'collectionobjects_common:objectCountGroupList'
- GROUP BY objs.repatriation_csid
- ) object_count ON object_count.repatriation_csid = summary_hierarchy.name
+ GROUP BY objs.summary_csid
+ ) object_count ON object_count.summary_csid = summary_hierarchy.name
LEFT JOIN (
-- Related Consultations (Summary -> Consultation)
-- Number of Consultation Log Entries. Consultations related to the Summary record, pull a count of how many entries are in the log.
-- Current owner with exit date: If there is an object exit related to the related objects, pull the current owner. Concatenate and separate by ;
-- (Format example: The United Band of Humbolt People, 2024-08-02; The Dog River People, 2024-09-05).
-- Allows NULL values to aggregate so we don't lose track of pairs
- SELECT related_exits.repatriation_csid,
+ SELECT related_exits.summary_csid,
array_agg(exit.exitdate) as exit_dates,
array_agg(owners.item) AS exit_owners
FROM exits_common exit
INNER JOIN related_exits on related_exits.exit_id = exit.id
LEFT JOIN exits_common_owners owners on owners.id = exit.id AND owners.pos = 0
- GROUP BY related_exits.repatriation_csid
- ) exits ON exits.repatriation_csid = summary_hierarchy.name
+ GROUP BY related_exits.summary_csid
+ ) exits ON exits.summary_csid = summary_hierarchy.name
$P!{whereclause}]]>
</queryString>
<field name="documentationnumber" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="cultural_patrimony_count" />
<property name="com.jaspersoft.studio.field.label" value="cultural_patrimony_count" />
</field>
- <field name="lineal_descendent_count" class="java.math.BigDecimal">
- <property name="com.jaspersoft.studio.field.name" value="lineal_descendent_count" />
- <property name="com.jaspersoft.studio.field.label" value="lineal_descendent_count" />
+ <field name="lineal_descendant_count" class="java.math.BigDecimal">
+ <property name="com.jaspersoft.studio.field.name" value="lineal_descendant_count" />
+ <property name="com.jaspersoft.studio.field.label" value="lineal_descendant_count" />
</field>
<field name="sites" class="java.sql.Array">
<property name="com.jaspersoft.studio.field.name" value="sites" />
<reportElement style="Detail" x="0" y="0" width="100" height="30" uuid="b387bbaf-4760-45af-a84c-62681a678e61">
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
- <textFieldExpression><![CDATA[$F{onbehalfof}.getArray().join('; ')]]></textFieldExpression>
+ <textFieldExpression><![CDATA[$F{onbehalfof}.getArray().filter((val) => !!val).join('; ')]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement style="Detail" x="100" y="0" width="100" height="30" uuid="e3b59f6b-c027-4527-8f95-453c97a250f5">
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
- <textFieldExpression><![CDATA[$F{originationdate} !== null ? java.lang.String.format("%tF", $F{originationdate}) : '']]></textFieldExpression>
+ <textFieldExpression><![CDATA[$F{originationdate} !== null ? $F{originationdate}.toLocalDateTime().toLocalDate() : '']]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement style="Detail" x="200" y="0" width="100" height="30" uuid="0138ed1b-1e54-4d27-92f4-1e42769adbcb">
<reportElement style="Detail" x="300" y="0" width="100" height="30" uuid="99fcf86b-ed71-413a-a65f-dcbb51d096eb">
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
- <textFieldExpression><![CDATA[$F{titles}.getArray().join('; ')]]></textFieldExpression>
+ <textFieldExpression><![CDATA[$F{titles}.getArray().filter((val) => !!val).join('; ')]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement style="Detail" x="400" y="0" width="100" height="30" uuid="637dac22-c0a3-4c77-b323-f15f65b5bdf7">
<textFieldExpression>
<![CDATA[
var status = $F{status} !== null ? $F{status} : '';
- var date = $F{statusdate} !== null ? java.lang.String.format("(%tF)", $F{statusdate}) : '';
+ var date = $F{statusdate} !== null ? '(' + $F{statusdate}.toLocalDateTime().toLocalDate() + ')' : '';
status + " " + date;
]]>
</textFieldExpression>
<reportElement style="Detail" x="800" y="0" width="100" height="30" uuid="6619e1e3-2761-4c6b-8e4a-3be5d8e4b956">
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
- <textFieldExpression><![CDATA[$F{lineal_descendent_count}]]></textFieldExpression>
+ <textFieldExpression><![CDATA[$F{lineal_descendant_count}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement style="Detail" x="900" y="0" width="100" height="30" uuid="0beee49d-f49d-4e17-8f78-bb5c3184aaa1">
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
- <textFieldExpression><![CDATA[$F{summary_types}.getArray().join('; ')]]></textFieldExpression>
+ <textFieldExpression><![CDATA[$F{summary_types}.getArray().filter((val) => !!val).join('; ')]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement style="Detail" x="1000" y="0" width="100" height="30" uuid="bd6c6806-b6d2-495c-917f-ae879e740992">
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
- <textFieldExpression><![CDATA[$F{sites}.getArray().join('; ')]]></textFieldExpression>
+ <textFieldExpression><![CDATA[$F{sites}.getArray().filter((val) => !!val).join('; ')]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement style="Detail" x="1100" y="0" width="100" height="30" uuid="6d4f8b23-ea8c-4a38-9acc-4ca7eff30219">
<property name="com.jaspersoft.studio.unit.y" value="px" />
</reportElement>
- <textFieldExpression><![CDATA[$F{cultures}.getArray().join('; ')]]></textFieldExpression>
+ <textFieldExpression><![CDATA[$F{cultures}.getArray().filter((val) => !!val).join('; ')]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement style="Detail" x="1200" y="0" width="100" height="30" uuid="54b06775-91a6-4b74-a747-a7977e5943fb">
if (!owner) {
return null;
}
- return dates[index] === null ? owner : java.lang.String.format("%s (%tF)", owner, dates[index]);
+ return dates[index] === null ? owner : owner + ' (' + dates[index].toLocalDateTime().toLocalDate() + ')';
}).filter(owner => !!owner).join('; ')
]]>
</textFieldExpression>