]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
8.1 Workflow Reports (#435)
authorMichael Ritter <mikejritter@users.noreply.github.com>
Thu, 5 Dec 2024 23:08:33 +0000 (16:08 -0700)
committerGitHub <noreply@github.com>
Thu, 5 Dec 2024 23:08:33 +0000 (16:08 -0700)
* DRYD-1512: Consultation NAGPRA Repatriation Request Report
* DRYD-1513: Consultation NAGPRA Inventory Report
* DRYD-1514: Consultation NAGPRA Summary Report
* DRYD-1533: Exhibition Checklist Report

services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml
services/report/3rdparty/jasper-cs-report/src/main/resources/exhibition_checklist.jrxml [new file with mode: 0644]
services/report/3rdparty/jasper-cs-report/src/main/resources/exhibition_checklist.xml [new file with mode: 0644]
services/report/3rdparty/jasper-cs-report/src/main/resources/inventory_consultation.jrxml [new file with mode: 0644]
services/report/3rdparty/jasper-cs-report/src/main/resources/inventory_consultation.xml [new file with mode: 0644]
services/report/3rdparty/jasper-cs-report/src/main/resources/repatriation_request_consultation.jrxml [new file with mode: 0644]
services/report/3rdparty/jasper-cs-report/src/main/resources/repatriation_request_consultation.xml [new file with mode: 0644]
services/report/3rdparty/jasper-cs-report/src/main/resources/summary_documentation_consultation.jrxml [new file with mode: 0644]
services/report/3rdparty/jasper-cs-report/src/main/resources/summary_documentation_consultation.xml [new file with mode: 0644]

index a2b0cf180317406c19972b678df4673834d101b9..8329c5e29b3aa988a8eb7abf4dbb25bb1e01f7e9 100644 (file)
                                        <types:key>report</types:key>
                                        <types:value>borrowing_receipt</types:value>
                                </types:item>
+                               <types:item>
+                                       <types:key>report</types:key>
+                                       <types:value>exhibition_checklist</types:value>
+                               </types:item>
+                               <types:item>
+                                       <types:key>report</types:key>
+                                       <types:value>inventory_consultation</types:value>
+                               </types:item>
+                               <types:item>
+                                       <types:key>report</types:key>
+                                       <types:value>repatriation_request_consultation</types:value>
+                               </types:item>
+                               <types:item>
+                                       <types:key>report</types:key>
+                                       <types:value>summary_documentation_consultation</types:value>
+                               </types:item>
                        </service:properties>
                        <service:object xmlns:service="http://collectionspace.org/services/config/service" name="Report"
                                version="1.0">
diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/exhibition_checklist.jrxml b/services/report/3rdparty/jasper-cs-report/src/main/resources/exhibition_checklist.jrxml
new file mode 100644 (file)
index 0000000..d0d4f95
--- /dev/null
@@ -0,0 +1,458 @@
+<?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="exhibition_checklist" language="javascript" pageWidth="1400" pageHeight="500" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isIgnorePagination="true" uuid="d717b180-0109-4b56-8860-a1d417f932a3">
+       <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" />
+       <property name="com.jaspersoft.studio.data.sql.SQLQueryDesigner.sash.w2" value="800" />
+       <property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w1" value="625" />
+       <property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w2" value="361" />
+       <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["controlled_object_names,persons,peoples,orgs,controlled_materials"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="tenantid" class="java.lang.String" isForPrompting="false">
+               <defaultValueExpression><![CDATA["1"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="csid" class="java.lang.String" isForPrompting="false">
+               <defaultValueExpression><![CDATA["eaff83d7-30ba-43a1-b493"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="whereclause" class="java.lang.String" isForPrompting="false">
+               <defaultValueExpression><![CDATA[$P{csid} !== null ? "AND exhibition_relation.subjectcsid = '" + $P{csid} + "'" : ""]]></defaultValueExpression>
+       </parameter>
+       <queryString language="SQL">
+               <![CDATA[SELECT obj.objectnumber,
+       obj.computedcurrentlocation,
+       coalesce(responsible_department.responsible_departments, '{}') AS responsible_departments,
+       coalesce(other_number.other_number_type, '{}') AS other_number_type,
+       coalesce(other_number.other_number_value, '{}') AS other_number_value,
+       coalesce(title.title, '{}') AS titles,
+       coalesce(object_name.object_names, '{}') AS object_names,
+       coalesce(object_name.controlled_object_names, '{}') AS controlled_object_names,
+       coalesce(production_person.persons, '{}') AS persons,
+       coalesce(production_people.peoples, '{}') AS peoples,
+       coalesce(production_org.orgs, '{}') AS orgs,
+       coalesce(production_date.production_dates, '{}') AS production_dates,
+       coalesce(material.materials, '{}') AS materials,
+       coalesce(material.controlled_materials, '{}') AS controlled_materials,
+       coalesce(dimension.dimension_summaries, '{}') AS dimension_summaries,
+       coalesce(acquisition.acquisition_credit_lines, '{}') AS acquisition_credit_lines,
+       coalesce(loanin.loan_credit_lines, '{}') AS loan_credit_lines,
+       media.media_csid
+FROM hierarchy
+       INNER JOIN relations_common exhibition_relation ON exhibition_relation.objectcsid = hierarchy.name
+       AND exhibition_relation.subjectdocumenttype = 'Exhibition' $P!{whereclause}
+       INNER JOIN collectionobjects_common obj ON obj.id = hierarchy.id
+       LEFT JOIN (
+               SELECT department.id,
+                       array_agg(department.item) AS responsible_departments
+               FROM collectionobjects_common_responsibledepartments department
+               GROUP BY department.id
+       ) responsible_department ON responsible_department.id = hierarchy.id
+       LEFT JOIN (
+               SELECT other_number_hierarchy.parentid,
+                       array_agg(othernumber.numbertype) AS other_number_type,
+                       array_agg(othernumber.numbervalue) AS other_number_value
+               FROM hierarchy other_number_hierarchy
+                       INNER JOIN othernumber ON othernumber.id = other_number_hierarchy.id
+               WHERE other_number_hierarchy.name = 'collectionobjects_common:otherNumberList'
+               GROUP BY other_number_hierarchy.parentid
+       ) other_number ON other_number.parentid = hierarchy.id
+       LEFT JOIN (
+               SELECT title_hierarchy.parentid,
+                       array_agg(titlegroup.title) AS title
+               FROM hierarchy title_hierarchy
+                       INNER JOIN titlegroup ON titlegroup.id = title_hierarchy.id
+               WHERE title_hierarchy.name = 'collectionobjects_common:titleGroupList'
+               GROUP BY title_hierarchy.parentid
+       ) title ON title.parentid = hierarchy.id
+       LEFT JOIN (
+               SELECT hierarchy.parentid,
+                       array_agg(ong.objectname) AS object_names,
+                       array_agg(ong.objectnamecontrolled) AS controlled_object_names
+               FROM hierarchy
+                       INNER JOIN objectnamegroup ong ON ong.id = hierarchy.id
+               WHERE hierarchy.name = 'collectionobjects_common:objectNameList'
+               GROUP BY hierarchy.parentid
+       ) object_name ON object_name.parentid = hierarchy.id
+       LEFT JOIN (
+               SELECT hierarchy.parentid,
+                       array_agg(person.objectproductionperson) AS persons
+               FROM hierarchy
+                       INNER JOIN objectproductionpersongroup person ON person.id = hierarchy.id
+               WHERE hierarchy.name = 'collectionobjects_common:objectProductionPersonGroupList'
+               GROUP BY hierarchy.parentid
+       ) production_person ON production_person.parentid = hierarchy.id
+       LEFT JOIN (
+               SELECT hierarchy.parentid,
+                       array_agg(people.objectproductionpeople) AS peoples
+               FROM hierarchy
+                       INNER JOIN objectproductionpeoplegroup people ON people.id = hierarchy.id
+               WHERE hierarchy.name = 'collectionobjects_common:objectProductionPeopleGroupList'
+               GROUP BY hierarchy.parentid
+       ) production_people ON production_people.parentid = hierarchy.id
+       LEFT JOIN (
+               SELECT hierarchy.parentid,
+                       array_agg(org.objectproductionorganization) AS orgs
+               FROM hierarchy
+                       INNER JOIN objectproductionorganizationgroup org ON org.id = hierarchy.id
+               WHERE hierarchy.name = 'collectionobjects_common:objectProductionOrganizationGroupList'
+               GROUP BY hierarchy.parentid
+       ) production_org ON production_org.parentid = hierarchy.id
+       LEFT JOIN (
+               SELECT hierarchy.parentid,
+                       array_agg(sdg.datedisplaydate) AS production_dates
+               FROM hierarchy
+                       INNER JOIN structureddategroup sdg ON sdg.id = hierarchy.id
+               WHERE hierarchy.name = 'collectionobjects_common:objectProductionDateGroupList'
+               GROUP BY hierarchy.parentid
+       ) production_date ON production_date.parentid = hierarchy.id
+       LEFT JOIN (
+               SELECT hierarchy.parentid,
+                       array_agg(material.material) AS materials,
+                       array_agg(material.materialcontrolled) AS controlled_materials
+               FROM hierarchy
+                       INNER JOIN materialgroup material ON material.id = hierarchy.id
+               WHERE hierarchy.name = 'collectionobjects_common:materialGroupList'
+               GROUP BY hierarchy.parentid
+       ) material ON material.parentid = hierarchy.id
+       LEFT JOIN (
+               SELECT hierarchy.parentid,
+                       array_agg(dimension.dimensionsummary) AS dimension_summaries
+               FROM hierarchy
+                       INNER JOIN measuredpartgroup dimension ON dimension.id = hierarchy.id
+               WHERE hierarchy.name = 'collectionobjects_common:measuredPartGroupList'
+               GROUP BY hierarchy.parentid
+       ) dimension ON dimension.parentid = hierarchy.id -- would lateral be better for these?
+       LEFT JOIN (
+               SELECT relation.objectcsid AS object_csid,
+                       array_agg(acquisition.creditline) as acquisition_credit_lines
+               FROM relations_common relation
+                       INNER JOIN misc ON misc.id = relation.id
+                       AND misc.lifecyclestate != 'deleted'
+                       INNER JOIN hierarchy acquisition_hierarchy ON acquisition_hierarchy.name = relation.subjectcsid
+                       INNER JOIN acquisitions_common acquisition ON acquisition.id = acquisition_hierarchy.id
+               WHERE relation.objectdocumenttype = 'CollectionObject'
+                       AND relation.subjectdocumenttype = 'Acquisition'
+               GROUP BY relation.objectcsid
+       ) acquisition ON acquisition.object_csid = hierarchy.name
+       LEFT JOIN (
+               SELECT relation.objectcsid AS object_csid,
+                       array_agg(loan.creditline) as loan_credit_lines
+               FROM relations_common relation
+                       INNER JOIN misc ON misc.id = relation.id
+                       AND misc.lifecyclestate != 'deleted'
+                       INNER JOIN hierarchy loan_hierarchy ON loan_hierarchy.name = relation.subjectcsid
+                       INNER JOIN loansin_common loan ON loan.id = loan_hierarchy.id
+               WHERE relation.objectdocumenttype = 'CollectionObject'
+                       AND relation.subjectdocumenttype = 'Loanin'
+               GROUP BY relation.objectcsid
+       ) loanin ON loanin.object_csid = hierarchy.name
+       LEFT JOIN (
+               SELECT DISTINCT ON (media.objectcsid) media.objectcsid AS object_csid,
+                       media.subjectcsid AS media_csid
+               FROM relations_common media
+                       INNER JOIN misc ON misc.id = media.id
+                       AND misc.lifecyclestate != 'deleted'
+                       INNER JOIN hierarchy media_hierarchy ON media_hierarchy.name = media.subjectcsid
+                       INNER JOIN collectionspace_core core ON core.id = media_hierarchy.id
+               WHERE media.objectdocumenttype = 'CollectionObject'
+                       AND media.subjectdocumenttype = 'Media'
+               ORDER BY media.objectcsid,
+                       core.updatedat DESC
+       ) media ON media.object_csid = hierarchy.name]]>
+       </queryString>
+       <field name="objectnumber" class="java.lang.String">
+               <property name="com.jaspersoft.studio.field.name" value="objectnumber" />
+               <property name="com.jaspersoft.studio.field.label" value="objectnumber" />
+               <property name="com.jaspersoft.studio.field.tree.path" value="collectionobjects_common" />
+       </field>
+       <field name="computedcurrentlocation" class="java.lang.String">
+               <property name="com.jaspersoft.studio.field.name" value="computedcurrentlocation" />
+               <property name="com.jaspersoft.studio.field.label" value="computedcurrentlocation" />
+               <property name="com.jaspersoft.studio.field.tree.path" value="collectionobjects_common" />
+       </field>
+       <field name="responsible_departments" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="responsible_departments" />
+               <property name="com.jaspersoft.studio.field.label" value="responsible_departments" />
+       </field>
+       <field name="other_number_type" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="other_number_type" />
+               <property name="com.jaspersoft.studio.field.label" value="other_number_type" />
+       </field>
+       <field name="other_number_value" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="other_number_value" />
+               <property name="com.jaspersoft.studio.field.label" value="other_number_value" />
+       </field>
+       <field name="titles" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="titles" />
+               <property name="com.jaspersoft.studio.field.label" value="titles" />
+       </field>
+       <field name="object_names" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="object_names" />
+               <property name="com.jaspersoft.studio.field.label" value="object_names" />
+       </field>
+       <field name="controlled_object_names" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="controlled_object_names" />
+               <property name="com.jaspersoft.studio.field.label" value="controlled_object_names" />
+       </field>
+       <field name="persons" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="persons" />
+               <property name="com.jaspersoft.studio.field.label" value="persons" />
+       </field>
+       <field name="peoples" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="peoples" />
+               <property name="com.jaspersoft.studio.field.label" value="peoples" />
+       </field>
+       <field name="orgs" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="orgs" />
+               <property name="com.jaspersoft.studio.field.label" value="orgs" />
+       </field>
+       <field name="production_dates" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="production_dates" />
+               <property name="com.jaspersoft.studio.field.label" value="production_dates" />
+       </field>
+       <field name="materials" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="materials" />
+               <property name="com.jaspersoft.studio.field.label" value="materials" />
+       </field>
+       <field name="controlled_materials" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="controlled_materials" />
+               <property name="com.jaspersoft.studio.field.label" value="controlled_materials" />
+       </field>
+       <field name="dimension_summaries" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="dimension_summaries" />
+               <property name="com.jaspersoft.studio.field.label" value="dimension_summaries" />
+       </field>
+       <field name="acquisition_credit_lines" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="acquisition_credit_lines" />
+               <property name="com.jaspersoft.studio.field.label" value="acquisition_credit_lines" />
+       </field>
+       <field name="loan_credit_lines" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="loan_credit_lines" />
+               <property name="com.jaspersoft.studio.field.label" value="loan_credit_lines" />
+       </field>
+       <field name="media_csid" class="java.lang.String">
+               <property name="com.jaspersoft.studio.field.name" value="media_csid" />
+               <property name="com.jaspersoft.studio.field.label" value="media_csid" />
+               <property name="com.jaspersoft.studio.field.tree.path" value="relations_common" />
+       </field>
+       <background>
+               <band splitType="Stretch" />
+       </background>
+       <columnHeader>
+               <band height="44" 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="b5d858ac-732b-46b3-a201-33016376b9f0">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Identification Number]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="100" y="0" width="100" height="44" uuid="95365179-57ce-4a9c-90f0-85b33fc4d690">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Thumbnail]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="200" y="0" width="100" height="44" uuid="f0f68f3a-b746-4760-b2bc-a67670838605">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Other Number]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="300" y="0" width="100" height="44" uuid="8b3c59bc-10ff-4199-8a6d-145b6389484a">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Title]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="400" y="0" width="100" height="44" uuid="a7e79ddc-d6dc-41e1-8624-3348c66d65eb">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Object Names]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="500" y="0" width="100" height="44" uuid="cd279017-1217-418b-acb8-f13ad6cf9093">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Production Date]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="600" y="0" width="100" height="44" uuid="8bea5754-d4ca-44ac-baaf-b1f804edc89b">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Production Person]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="700" y="0" width="100" height="44" uuid="42aa8535-ef9d-4243-86f5-6095676fcff8">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Production People]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="800" y="0" width="100" height="44" uuid="499a3c78-3a08-4af9-93c3-7494801667a2">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Production Organization]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="900" y="0" width="100" height="44" uuid="3f3a333d-224b-4352-a767-a1d4bc58b19c">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Material]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="1000" y="0" width="100" height="44" uuid="3156509f-8edc-4177-be89-15d8c70e295e">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Dimension Summary]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="1100" y="0" width="100" height="44" uuid="94a215d7-b149-4460-b218-00081a2ee9f8">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Credit Line]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="1200" y="0" width="100" height="44" uuid="94a215d7-b149-4460-b218-00081a2ee9f8">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Computed Current Location]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="1300" y="0" width="100" height="44" uuid="94a215d7-b149-4460-b218-00081a2ee9f8">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Responsible Department]]></text>
+                       </staticText>
+               </band>
+       </columnHeader>
+       <detail>
+               <band height="66" splitType="Stretch">
+                       <property name="com.jaspersoft.studio.unit.height" value="px" />
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="0" y="0" width="100" height="30" uuid="e86ed49d-44da-4ad1-ad2b-328cf68bff4a">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{objectnumber}]]></textFieldExpression>
+                       </textField>
+                       <image onErrorType="Blank">
+                               <reportElement x="100" y="0" width="50" height="50" uuid="2c8f6f16-70a1-4818-a993-d3faec33f0d8" />
+                               <imageExpression><![CDATA["cspace://media/" + $F{media_csid} + "/blob/derivatives/Thumbnail/content"]]></imageExpression>
+                       </image>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="200" y="0" width="100" height="30" uuid="b43e31cf-daed-46d8-9007-54b0341f3544">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression>
+                                       <![CDATA[var numTypes = $F{other_number_type}.getArray();
+                                               $F{other_number_value}.getArray().map(function(value, index) {
+                                                       if (!value) {
+                                                               return null;
+                                                       }
+
+                                                       return numTypes[index] === null ? value : java.lang.String.format("%s %s", value, numTypes[index]);
+                                               }).filter(value => !!value).join('; ')
+                                       ]]>
+                               </textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="300" y="0" width="100" height="30" uuid="48f997b6-c4b8-4ace-b578-a28e613d8404">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{titles}.getArray().join('; ')]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="400" y="0" width="100" height="30" uuid="95de275d-5312-4120-826d-dee7c032d1c4">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression>
+                                       <![CDATA[$F{controlled_object_names}.getArray().concat($F{object_names}.getArray())
+                                       .filter(name => !!name)
+                                       .join('; ')]]>
+                               </textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="500" y="0" width="100" height="30" uuid="d6f98ce7-e5bf-4e9d-b0a2-58830ce28b9e">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{production_dates}.getArray().join('; ')]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="600" y="0" width="100" height="30" uuid="ab64a5d6-3996-4a69-931b-ba4bdf184712">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{persons}.getArray().join('; ')]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="700" y="0" width="100" height="30" uuid="6e474774-8d2b-42d0-a530-6ea47211c19b">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{peoples}.getArray().join('; ')]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="800" y="0" width="100" height="30" uuid="9f469f05-e7dd-4f00-bed4-cc54fc81b2cd">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{orgs}.getArray().join('; ')]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="900" y="0" width="100" height="30" uuid="05f7cd97-9026-4265-9bc7-4a5bd3428eb0">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression>
+                                       <![CDATA[$F{controlled_materials}.getArray().concat($F{materials}.getArray())
+                                               .filter(material => !!material)
+                                               .join('; ')]]>
+                               </textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="1000" y="0" width="100" height="30" uuid="4bbdd48e-6d13-49ff-a214-e5093c2c5692">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{dimension_summaries}.getArray().join('; ')]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="1100" y="0" width="100" height="30" uuid="626e6753-e71a-43da-8b29-5626569dec21">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression>
+                                       <![CDATA[$F{acquisition_credit_lines}.getArray().concat($F{loan_credit_lines}.getArray())
+                                               .filter(line => !!line)
+                                               .join('; ')
+                                       ]]>
+                               </textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="1200" y="0" width="100" height="30" uuid="664490bf-cc2d-4d17-b4f7-be20a6993bd6">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{computedcurrentlocation}]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="1300" y="0" width="100" height="30" uuid="3a602a43-faa9-425d-b5b7-fbf47559df1e">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{responsible_departments}.getArray().join('; ')]]></textFieldExpression>
+                       </textField>
+               </band>
+       </detail>
+</jasperReport>
\ No newline at end of file
diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/exhibition_checklist.xml b/services/report/3rdparty/jasper-cs-report/src/main/resources/exhibition_checklist.xml
new file mode 100644 (file)
index 0000000..7ca0ed5
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<document name="report">
+  <ns2:reports_common xmlns:ns2="http://collectionspace.org/services/report">
+    <name>Exhibition Checklist</name>
+    <notes>Catalog info for objects related to a exhibition record. Runs on a single record only.</notes>
+    <forDocTypes>
+      <forDocType>Exhibition</forDocType>
+    </forDocTypes>
+    <supportsSingleDoc>true</supportsSingleDoc>
+    <supportsDocList>false</supportsDocList>
+    <supportsGroup>false</supportsGroup>
+    <supportsNoContext>false</supportsNoContext>
+    <outputMIME>application/pdf</outputMIME>
+    <filename>exhibition_checklist.jrxml</filename>
+  </ns2:reports_common>
+</document>
diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/inventory_consultation.jrxml b/services/report/3rdparty/jasper-cs-report/src/main/resources/inventory_consultation.jrxml
new file mode 100644 (file)
index 0000000..62b079b
--- /dev/null
@@ -0,0 +1,358 @@
+<?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="inventory_consultation" language="javascript" pageWidth="1100" pageHeight="800" orientation="Landscape" columnWidth="100" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isIgnorePagination="true" uuid="2c34875b-77e8-4ad9-931f-69ff838403ae">
+       <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" />
+       <property name="com.jaspersoft.studio.data.sql.SQLQueryDesigner.sash.w2" value="800" />
+       <property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w1" value="625" />
+       <property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w2" value="361" />
+       <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,inventorystatus,sites,exit_owners"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="tenantid" class="java.lang.String" isForPrompting="false">
+               <defaultValueExpression><![CDATA["1"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="csidlist" class="java.lang.String" isForPrompting="false" />
+       <parameter name="csids" class="java.lang.String" isForPrompting="false">
+               <defaultValueExpression><![CDATA[$P{csidlist} != null ? ("'" + $P{csidlist}.replace(/,/g, "','") + "'") : "NOVALUE"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="whereclause_cte" class="java.lang.String" isForPrompting="false">
+               <defaultValueExpression><![CDATA[$P{csids} != "NOVALUE" ? ( "AND relation.subjectcsid IN (" + $P{csids} + ")" ) : ""]]></defaultValueExpression>
+       </parameter>
+       <parameter name="whereclause" class="java.lang.String" isForPrompting="false">
+               <defaultValueExpression><![CDATA[$P{csids} != "NOVALUE" ? ( "WHERE inv_hierarchy.name IN (" + $P{csids} + ")" ) : ""]]></defaultValueExpression>
+       </parameter>
+       <queryString language="SQL">
+               <![CDATA[-- Get relations first so that we can aggregate on the repatriation request
+WITH related_objects AS (
+       SELECT hierarchy.id as object_id,
+               relation.objectcsid,
+               relation.subjectcsid as repatriation_csid
+       FROM relations_common relation
+               INNER JOIN hierarchy on hierarchy.name = relation.objectcsid
+       WHERE relation.objectdocumenttype = 'CollectionObject'
+               AND relation.subjectdocumenttype = 'NagpraInventory'
+               $P!{whereclause_cte}
+),
+related_exits AS (
+       SELECT DISTINCT ON (objs.repatriation_csid, hierarchy.id) objs.objectcsid,
+               objs.repatriation_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
+)
+SELECT inventory.inventorynumber,
+  inventory.originationdate,
+  coalesce(titles.titles, '{}') AS titles,
+  coalesce(partiesinvolved.onbehalfof, '{}') AS onbehalfof,
+  inventory_status.inventorystatus,
+  inventory_status.inventorydate,
+  coalesce(object_count.mni_count, 0) AS mni_count,
+  coalesce(object_count.afo_count, 0) AS afo_count,
+  coalesce(field_collection_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 inv_hierarchy
+       INNER JOIN misc ON misc.id = inv_hierarchy.id AND misc.lifecyclestate != 'deleted'
+       INNER JOIN nagprainventories_common inventory ON inventory.id = inv_hierarchy.id
+       LEFT JOIN (
+               SELECT title.id AS inventory_id,
+                       array_agg(title.item) AS titles
+               FROM nagprainventories_common_titles title
+               GROUP BY title.id
+       ) titles ON titles.inventory_id = inv_hierarchy.id
+       LEFT JOIN (
+               -- Organizations pulled from on behalf field on Inventory record
+               SELECT hierarchy.parentid,
+                       array_agg(party.involvedonbehalfof) as onbehalfof
+               FROM hierarchy
+                       INNER JOIN partiesinvolvedgroup party ON party.id = hierarchy.id
+               WHERE hierarchy.name = 'nagprainventories_common:partiesInvolvedGroupList'
+               GROUP BY hierarchy.parentid
+       ) partiesinvolved ON partiesinvolved.parentid = inv_hierarchy.id
+       LEFT JOIN (
+               -- Current Status: Pull most recent Status from inventory status with the date.
+               SELECT DISTINCT ON (hierarchy.parentid) hierarchy.parentid,
+                       status_group.inventorystatus,
+                       status_group.inventorydate
+               FROM hierarchy
+                       INNER JOIN inventorystatusgroup status_group ON status_group.id = hierarchy.id
+               WHERE hierarchy.name = 'nagprainventories_common:inventoryStatusGroupList'
+               ORDER BY hierarchy.parentid,
+                       status_group.inventorydate DESC NULLS LAST
+       ) inventory_status ON inventory_status.parentid = inv_hierarchy.id
+       LEFT JOIN LATERAL (
+               -- 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,
+                       sum(
+                               CASE
+                                       WHEN ocg.objectcounttype ~ 'minimum' THEN ocg.objectcount
+                                       ELSE 0
+                               END
+                       ) AS mni_count,
+                       sum(
+                               CASE
+                                       WHEN ocg.objectcounttype ~ '\yassociated' THEN ocg.objectcount
+                                       ELSE 0
+                               END
+                       ) AS afo_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 = inv_hierarchy.name
+       LEFT JOIN (
+               -- Related Object - Field Collection Sites
+               SELECT objs.repatriation_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
+       LEFT JOIN (
+               -- Related Consultations (Inventory -> Consultation)
+               -- Number of Consultation Log Entries
+               SELECT relation.subjectcsid,
+                       count(cl_hierarchy.pos) AS log_total
+               FROM relations_common relation
+                       INNER JOIN misc ON misc.id = relation.id
+                       AND misc.lifecyclestate != 'deleted'
+                       INNER JOIN hierarchy consultation_hierarchy ON consultation_hierarchy.name = relation.objectcsid
+                       INNER JOIN hierarchy cl_hierarchy ON cl_hierarchy.parentid = consultation_hierarchy.id
+                       AND cl_hierarchy.name = 'consultations_common:consultationLogGroupList'
+               WHERE relation.objectdocumenttype = 'Consultation'
+                       AND relation.subjectdocumenttype = 'NagpraInventory'
+               GROUP BY relation.subjectcsid
+       ) consultations ON consultations.subjectcsid = inv_hierarchy.name
+       LEFT JOIN (
+               -- 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,
+                       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
+$P!{whereclause}]]>
+       </queryString>
+       <field name="inventorynumber" class="java.lang.String">
+               <property name="com.jaspersoft.studio.field.name" value="inventorynumber" />
+               <property name="com.jaspersoft.studio.field.label" value="inventorynumber" />
+               <property name="com.jaspersoft.studio.field.tree.path" value="nagprainventories_common" />
+       </field>
+       <field name="originationdate" class="java.sql.Timestamp">
+               <property name="com.jaspersoft.studio.field.name" value="originationdate" />
+               <property name="com.jaspersoft.studio.field.label" value="originationdate" />
+               <property name="com.jaspersoft.studio.field.tree.path" value="nagprainventories_common" />
+       </field>
+       <field name="titles" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="titles" />
+               <property name="com.jaspersoft.studio.field.label" value="titles" />
+       </field>
+       <field name="onbehalfof" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="onbehalfof" />
+               <property name="com.jaspersoft.studio.field.label" value="onbehalfof" />
+       </field>
+       <field name="inventorystatus" class="java.lang.String">
+               <property name="com.jaspersoft.studio.field.name" value="inventorystatus" />
+               <property name="com.jaspersoft.studio.field.label" value="inventorystatus" />
+               <property name="com.jaspersoft.studio.field.tree.path" value="inventorystatusgroup" />
+       </field>
+       <field name="inventorydate" class="java.sql.Timestamp">
+               <property name="com.jaspersoft.studio.field.name" value="inventorydate" />
+               <property name="com.jaspersoft.studio.field.label" value="inventorydate" />
+               <property name="com.jaspersoft.studio.field.tree.path" value="inventorystatusgroup" />
+       </field>
+       <field name="mni_count" class="java.math.BigDecimal">
+               <property name="com.jaspersoft.studio.field.name" value="mni_count" />
+               <property name="com.jaspersoft.studio.field.label" value="mni_count" />
+       </field>
+       <field name="afo_count" class="java.math.BigDecimal">
+               <property name="com.jaspersoft.studio.field.name" value="afo_count" />
+               <property name="com.jaspersoft.studio.field.label" value="afo_count" />
+       </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>
+       <field name="log_total" class="java.lang.Long">
+               <property name="com.jaspersoft.studio.field.name" value="log_total" />
+               <property name="com.jaspersoft.studio.field.label" value="log_total" />
+       </field>
+       <field name="exit_owners" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="exit_owners" />
+               <property name="com.jaspersoft.studio.field.label" value="exit_owners" />
+       </field>
+       <field name="exit_dates" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="exit_dates" />
+               <property name="com.jaspersoft.studio.field.label" value="exit_dates" />
+       </field>
+       <background>
+               <band splitType="Stretch" />
+       </background>
+       <columnHeader>
+               <band height="44" 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">
+                                       <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">
+                                       <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">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <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">
+                                       <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">
+                                       <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">
+                                       <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">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[AFO Lot Count]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="700" y="0" width="100" height="44" 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">
+                                       <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">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Exit Record - Current Owner with Exit Date]]></text>
+                       </staticText>
+               </band>
+       </columnHeader>
+       <detail>
+               <band height="66" splitType="Stretch">
+                       <property name="com.jaspersoft.studio.unit.height" value="px" />
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="0" y="0" width="100" height="30" uuid="72e8433f-f64f-4829-b195-eb6d49865b94">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{onbehalfof}.getArray().filter((org) => !!org).join('; ')]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="100" y="0" width="100" height="30" uuid="13555a23-15e0-4ef0-8b3e-7bac8ff73f22">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression>
+                                       <![CDATA[$F{originationdate} !== null ? java.lang.String.format("%tF", $F{originationdate}) : '']]>
+                               </textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="200" y="0" width="100" height="30" uuid="32d4d113-7eb7-4aed-bfbb-8f9645af3161">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{inventorynumber}]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="300" y="0" width="100" height="30" uuid="e6ad763b-46fe-47db-a304-009f5230d7b2">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{titles}.getArray().filter((title) => !!title).join('; ')]]></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>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="500" y="0" width="100" height="30" uuid="c2c43e42-0fc1-4fad-b5bb-d8c62b534524">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{afo_count}]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="600" y="0" width="100" height="30" uuid="411e6813-d586-4190-b721-7a22c00691ea">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{mni_count}]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="700" y="0" width="100" height="30" uuid="659569aa-1ff0-4aa9-beaa-294337bd8315">
+                                       <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="800" y="0" width="100" height="30" uuid="8077c24c-13a9-4809-817e-a299c052bb2b">
+                                       <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="900" y="0" width="100" height="30" uuid="0599f20f-f792-45b0-b0a1-c4c9ddc133e3">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression>
+                                       <![CDATA[var dates = $F{exit_dates}.getArray();
+                                               $F{exit_owners}.getArray().map(function(owner, index) {
+                                                       if (!owner) {
+                                                               return null;
+                                                       }
+                                                       return dates[index] === null ? owner : java.lang.String.format("%s (%tF)", owner, dates[index]);
+                                               }).filter(owner => !!owner).join('; ')
+                                       ]]>
+                               </textFieldExpression>
+                       </textField>
+               </band>
+       </detail>
+</jasperReport>
\ No newline at end of file
diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/inventory_consultation.xml b/services/report/3rdparty/jasper-cs-report/src/main/resources/inventory_consultation.xml
new file mode 100644 (file)
index 0000000..de41c8d
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<document name="report">
+  <ns2:reports_common xmlns:ns2="http://collectionspace.org/services/report">
+    <name>Inventory Consultation</name>
+    <notes>Placeholder</notes>
+    <forDocTypes>
+      <forDocType>NagpraInventory</forDocType>
+    </forDocTypes>
+    <supportsSingleDoc>false</supportsSingleDoc>
+    <supportsDocList>true</supportsDocList>
+    <supportsGroup>false</supportsGroup>
+    <supportsNoContext>false</supportsNoContext>
+    <filename>inventory_consultation.jrxml</filename>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
+  </ns2:reports_common>
+</document>
diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/repatriation_request_consultation.jrxml b/services/report/3rdparty/jasper-cs-report/src/main/resources/repatriation_request_consultation.jrxml
new file mode 100644 (file)
index 0000000..bef256a
--- /dev/null
@@ -0,0 +1,459 @@
+<?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">
+       <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" />
+       <property name="com.jaspersoft.studio.data.sql.SQLQueryDesigner.sash.w2" value="800" />
+       <property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w1" value="625" />
+       <property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w2" value="361" />
+       <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>
+       </parameter>
+       <parameter name="tenantid" class="java.lang.String" isForPrompting="false">
+               <defaultValueExpression><![CDATA["1"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="csidlist" class="java.lang.String" isForPrompting="false" />
+       <parameter name="csids" class="java.lang.String" isForPrompting="false">
+               <defaultValueExpression><![CDATA[$P{csidlist} != null ? ("'" + $P{csidlist}.replace(/,/g, "','") + "'") : "NOVALUE"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="whereclause_cte" class="java.lang.String" isForPrompting="false">
+               <defaultValueExpression><![CDATA[$P{csids} != "NOVALUE" ? ( "AND relation.subjectcsid IN (" + $P{csids} + ")" ) : ""]]></defaultValueExpression>
+       </parameter>
+       <parameter name="whereclause" class="java.lang.String" isForPrompting="false">
+               <defaultValueExpression><![CDATA[$P{csids} != "NOVALUE" ? ( "WHERE rr_hierarchy.name IN (" + $P{csids} + ")" ) : ""]]></defaultValueExpression>
+       </parameter>
+       <queryString language="SQL">
+               <![CDATA[WITH related_objects AS (
+       SELECT hierarchy.id as object_id,
+               relation.objectcsid,
+               relation.subjectcsid as repatriation_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'
+       WHERE relation.objectdocumenttype = 'CollectionObject'
+               AND relation.subjectdocumenttype = 'RepatriationRequest'
+               $P!{whereclause_cte}
+),
+related_inventories AS (
+       SELECT DISTINCT ON (objs.repatriation_csid, hierarchy.id) objs.objectcsid,
+               objs.repatriation_csid,
+               hierarchy.id as inventory_id,
+               relation.subjectcsid as inventory_csid
+       FROM related_objects objs
+               INNER join relations_common relation on relation.objectcsid = objs.objectcsid
+               AND relation.subjectdocumenttype = 'NagpraInventory'
+    INNER JOIN misc ON misc.id = relation.id
+    AND misc.lifecyclestate != 'deleted'
+               INNER JOIN hierarchy on hierarchy.name = relation.subjectcsid
+),
+related_summaries AS (
+       SELECT DISTINCT ON (objs.repatriation_csid, hierarchy.id) objs.objectcsid,
+               objs.repatriation_csid,
+               hierarchy.id as summary_id,
+               relation.subjectcsid as summary_csid
+       FROM related_objects objs
+               INNER join relations_common relation on relation.objectcsid = objs.objectcsid
+               AND relation.subjectdocumenttype = 'SummaryDocumentation'
+    INNER JOIN misc ON misc.id = relation.id
+    AND misc.lifecyclestate != 'deleted'
+               INNER JOIN hierarchy on hierarchy.name = relation.subjectcsid
+)
+SELECT rr.requestnumber,
+  rr.requestdate,
+  rr.title,
+  coalesce(partiesinvolved.onbehalfof, '{}') AS onbehalfof,
+  coalesce(culturalgroup.cultures, '{}') AS cultures,
+  coalesce(object_count.mni_count, 0) AS mni_count,
+  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(inventories.titles, '{}') AS inventory_titles,
+  coalesce(inventory_count.count, 0) AS inventory_count,
+  coalesce(summaries.titles, '{}') AS summary_titles,
+  coalesce(summary_count.count, 0) AS summary_count,
+  coalesce(consultations.log_total, 0) AS log_total
+FROM hierarchy rr_hierarchy
+       INNER JOIN misc ON misc.id = rr_hierarchy.id AND misc.lifecyclestate != 'deleted'
+       INNER JOIN repatriationrequests_common rr ON rr.id = rr_hierarchy.id
+       LEFT JOIN (
+               SELECT hierarchy.parentid,
+                       array_agg(party.involvedonbehalfof) as onbehalfof
+               FROM hierarchy
+                       INNER JOIN partiesinvolvedgroup party ON party.id = hierarchy.id
+               WHERE hierarchy.name = 'repatriationrequests_common:partiesInvolvedGroupList'
+               GROUP BY hierarchy.parentid
+       ) partiesinvolved ON partiesinvolved.parentid = rr_hierarchy.id
+       LEFT JOIN (
+               SELECT hierarchy.parentid,
+                array_agg(culturalgroup.culture) AS cultures
+               FROM hierarchy
+                       INNER JOIN culturalgroup ON culturalgroup.id = hierarchy.id
+                       AND hierarchy.name = 'repatriationrequests_common:culturalGroupList'
+               GROUP BY hierarchy.parentid
+       ) culturalgroup ON culturalgroup.parentid = rr_hierarchy.id --LEFT JOIN LATERAL (
+       LEFT JOIN LATERAL (
+               -- Related Object data
+               -- 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,
+                       sum(
+                               CASE
+                                       WHEN ocg.objectcounttype ~ 'minimum' THEN ocg.objectcount
+                                       ELSE 0
+                               END
+                       ) AS mni_count,
+                       sum(
+                               CASE
+                                       WHEN ocg.objectcounttype ~ '\yassociated' THEN ocg.objectcount
+                                       ELSE 0
+                               END
+                       ) AS afo_count,
+                       sum(
+                               CASE
+                                       WHEN ocg.objectcounttype ~ 'unassociated' THEN ocg.objectcount
+                                       ELSE 0
+                               END
+                       ) AS ufo_count,
+                       sum(
+                               CASE
+                                       WHEN ocg.objectcounttype ~ 'ethnographic' THEN ocg.objectcount
+                                       ELSE 0
+                               END
+                       ) AS ethnographic_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 = rr_hierarchy.name
+  LEFT JOIN (
+    -- Related NAGPRA Inventory (Claim -> Object -> Inventory)
+    -- Number of associated NAGPRA inventory records.
+    SELECT related_inventories.repatriation_csid,
+      count(related_inventories.inventory_id)
+    FROM related_inventories
+    GROUP BY related_inventories.repatriation_csid
+  ) inventory_count ON inventory_count.repatriation_csid = rr_hierarchy.name
+       LEFT JOIN (
+               -- Related NAGPRA Inventory (Claim -> Object -> Inventory)
+               -- Inventory Title: Pull titles for all inventories related to the related objects, concatenate into one field separated by a ;
+               SELECT related_inventories.repatriation_csid,
+                       array_agg(title.item) as titles
+               FROM nagprainventories_common inventory
+                       INNER JOIN related_inventories on related_inventories.inventory_id = inventory.id
+                       LEFT JOIN nagprainventories_common_titles title on title.id = inventory.id
+               GROUP BY related_inventories.repatriation_csid
+       ) inventories ON inventories.repatriation_csid = rr_hierarchy.name
+  LEFT JOIN (
+    -- Related Summary Documentation (Claim -> Object -> Summary Documentation)
+    -- Number of associated Summary records.
+    SELECT related_summaries.repatriation_csid,
+      count(related_summaries.summary_id)
+    FROM related_summaries
+    GROUP BY related_summaries.repatriation_csid
+  ) summary_count ON summary_count.repatriation_csid = rr_hierarchy.name
+       LEFT JOIN (
+               -- Related Summary Documentation (Claim -> Object -> Summary Documentation)
+               -- Summary Title: Pull titles for all summaries related to objects, concatenate into one field separated by a ;
+               SELECT related_summaries.repatriation_csid,
+                       array_agg(title.item) as titles
+               FROM summarydocumentations_common summary
+                       INNER JOIN related_summaries on related_summaries.summary_id = summary.id
+                       LEFT JOIN summarydocumentations_common_titles title on title.id = summary.id
+               GROUP BY related_summaries.repatriation_csid
+       ) summaries ON summaries.repatriation_csid = rr_hierarchy.name
+       LEFT JOIN (
+               -- Related Consultations (Claim -> Consultation)
+               -- Number of Consultation Log Entries. Consultations related to the Claim record, pull a count of how many entries are in the log.
+               SELECT relation.subjectcsid,
+                       count(cl_hierarchy.pos) AS log_total
+               FROM relations_common relation
+                       INNER JOIN misc ON misc.id = relation.id
+                       AND misc.lifecyclestate != 'deleted'
+                       INNER JOIN hierarchy consultation_hierarchy ON consultation_hierarchy.name = relation.objectcsid
+                       INNER JOIN hierarchy cl_hierarchy ON cl_hierarchy.parentid = consultation_hierarchy.id
+                       AND cl_hierarchy.name = 'consultations_common:consultationLogGroupList'
+               WHERE relation.objectdocumenttype = 'Consultation'
+                       AND relation.subjectdocumenttype = 'RepatriationRequest'
+                       $P!{whereclause_cte}
+               GROUP BY relation.subjectcsid
+       ) consultations ON consultations.subjectcsid = rr_hierarchy.name
+       $P!{whereclause}]]>
+       </queryString>
+       <field name="requestnumber" class="java.lang.String">
+               <property name="com.jaspersoft.studio.field.name" value="requestnumber" />
+               <property name="com.jaspersoft.studio.field.label" value="requestnumber" />
+               <property name="com.jaspersoft.studio.field.tree.path" value="repatriationrequests_common" />
+       </field>
+       <field name="requestdate" class="java.sql.Timestamp">
+               <property name="com.jaspersoft.studio.field.name" value="requestdate" />
+               <property name="com.jaspersoft.studio.field.label" value="requestdate" />
+               <property name="com.jaspersoft.studio.field.tree.path" value="repatriationrequests_common" />
+       </field>
+       <field name="title" class="java.lang.String">
+               <property name="com.jaspersoft.studio.field.name" value="title" />
+               <property name="com.jaspersoft.studio.field.label" value="title" />
+               <property name="com.jaspersoft.studio.field.tree.path" value="repatriationrequests_common" />
+       </field>
+       <field name="onbehalfof" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="onbehalfof" />
+               <property name="com.jaspersoft.studio.field.label" value="onbehalfof" />
+       </field>
+       <field name="cultures" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="cultures" />
+               <property name="com.jaspersoft.studio.field.label" value="cultures" />
+       </field>
+       <field name="mni_count" class="java.math.BigDecimal">
+               <property name="com.jaspersoft.studio.field.name" value="mni_count" />
+               <property name="com.jaspersoft.studio.field.label" value="mni_count" />
+       </field>
+       <field name="afo_count" class="java.math.BigDecimal">
+               <property name="com.jaspersoft.studio.field.name" value="afo_count" />
+               <property name="com.jaspersoft.studio.field.label" value="afo_count" />
+       </field>
+       <field name="ufo_count" class="java.math.BigDecimal">
+               <property name="com.jaspersoft.studio.field.name" value="ufo_count" />
+               <property name="com.jaspersoft.studio.field.label" value="ufo_count" />
+       </field>
+       <field name="ethnographic_count" class="java.math.BigDecimal">
+               <property name="com.jaspersoft.studio.field.name" value="ethnographic_count" />
+               <property name="com.jaspersoft.studio.field.label" value="ethnographic_count" />
+       </field>
+       <field name="inventory_titles" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="inventory_titles" />
+               <property name="com.jaspersoft.studio.field.label" value="inventory_titles" />
+       </field>
+       <field name="inventory_count" class="java.lang.Long">
+               <property name="com.jaspersoft.studio.field.name" value="inventory_count" />
+               <property name="com.jaspersoft.studio.field.label" value="inventory_count" />
+       </field>
+       <field name="summary_titles" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="summary_titles" />
+               <property name="com.jaspersoft.studio.field.label" value="summary_titles" />
+       </field>
+       <field name="summary_count" class="java.lang.Long">
+               <property name="com.jaspersoft.studio.field.name" value="summary_count" />
+               <property name="com.jaspersoft.studio.field.label" value="summary_count" />
+       </field>
+       <field name="log_total" class="java.lang.Long">
+               <property name="com.jaspersoft.studio.field.name" value="log_total" />
+               <property name="com.jaspersoft.studio.field.label" value="log_total" />
+       </field>
+       <background>
+               <band splitType="Stretch" />
+       </background>
+       <columnHeader>
+               <band height="44" 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">
+                                       <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">
+                                       <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">
+                                       <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">
+                                       <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">
+                                       <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">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[AFO Lot Count]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="600" y="0" width="100" height="44" 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">
+                                       <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">
+                                       <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">
+                                       <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">
+                                       <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">
+                                       <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">
+                                       <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">
+                                       <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>
+               <band height="66" splitType="Stretch">
+                       <property name="com.jaspersoft.studio.unit.height" value="px" />
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="0" y="0" width="100" height="30" uuid="064b56f8-1692-495a-a537-4ef6461cfc6d">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <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="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>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="200" y="0" width="100" height="30" uuid="f7d5770e-a729-457b-a39f-9b1f05c980d3">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{requestnumber}]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="300" y="0" width="100" height="30" uuid="4f536bed-b62a-4a53-97ce-81f1fafc0c94">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{title}]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="400" y="0" width="100" height="30" uuid="460dc3a8-b239-4472-b2a3-1bb8be0980e9">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{mni_count}]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="500" y="0" width="100" height="30" uuid="43c1f876-745f-4f14-9c08-8cee4b02575a">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{afo_count}]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="600" y="0" width="100" height="30" uuid="9f75ab33-ec3b-42fd-a1be-16caa9254291">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{ufo_count}]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="700" y="0" width="100" height="30" uuid="91f7ab7a-d0c4-4d79-af7c-372fb8222baa">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{ethnographic_count}]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="800" y="0" width="100" height="30" uuid="68f1bf63-5f1a-497e-a132-af81b2634348">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <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">
+                                       <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">
+                                       <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">
+                                       <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">
+                                       <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">
+                                       <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>
diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/repatriation_request_consultation.xml b/services/report/3rdparty/jasper-cs-report/src/main/resources/repatriation_request_consultation.xml
new file mode 100644 (file)
index 0000000..874e01d
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<document name="report">
+  <ns2:reports_common xmlns:ns2="http://collectionspace.org/services/report">
+    <name>Repatriation Request Consultation</name>
+    <notes>Placeholder</notes>
+    <forDocTypes>
+      <forDocType>RepatriationRequest</forDocType>
+    </forDocTypes>
+    <supportsSingleDoc>false</supportsSingleDoc>
+    <supportsDocList>true</supportsDocList>
+    <supportsGroup>false</supportsGroup>
+    <supportsNoContext>false</supportsNoContext>
+    <filename>repatriation_request_consultation.jrxml</filename>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
+  </ns2:reports_common>
+</document>
diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/summary_documentation_consultation.jrxml b/services/report/3rdparty/jasper-cs-report/src/main/resources/summary_documentation_consultation.jrxml
new file mode 100644 (file)
index 0000000..0aff9ca
--- /dev/null
@@ -0,0 +1,471 @@
+<?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="summary_documentation_consultation" language="javascript" pageWidth="1500" pageHeight="800" orientation="Landscape" columnWidth="100" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isIgnorePagination="true" uuid="e9c71592-7651-43d3-b4ac-6eea5e049ac0">
+       <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" />
+       <property name="com.jaspersoft.studio.data.sql.SQLQueryDesigner.sash.w2" value="800" />
+       <property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w1" value="625" />
+       <property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w2" value="361" />
+       <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,summary_types,sites,exit_owners,status"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="tenantid" class="java.lang.String" isForPrompting="false">
+               <defaultValueExpression><![CDATA["1"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="csidlist" class="java.lang.String" isForPrompting="false" />
+       <parameter name="csids" class="java.lang.String" isForPrompting="false">
+               <defaultValueExpression><![CDATA[$P{csidlist} != null ? ("'" + $P{csidlist}.replace(/,/g, "','") + "'") : "NOVALUE"]]></defaultValueExpression>
+       </parameter>
+       <parameter name="whereclause_relation" class="java.lang.String" isForPrompting="false">
+               <defaultValueExpression><![CDATA[$P{csids} != "NOVALUE" ? ( "AND relation.subjectcsid IN (" + $P{csids} + ")" ) : ""]]></defaultValueExpression>
+       </parameter>
+       <parameter name="whereclause" class="java.lang.String" isForPrompting="false">
+               <defaultValueExpression><![CDATA[$P{csids} != "NOVALUE" ? ( "WHERE summary_hierarchy.name IN (" + $P{csids} + ")" ) : ""]]></defaultValueExpression>
+       </parameter>
+       <queryString language="SQL">
+               <![CDATA[WITH related_objects AS (
+       SELECT hierarchy.id as object_id,
+               relation.objectcsid,
+               relation.subjectcsid as repatriation_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'
+       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,
+               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'
+)
+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
+FROM hierarchy summary_hierarchy
+       INNER JOIN misc ON misc.id = summary_hierarchy.id
+       AND misc.lifecyclestate != 'deleted'
+       INNER JOIN summarydocumentations_common summary ON summary.id = summary_hierarchy.id
+       LEFT JOIN (
+               -- Summary title
+               SELECT title.id AS summary_id,
+                       array_agg(title.item) AS titles
+               FROM summarydocumentations_common_titles title
+               GROUP BY title.id
+       ) titles ON titles.summary_id = summary_hierarchy.id
+       LEFT JOIN (
+               -- Summary types
+               SELECT summarytype.id AS summary_id,
+                       array_agg(summarytype.item) AS summary_types
+               FROM summarydocumentations_common_types summarytype
+               GROUP BY summarytype.id
+       ) summarytypes ON summarytypes.summary_id = summary_hierarchy.id
+       LEFT JOIN (
+               -- Organizations pulled from on behalf field on Summary record
+               SELECT hierarchy.parentid,
+                       array_agg(party.involvedonbehalfof) as onbehalfof
+               FROM hierarchy
+                       INNER JOIN partiesinvolvedgroup party ON party.id = hierarchy.id
+               WHERE hierarchy.name = 'summarydocumentations_common:partiesInvolvedGroupList'
+               GROUP BY hierarchy.parentid
+       ) partiesinvolved ON partiesinvolved.parentid = summary_hierarchy.id
+       LEFT JOIN (
+               SELECT hierarchy.parentid,
+                       array_agg(culturalgroup.culture) AS cultures
+               FROM hierarchy
+                       INNER JOIN culturalgroup ON culturalgroup.id = hierarchy.id
+                       AND hierarchy.name = 'summarydocumentations_common:culturalGroupList'
+               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
+       LEFT JOIN (
+               -- Current Status: most recent
+               SELECT DISTINCT ON (hierarchy.parentid) hierarchy.parentid,
+                       status_group.status,
+                       status_group.statusdate
+               FROM hierarchy
+                       INNER JOIN statusgroup status_group ON status_group.id = hierarchy.id
+               WHERE hierarchy.name = 'summarydocumentations_common:statusGroupList'
+               ORDER BY hierarchy.parentid,
+                       status_group.statusdate DESC NULLS LAST
+       ) summary_status ON summary_status.parentid = summary_hierarchy.id
+       LEFT JOIN LATERAL (
+               -- Related Object - Object Count
+               -- 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,
+                       sum(
+                               CASE
+                                       WHEN ocg.objectcounttype ~ 'sacred_object' THEN ocg.objectcount
+                                       ELSE 0
+                               END
+                       ) AS sacred_object_count,
+                       sum(
+                               CASE
+                                       WHEN ocg.objectcounttype ~ 'unassociated_funerary' THEN ocg.objectcount
+                                       ELSE 0
+                               END
+                       ) AS ufo_count,
+                       sum(
+                               CASE
+                                       WHEN ocg.objectcounttype ~ 'cultural_patrimony' THEN ocg.objectcount
+                                       ELSE 0
+                               END
+                       ) AS cultural_patrimony_count,
+                       sum(
+                               CASE
+                                       WHEN ocg.objectcounttype ~ 'lineal_descendent' THEN ocg.objectcount
+                                       ELSE 0
+                               END
+                       ) AS lineal_descendent_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
+       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.
+               SELECT relation.subjectcsid,
+                       count(cl_hierarchy.pos) AS log_total
+               FROM relations_common relation
+                       INNER JOIN misc ON misc.id = relation.id
+                       AND misc.lifecyclestate != 'deleted'
+                       INNER JOIN hierarchy consultation_hierarchy ON consultation_hierarchy.name = relation.objectcsid
+                       INNER JOIN hierarchy cl_hierarchy ON cl_hierarchy.parentid = consultation_hierarchy.id
+                       AND cl_hierarchy.name = 'consultations_common:consultationLogGroupList'
+               WHERE relation.objectdocumenttype = 'Consultation'
+                       AND relation.subjectdocumenttype = 'SummaryDocumentation'
+                       $P!{whereclause_relation}
+               GROUP BY relation.subjectcsid
+       ) consultations ON consultations.subjectcsid = summary_hierarchy.name
+       LEFT JOIN (
+               -- Related Object Exits (Object -> ObjectExit (New))
+               -- 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,
+                       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
+       $P!{whereclause}]]>
+       </queryString>
+       <field name="documentationnumber" class="java.lang.String">
+               <property name="com.jaspersoft.studio.field.name" value="documentationnumber" />
+               <property name="com.jaspersoft.studio.field.label" value="documentationnumber" />
+               <property name="com.jaspersoft.studio.field.tree.path" value="summarydocumentations_common" />
+       </field>
+       <field name="originationdate" class="java.sql.Timestamp">
+               <property name="com.jaspersoft.studio.field.name" value="originationdate" />
+               <property name="com.jaspersoft.studio.field.label" value="originationdate" />
+               <property name="com.jaspersoft.studio.field.tree.path" value="summarydocumentations_common" />
+       </field>
+       <field name="titles" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="titles" />
+               <property name="com.jaspersoft.studio.field.label" value="titles" />
+       </field>
+       <field name="summary_types" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="summary_types" />
+               <property name="com.jaspersoft.studio.field.label" value="summary_types" />
+       </field>
+       <field name="onbehalfof" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="onbehalfof" />
+               <property name="com.jaspersoft.studio.field.label" value="onbehalfof" />
+       </field>
+       <field name="cultures" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="cultures" />
+               <property name="com.jaspersoft.studio.field.label" value="cultures" />
+       </field>
+       <field name="status" class="java.lang.String">
+               <property name="com.jaspersoft.studio.field.name" value="status" />
+               <property name="com.jaspersoft.studio.field.label" value="status" />
+               <property name="com.jaspersoft.studio.field.tree.path" value="statusgroup" />
+       </field>
+       <field name="statusdate" class="java.sql.Timestamp">
+               <property name="com.jaspersoft.studio.field.name" value="statusdate" />
+               <property name="com.jaspersoft.studio.field.label" value="statusdate" />
+               <property name="com.jaspersoft.studio.field.tree.path" value="statusgroup" />
+       </field>
+       <field name="sacred_object_count" class="java.math.BigDecimal">
+               <property name="com.jaspersoft.studio.field.name" value="sacred_object_count" />
+               <property name="com.jaspersoft.studio.field.label" value="sacred_object_count" />
+       </field>
+       <field name="ufo_count" class="java.math.BigDecimal">
+               <property name="com.jaspersoft.studio.field.name" value="ufo_count" />
+               <property name="com.jaspersoft.studio.field.label" value="ufo_count" />
+       </field>
+       <field name="cultural_patrimony_count" class="java.math.BigDecimal">
+               <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>
+       <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>
+       <field name="log_total" class="java.lang.Long">
+               <property name="com.jaspersoft.studio.field.name" value="log_total" />
+               <property name="com.jaspersoft.studio.field.label" value="log_total" />
+       </field>
+       <field name="exit_owners" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="exit_owners" />
+               <property name="com.jaspersoft.studio.field.label" value="exit_owners" />
+       </field>
+       <field name="exit_dates" class="java.sql.Array">
+               <property name="com.jaspersoft.studio.field.name" value="exit_dates" />
+               <property name="com.jaspersoft.studio.field.label" value="exit_dates" />
+       </field>
+       <background>
+               <band splitType="Stretch" />
+       </background>
+       <columnHeader>
+               <band height="44" 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="b8cd41b4-34e5-455f-81fc-97800f4ae9b7">
+                                       <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="539fd511-8c4c-4f20-ac0f-1b71fdc26939">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Summary Documentation Origination Date]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="200" y="0" width="100" height="44" uuid="9741cf97-9acc-45aa-bab2-90a03cf29e83">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Summary Documentation Number]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="300" y="0" width="100" height="44" uuid="65b98683-6871-48ec-a4c4-553e41f1b26b">
+                                       <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="400" y="0" width="100" height="44" uuid="02898623-0732-4b3d-abe6-948350332361">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Summary Documentation - Summary Status]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="500" y="0" width="100" height="44" uuid="a0f54698-7f5f-4d08-8286-f86c412fa876">
+                                       <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="600" y="0" width="100" height="44" uuid="9afbf556-a4f6-4041-97a9-ac9f106aa75e">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Objects of Cultural Patrimony Count]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="700" y="0" width="100" height="44" uuid="679eb6c6-e454-47d1-8320-1a723dabf0a1">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Sacred Object Count]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="800" y="0" width="100" height="44" uuid="f9a1fb86-9c78-48ba-942e-e35417916eeb">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Lineal Descendent Count]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="900" y="0" width="100" height="44" uuid="c2e6ccf4-0900-400d-a6f4-4ea0fc9bb95a">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[NAGPRA Category Type(s)]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="1000" y="0" width="100" height="44" uuid="52cec6c0-596a-47f6-877a-fa0a4227e55d">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Site(s) Related to Summary]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="1100" y="0" width="100" height="44" uuid="c361bc9c-e677-4a74-a59e-695ba9eddbaa">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Culture(s) Related to Summary]]></text>
+                       </staticText>
+                       <staticText>
+                               <reportElement style="Column header" x="1200" y="0" width="100" height="44" uuid="f6441c8d-82a9-4908-94c0-b57be2d22746">
+                                       <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="1300" y="0" width="100" height="44" uuid="17fc9356-5a96-4aa4-915a-cf18a83bc614">
+                                       <property name="com.jaspersoft.studio.unit.width" value="px" />
+                               </reportElement>
+                               <textElement markup="styled" />
+                               <text><![CDATA[Exit Record Current Owner with Exit Date]]></text>
+                       </staticText>
+               </band>
+       </columnHeader>
+       <detail>
+               <band height="66" splitType="Stretch">
+                       <property name="com.jaspersoft.studio.unit.height" value="px" />
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <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>
+                       </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>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="200" y="0" width="100" height="30" uuid="0138ed1b-1e54-4d27-92f4-1e42769adbcb">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{documentationnumber}]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <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>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="400" y="0" width="100" height="30" uuid="637dac22-c0a3-4c77-b323-f15f65b5bdf7">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression>
+                                       <![CDATA[
+                                               var status = $F{status} !== null ? $F{status} : '';
+                                               var date = $F{statusdate} !== null ? java.lang.String.format("(%tF)", $F{statusdate}) : '';
+                                               status + " " + date;
+                                       ]]>
+                               </textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="500" y="0" width="100" height="30" uuid="9bada286-6f81-4548-bc77-669a0973da26">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{ufo_count}]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="600" y="0" width="100" height="30" uuid="6619c361-ae3e-4f49-9f9e-492cc307ca30">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{cultural_patrimony_count}]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="700" y="0" width="100" height="30" uuid="bebdb2bf-297a-477b-a03b-88e5e15fb0f6">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression><![CDATA[$F{sacred_object_count}]]></textFieldExpression>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <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>
+                       </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>
+                       </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>
+                       </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>
+                       </textField>
+                       <textField textAdjust="StretchHeight" isBlankWhenNull="true">
+                               <reportElement style="Detail" x="1200" y="0" width="100" height="30" uuid="54b06775-91a6-4b74-a747-a7977e5943fb">
+                                       <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="1300" y="0" width="100" height="30" uuid="04107479-6227-4b31-b0b5-50316e4d3426">
+                                       <property name="com.jaspersoft.studio.unit.y" value="px" />
+                               </reportElement>
+                               <textFieldExpression>
+                                       <![CDATA[
+                                               var dates = $F{exit_dates}.getArray();
+                                               $F{exit_owners}.getArray().map(function(owner, index) {
+                                                       if (!owner) {
+                                                               return null;
+                                                       }
+                                                       return dates[index] === null ? owner : java.lang.String.format("%s (%tF)", owner, dates[index]);
+                                               }).filter(owner => !!owner).join('; ')
+                                       ]]>
+                               </textFieldExpression>
+                       </textField>
+               </band>
+       </detail>
+</jasperReport>
\ No newline at end of file
diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/summary_documentation_consultation.xml b/services/report/3rdparty/jasper-cs-report/src/main/resources/summary_documentation_consultation.xml
new file mode 100644 (file)
index 0000000..310be5d
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<document name="report">
+  <ns2:reports_common xmlns:ns2="http://collectionspace.org/services/report">
+    <name>Summary Documentation Consultation</name>
+    <notes>Placeholder</notes>
+    <forDocTypes>
+      <forDocType>SummaryDocumentation</forDocType>
+    </forDocTypes>
+    <supportsSingleDoc>false</supportsSingleDoc>
+    <supportsDocList>true</supportsDocList>
+    <supportsGroup>false</supportsGroup>
+    <supportsNoContext>false</supportsNoContext>
+    <filename>summary_documentation_consultation.jrxml</filename>
+    <outputMIME>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</outputMIME>
+  </ns2:reports_common>
+</document>