Spike: [ERM-4015] Investigate table structure for Agreements and agreement lines

Spike: [ERM-4015] Investigate table structure for Agreements and agreement lines

Agreement / Agreement Line FQM Spike

Summary

To expose Agreements and Agreement Lines as queryable entity types in mod-fqm-manager, the following needs to be added. Per-column field design, FQM property choices (essential, visibleByDefault, datatypes, value functions), and exact permission strings will be settled during implementation.


Scope

  • Draft simple ETs for Agreement and Agreement Line, plus the two composite ETs that combine them with supporting children.

  • The supporting simple ETs (period, org, internal_contact, remote_license_link, po_line_proxy) are not standalone deliverables but are required as entity-type sources for the composites.


Files to Create

1. DB source views

Path: src/main/resources/db/source-views/bundled/agreements/mod-agreements/. Each is a thin SELECT * over a mod-agreements table; trivial to author.

View

Underlying table

Consumed by

View

Underlying table

Consumed by

src_agr_subscription_agreement

subscription_agreement

simple_agreements_agreement

src_agr_entitlement

entitlement

simple_agreements_agreement_line

src_agr_erm_resource

erm_resource

simple_agreements_agreement_line

src_agr_period

period

simple_agreements_period

src_agr_subscription_agreement_org

subscription_agreement_org

simple_agreements_org

src_agr_org

org

simple_agreements_org

src_agr_internal_contact

internal_contact

simple_agreements_internal_contact

src_agr_remote_license_link

remote_license_link

simple_agreements_remote_license_link

src_agr_po_line_proxy

po_line_proxy

simple_agreements_po_line_proxy

src_agr_refdata_value

refdata_value

every simple ET that has enumerated columns

Total: 10 views.

2. Simple entity types

Path: src/main/resources/entity-types/agreements/. One root view per ET, plus LEFT JOINs to src_agr_refdata_value for each enumerated column.

Simple ET

Purpose

Refdata joins

Cross-module / inter-simple joinsTo

Simple ET

Purpose

Refdata joins

Cross-module / inter-simple joinsTo

simple_agreements_agreement

Agreement (subscription_agreement) core

6 (status, type, renewal priority, perpetual flag, content review, reason for closure)

sa_vendor_fk -> simple_agreements_org

simple_agreements_agreement_line

Agreement Line (entitlement) core

2 (resource type, resource sub-type — via erm_resource)

ent_owner_fk -> simple_agreements_agreement

simple_agreements_period

Renewal periods

0

per_owner -> simple_agreements_agreement

simple_agreements_org

Agreement ↔ vendor link

1 (role)

sao_owner_fk -> simple_agreements_agreement;
org_orgs_uuid -> simple_organization (mod-organizations)

simple_agreements_internal_contact

Internal contact (user + role)

1 (role)

ic_owner_fk → simple_agreements_agreement;
ic_user_fk -> simple_user_details (mod-users)

simple_agreements_remote_license_link

Linked license (mod-licenses)

1 (status)

rll_owner -> simple_agreements_agreement

simple_agreements_po_line_proxy

Agreement Line ↔ POL link

0

pop_owner → simple_agreements_agreement_line;
pop_po_line_id -> simple_purchase_order_line (mod-orders)

Total: 7 simple ETs.

3. Composite entity types

Path: src/main/resources/entity-types/agreements/. Each composite reuses the simple ETs above through entity-type sources.

Composite ET

Sources

Composite ET

Sources

composite_agreement_with_lines

agreement, agreement_line, period, agreement_org, simple_organization (cross-module), internal_contact, simple_user_details (cross-module), remote_license_link, po_line_proxy

composite_agreement_with_lines_and_order_invoice_analytics

agreement, agreement_line, po_line_proxy, composite_order_invoice_analytics (cross-module), simple_organization (cross-module, as agreement_vendor)

Total: 2 composite ETs.

4. Translations

translations/mod-fqm-manager/en.json only — one key per ET, per composite source alias, and per column. Other locales fall back to en.json. Estimated ~110–130 new keys.


Construction Order

  1. All 10 source views (no inter-dependencies).

  2. Simple ETs in dependency order: simple_agreements_agreement -> simple_agreements_agreement_line -> period / org / internal_contact / remote_license_link / po_line_proxy.

  3. composite_agreement_with_lines.

  4. composite_agreement_with_lines_and_order_invoice_analytics.

  5. Translations: incremental per ET, single en.json edit at the end is fine.


Epic Coverage

Sample query

Satisfied by

Sample query

Satisfied by

Invoices for a given agreement line

composite_agreement_with_lines_and_order_invoice_analytics

Agreements / lines for a given vendor

composite_agreement_with_lines (via agreement_orgsimple_organization) or composite B (via agreement_vendor)

Agreements / lines for a given fund

composite_agreement_with_lines_and_order_invoice_analytics (via composite_order_invoice_analytics → fund distribution)