---
title: Module Architecture & Dependencies
aliases: [modules, cross-module, multi-module, module boundaries]
sources: [sources/sessions/2026-04-20-print-layouts-modules-sync.md]
last_updated: 2026-04-20
status: draft
---

# Module Architecture & Dependencies

The CG Mobile App organizes contracts into ~48 top-level modules under `src/`. Modules communicate through cross-references in Process flows and BO declarations.

## Module List (Key Modules)

| Module              | Purpose                                            |
| ------------------- | -------------------------------------------------- |
| **Application**     | Entry point, cockpits, navigation hub              |
| **Visit**           | Visit/appointment management                       |
| **Call**            | Call execution, questions, assessments             |
| **Order**           | Order creation, items, pricing                     |
| **BusinessPartner** | Customer/account management                        |
| **Product**         | Product catalog, pricing                           |
| **Promotion**       | Promotions, tactics, rewards                       |
| **Todo**            | Task management                                    |
| **Customer Issue**  | Service requests                                   |
| **Utilities**       | Shared helper BOs (cockpit controllers, geo, sync) |
| **System**          | System settings, calendars, release process        |
| **User**            | User settings, roles, preferences                  |
| **Sync**            | Replication callbacks, sync UI                     |
| **Tour Management** | Tour planning, vehicle, routes                     |
| **Inventory**       | Stock management, warehouse                        |
| **Daily Report**    | Time entry, daily reports                          |
| **RetailStore**     | Store details, locations                           |

## Architecture Pattern: Hub-and-Spoke

```
                    ┌──────────────┐
         ┌─────────│  Application │──────────┐
         │         └──────────────┘          │
         ▼              ▼            ▼       ▼
    ┌─────────┐   ┌─────────┐  ┌────────┐ ┌──────┐
    │  Visit  │   │  Order  │  │Product │ │ Todo │
    └────┬────┘   └────┬────┘  └────────┘ └──────┘
         │              │
         ▼              ▼
  ┌──────────────┐  ┌───────────┐
  │BusinessPartner│  │ Inventory │
  └──────────────┘  └───────────┘

         ┌───────────────┐
         │   Utilities   │  ← shared helpers for all
         └───────────────┘
```

## Cross-Module Reference Mechanisms

### 1. Process Invocation (Module::ProcessName)

```xml
<Action actionType="PROCESS" process="Order::LoadProcess">
  <Parameters>
    <Input name="MainPKey" value="Event.pKey" />
  </Parameters>
  <ReturnValues>
    <Return name="ProcessContext::Result" value="TriggerReload" />
  </ReturnValues>
</Action>
```

Any process can invoke any other module's process using the `Module::ProcessName` namespace.

### 2. Object References in BO XML

```xml
<!-- ObjectLookup from another module -->
<ObjectLookup name="luCustomer" objectClass="LuCustomer"
              dataSourceProperty="customerPKey" lookupProperty="pKey"
              loadMode="LoadImmediate" />

<!-- NestedObject from another module -->
<NestedObject name="boWorkflow" objectClass="BoWorkflow"
              dataSourceProperty="wfeWorkflowPKey" nestingProperty="pKey"
              loadMode="LoadImmediate" />

<!-- ListObject from another module -->
<ListObject name="loInventory" objectClass="LoInventory"
            dataSourceProperty="pKey" listProperty="orderPKey"
            loadMode="LoadOnDemand" />
```

### 3. ProcessContext Declarations

```xml
<Declaration name="VisitList" type="LoAgendaOverview" />   <!-- from Call module -->
<Declaration name="TasksList" type="LoToDoOverview" />     <!-- from Todo module -->
<Declaration name="CardController" type="BoSalesCockpitHelper" /> <!-- from Utilities -->
```

## Module Boundaries

-   **No formal module.json** — boundaries are directory-based
-   Module ownership determined by file path: `src/{Module}/BO/{Object}/`
-   Object names do NOT contain module prefix (BoOrder, not BoOrderOrder)
-   Processes use namespace: `Visit::InfoProcess` = process in Visit module
-   Any module can reference any other module's objects freely

## Utilities Module (Shared Helpers)

| Object                 | Purpose                             | Used By                |
| ---------------------- | ----------------------------------- | ---------------------- |
| `BoSalesCockpitHelper` | Application cockpit card controller | Application            |
| `BoStoreCockpitHelper` | Store cockpit card controller       | Call, Visit, TourVisit |
| `BoUserCockpitHelper`  | User cockpit card controller        | Application            |
| `BoGeoHelper`          | Navigation, geolocation             | Visit, Call            |
| `BoImageHelper`        | Image handling                      | Call, Visit            |
| `BoDateTimeHelper`     | Date/time utilities                 | Multiple               |
| `BoSfHelper`           | Salesforce save/sync utilities      | All modules            |
| `BoChartHelper`        | Chart data preparation              | Analytics              |

## Module Internal Structure

Each module follows the same directory pattern:

```
src/{Module}/
├── BO/              # Business Objects, ListObjects, LookupObjects
│   ├── Bo{Name}/
│   ├── Lo{Name}/
│   └── Lu{Name}/
├── DS/              # DataSources for all objects in this module
├── PR/              # Processes and their UIs
│   └── {Module}_{Feature}/
│       ├── {Module}_{Feature}Process.processflow.xml
│       └── {Module}_{Feature}UI.userinterface.xml
└── PL/              # Print Layouts (optional, mainly Order module)
```

## Cross-References

-   [[architecture-overview]] — Overall system layers
-   [[processes]] — Process invocation via Module::ProcessName
-   [[business-objects]] — ObjectLookup/NestedObject/ListObject cross-module references
