ores.refdata.business_unit
Table of Contents
Represents internal organizational units (e.g., desks, departments, branches). Supports hierarchical structure via self-referencing parent_business_unit_id. Each unit belongs to a top-level legal entity (party).
Flags
Columns
id
UUID uniquely identifying this business unit.
Surrogate key for the business unit record.
party_id
Top-level legal entity this unit belongs to.
References the parent party record.
uuid_gen()
unit_name
Human-readable name for the business unit.
e.g., 'FX Options Desk', 'London Branch'.
faker::company::companyName() + " Desk"
parent_business_unit_id
Self-referencing parent unit for hierarchy.
NULL indicates a top-level unit.
std::nullopt
unit_code
Optional internal code or alias.
Short identifier for the business unit.
std::string("DESK") + std::to_string(idx)
business_centre_code
Business centre for the unit.
References the business centres scheme. May be null for global units.
// WRLD is the only business centre guaranteed seeded by the base // bootstrap (a real FpML city code like GBLO only exists once the // large, optional FpML business-centre reference dataset is loaded -- // see the same reasoning in ores.refdata.party.org). std::string("WRLD")
unit_type_id
Classification type for this business unit.
Optional FK to business_unit_type. When set, the level of this unit's type must be strictly greater than its parent's type level (if the parent also has a type set).
std::nullopt
status
Current lifecycle status (Active, Inactive, Closed).
std::string("Active")
SQL
Flags
Foreign keys
party_id
parent_business_unit_id
Insert trigger
Validations
| column | validation_function |
|---|---|
| business_centre_code | ores_refdata_validate_business_centre_fn |
| unit_type_id | ores_refdata_validate_business_unit_type_fn |
-- Level constraint: when both parent and child have a type, child level > parent level if NEW.unit_type_id is not null and NEW.parent_business_unit_id is not null then declare v_parent_type_id uuid; v_parent_level integer; v_child_level integer; begin select unit_type_id into v_parent_type_id from ores_refdata_business_units_tbl where tenant_id = NEW.tenant_id and id = NEW.parent_business_unit_id and valid_to = ores_utility_infinity_timestamp_fn(); if v_parent_type_id is not null then select level into v_parent_level from ores_refdata_business_unit_types_tbl where tenant_id = NEW.tenant_id and id = v_parent_type_id and valid_to = ores_utility_infinity_timestamp_fn(); select level into v_child_level from ores_refdata_business_unit_types_tbl where tenant_id = NEW.tenant_id and id = NEW.unit_type_id and valid_to = ores_utility_infinity_timestamp_fn(); if v_child_level <= v_parent_level then raise exception 'Business unit type level % cannot be contained by a unit of the same or higher level %. Parent level must be strictly less than child level.', v_child_level, v_parent_level using errcode = '23514'; end if; end if; end; end if;
C++
Flags
Note: the plan this flag traces to (task_apply_safe_drift.org) named
unit_code as the find-by-code column, but unit_code is nullable and
not part of the natural key – (party_id, unit_name) is. Using
unit_name (with party_id) instead keeps the lookup unambiguous.
Repository
Domain includes
#include <chrono> #include <optional> #include <string> #include <boost/uuid/uuid.hpp>
Entity includes
#include <string> #include "sqlgen/Timestamp.hpp" #include "sqlgen/PrimaryKey.hpp"
Conventions
Table display
| column | header |
|---|---|
| party_id | Party |
| unit_name | Unit Name |
| unit_code | Code |
| business_centre_code | Business Centre |
| status | Status |
| modified_by | Modified By |
| version | Version |
Qt
Detail fields
| field | label | widget | type | is_key | is_required | placeholder | combo_domain_type | combo_display_field | combo_fetch_include | combo_fetch_fn | combo_watcher_name | combo_code_field | combo_tooltip_field | combo_sort_field | combo_label | combo_setter_pascal | combo_values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| unit_code | Unit Code | codeEdit | line_edit | true | false | Enter unit code | |||||||||||
| unit_name | Unit Name | nameEdit | line_edit | true | Enter unit name | ||||||||||||
| business_centre_code | Business Centre | businessCentreEdit | line_edit | Enter business centre code | |||||||||||||
| status | Status | statusCombo | static_combo | Active,Inactive,Closed | |||||||||||||
| unit_type_id | Unit Type | unitTypeCombo | dynamic_combo | refdata::domain::business_unit_type | name | ores.qt/LookupFetcher.hpp | fetch_business_unit_types | unitTypeWatcher | id | description | level | business unit types | UnitTypeCombo |
Columns (Qt model)
| enum_name | field | header | type | width |
|---|---|---|---|---|
| UnitCode | unit_code | Code | string | 120 |
| UnitName | unit_name | Name | string | 250 |
| BusinessCentreCode | business_centre_code | Business Centre | string | 130 |
| Status | status | Status | string | 100 |
| Version | version | Version | int | 80 |
| ModifiedBy | modified_by | Modified By | string | 120 |
| RecordedAt | recorded_at | Recorded At | timestamp | 150 |
Icon columns (Qt model)
| column | accessor | field1 | field2 |
|---|---|---|---|
| BusinessCentreCode | business_centre_flag_icon | business_centre_code |
Custom repository methods
See also
- ores.refdata — component group overview.