# Business Logic — JBSbatKKBndWdtUpdFile.executeZM_T_DL_FILE_KANRI_PKINSERT() [23 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKBndWdtUpdFile` |
| Layer | Service (Batch domain — part of the `eo.business.service` package extending `JBSbatBusinessService`) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKBndWdtUpdFile.executeZM_T_DL_FILE_KANRI_PKINSERT()

This method performs a **primary-key-based insert** operation for the Download File Management table (`ZM_T_DL_FILE_KANRI`). It is a dedicated batch data-access utility that registers a new row into the file management table with all fields populated — effectively a full-record create operation keyed by primary key columns. The method maps 15 parameters (extracted from a single `Object[]` array argument) onto a `JBSbatCommonDBInterface` map, then delegates to `db_ZM_T_DL_FILE_KANRI.insertByPrimaryKeys()` to persist the record. It follows a simple **extract-mapper-insert** design pattern commonly used in K-Opticom batch services: the caller provides pre-populated parameters, this method assembles them into a database interface object, and delegates the actual SQL `INSERT` to the underlying `JBSbatSQLAccess` infrastructure. This method acts as an internal helper (private) within `JBSbatKKBndWdtUpdFile`, which is a domain-control file download registration component for the eo Customer Base System — meaning it is part of the batch layer of the broadband binding file update workflow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeZM_T_DL_FILE_KANRI_PKINSERT(setParam)"])
    CREATE_MAP["Create JBSbatCommonDBInterface setMap"]
    MAP_1["setMap.setValue(FILE_NO, setParam[0])"]
    MAP_2["setMap.setValue(TRN_KANRI_NO, setParam[1])"]
    MAP_3["setMap.setValue(EFILE_KANRI_NO, setParam[2])"]
    MAP_4["setMap.setValue(FILE_NM, setParam[3])"]
    MAP_5["setMap.setValue(FILE_SIZE, setParam[4])"]
    MAP_6["setMap.setValue(DATA_CNT, setParam[5])"]
    MAP_7["setMap.setValue(FILE_ADD_DTM, setParam[6])"]
    MAP_8["setMap.setValue(FILE_DEL_YMD, setParam[7])"]
    MAP_9["setMap.setValue(ADD_DTM, setParam[8])"]
    MAP_10["setMap.setValue(ADD_OPEACNT, setParam[9])"]
    MAP_11["setMap.setValue(UPD_DTM, setParam[10])"]
    MAP_12["setMap.setValue(UPD_OPEACNT, setParam[11])"]
    MAP_13["setMap.setValue(DEL_DTM, setParam[12])"]
    MAP_14["setMap.setValue(DEL_OPEACNT, setParam[13])"]
    MAP_15["setMap.setValue(MK_FLG, setParam[14])"]
    DB_INSERT["db_ZM_T_DL_FILE_KANRI.insertByPrimaryKeys(setMap)"]
    END_NODE(["Return / Next"])

    START --> CREATE_MAP --> MAP_1 --> MAP_2 --> MAP_3 --> MAP_4 --> MAP_5 --> MAP_6 --> MAP_7 --> MAP_8 --> MAP_9 --> MAP_10 --> MAP_11 --> MAP_12 --> MAP_13 --> MAP_14 --> MAP_15 --> DB_INSERT --> END_NODE
```

**Sequence diagram:**

```mermaid
sequenceDiagram
    participant CALLER as Caller
    participant METHOD as executeZM_T_DL_FILE_KANRI_PKINSERT
    participant MAP as JBSbatCommonDBInterface
    participant DB as db_ZM_T_DL_FILE_KANRI

    CALLER->>METHOD: executeZM_T_DL_FILE_KANRI_PKINSERT(setParam)
    METHOD->>MAP: new JBSbatCommonDBInterface()
    METHOD->>MAP: setValue("FILE_NO", setParam[0])
    METHOD->>MAP: setValue("TRN_KANRI_NO", setParam[1])
    METHOD->>MAP: setValue("EFILE_KANRI_NO", setParam[2])
    METHOD->>MAP: setValue("FILE_NM", setParam[3])
    METHOD->>MAP: setValue("FILE_SIZE", setParam[4])
    METHOD->>MAP: setValue("DATA_CNT", setParam[5])
    METHOD->>MAP: setValue("FILE_ADD_DTM", setParam[6])
    METHOD->>MAP: setValue("FILE_DEL_YMD", setParam[7])
    METHOD->>MAP: setValue("ADD_DTM", setParam[8])
    METHOD->>MAP: setValue("ADD_OPEACNT", setParam[9])
    METHOD->>MAP: setValue("UPD_DTM", setParam[10])
    METHOD->>MAP: setValue("UPD_OPEACNT", setParam[11])
    METHOD->>MAP: setValue("DEL_DTM", setParam[12])
    METHOD->>MAP: setValue("DEL_OPEACNT", setParam[13])
    METHOD->>MAP: setValue("MK_FLG", setParam[14])
    METHOD->>DB: insertByPrimaryKeys(setMap)
    DB-->>METHOD: result
    METHOD-->>CALLER: return
```

**Processing description:**
The method executes a linear, sequential workflow with no conditional branches:
1. **Map creation** — Creates a `JBSbatCommonDBInterface` instance to serve as a parameter map for database operations.
2. **Value mapping** — Maps all 15 fields from the `setParam` `Object[]` array onto the interface map using `setValue()`, with field names as keys and array elements at matching indices as values (indices 0 through 14).
3. **DB insert** — Delegates to `db_ZM_T_DL_FILE_KANRI.insertByPrimaryKeys(setMap)`, which executes a primary-key-based `INSERT` SQL statement against the `ZM_T_DL_FILE_KANRI` table using the populated map.
4. **Return** — Returns `void` to the caller. If `insertByPrimaryKeys` encounters a unique key violation or other constraint error, the underlying infrastructure throws an `Exception`, which propagates to the caller.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `setParam` | `Object[]` | An array of 15 elements containing all fields required to register a row in the Download File Management table. Each element at index `i` maps to the field specified in the Javadoc. Index 0 = FILE_NO (file number), 1 = TRN_KANRI_NO (transaction management number), 2 = EFILE_KANRI_NO (electronic file management number), 3 = FILE_NM (file name), 4 = FILE_SIZE (file size), 5 = DATA_CNT (data record count), 6 = FILE_ADD_DTM (file registration datetime), 7 = FILE_DEL_YMD (file deletion date), 8 = ADD_DTM (registration datetime), 9 = ADD_OPEACNT (registering operator account), 10 = UPD_DTM (update datetime), 11 = UPD_OPEACNT (updating operator account), 12 = DEL_DTM (delete datetime), 13 = DEL_OPEACNT (deleting operator account), 14 = MK_FLG (inactivation flag). The caller is responsible for ensuring the array has at least 15 elements and each element is of the correct type for its corresponding column. |

**Instance fields read:**
| Field | Type | Business Description |
|-------|------|---------------------|
| `db_ZM_T_DL_FILE_KANRI` | `JBSbatSQLAccess` | The database access object configured for the `ZM_T_DL_FILE_KANRI` table, providing `insertByPrimaryKeys` SQL execution capability. Initialized by the framework/parent class lifecycle. |
| `D_TBL_NAME_ZM_T_DL_FILE_KANRI` | `String` (static final) | Table name constant = `"ZM_T_DL_FILE_KANRI"` — the download file management table. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `db_ZM_T_DL_FILE_KANRI.insertByPrimaryKeys` | (framework-level, no SC Code) | `ZM_T_DL_FILE_KANRI` | Inserts a new record into the Download File Management table using the primary-key-based insert method. The `JBSbatCommonDBInterface` map supplies all column values for the new row. |
| - | `JBSbatCommonDBInterface.setValue` | (framework-level) | - | Sets key-value pairs on the database interface map. Called 15 times to populate all fields of the file management record. |

**How to classify:**
- `insertByPrimaryKeys` is classified as **C** (Create) — it performs a database insert.
- `setValue` calls are classified as **-** (utility/framework) — they assemble the parameter map for the insert, not directly performing a CRUD operation.

The `insertByPrimaryKeys` method is a framework method from `JBSbatSQLAccess` that generates and executes an `INSERT INTO ZM_T_DL_FILE_KANRI (ALL_COLUMNS) VALUES (ALL_VALUES)` SQL statement using the keys and values from the provided `JBSbatCommonDBInterface` map.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method: `JBSbatKKBndWdtUpdFile.insertFileKanri()` | `insertFileKanri()` -> `executeZM_T_DL_FILE_KANRI_PKINSERT(setParam)` | `insertByPrimaryKeys [C] ZM_T_DL_FILE_KANRI` |

**Call chain analysis:**
- The method is called internally by `insertFileKanri()`, a sibling method within the same class `JBSbatKKBndWdtUpdFile`. This follows the typical batch service pattern where a public/protected orchestrator method (`insertFileKanri`) assembles parameters and delegates the low-level database insert to the private helper (`executeZM_T_DL_FILE_KANRI_PKINSERT`).
- No screen (KKSV) or batch entry points were found within 8 hops, indicating this method is not a direct user-facing entry point but rather an internal data-access helper used during file download registration processing.

**Terminal operations from this method:**
- `insertByPrimaryKeys [C] ZM_T_DL_FILE_KANRI` — The ultimate terminal operation is a create (insert) on the `ZM_T_DL_FILE_KANRI` table.

## 6. Per-Branch Detail Blocks

This method contains no conditional branches (no `if`, `else`, `switch`, `for`, `while`, or `try/catch`). The entire method is a single linear execution block.

**Block 1** — [LINEAR EXECUTION] (L193)

> (Japanese: 「設定値のマップを作ります」 / English: "Creates a map of setting values")
>
> The method constructs a `JBSbatCommonDBInterface` parameter map from the `setParam` array and delegates to the database insert.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JBSbatCommonDBInterface setMap = new JBSbatCommonDBInterface();` // Create database interface map object [-> L195] |
| 2 | EXEC | `setMap.setValue("FILE_NO", setParam[0]);` // Set file number [L196] |
| 3 | EXEC | `setMap.setValue("TRN_KANRI_NO", setParam[1]);` // Set transaction management number [L197] |
| 4 | EXEC | `setMap.setValue("EFILE_KANRI_NO", setParam[2]);` // Set electronic file management number [L198] |
| 5 | EXEC | `setMap.setValue("FILE_NM", setParam[3]);` // Set file name [L199] |
| 6 | EXEC | `setMap.setValue("FILE_SIZE", setParam[4]);` // Set file size [L200] |
| 7 | EXEC | `setMap.setValue("DATA_CNT", setParam[5]);` // Set data record count [L201] |
| 8 | EXEC | `setMap.setValue("FILE_ADD_DTM", setParam[6]);` // Set file registration datetime [L202] |
| 9 | EXEC | `setMap.setValue("FILE_DEL_YMD", setParam[7]);` // Set file deletion date [L203] |
| 10 | EXEC | `setMap.setValue("ADD_DTM", setParam[8]);` // Set registration datetime [L204] |
| 11 | EXEC | `setMap.setValue("ADD_OPEACNT", setParam[9]);` // Set registering operator account [L205] |
| 12 | EXEC | `setMap.setValue("UPD_DTM", setParam[10]);` // Set update datetime [L206] |
| 13 | EXEC | `setMap.setValue("UPD_OPEACNT", setParam[11]);` // Set updating operator account [L207] |
| 14 | EXEC | `setMap.setValue("DEL_DTM", setParam[12]);` // Set delete datetime [L208] |
| 15 | EXEC | `setMap.setValue("DEL_OPEACNT", setParam[13]);` // Set deleting operator account [L209] |
| 16 | EXEC | `setMap.setValue("MK_FLG", setParam[14]);` // Set inactivation flag [L210] |
| 17 | CALL | `db_ZM_T_DL_FILE_KANRI.insertByPrimaryKeys(setMap);` // Perform PK-based insert into ZM_T_DL_FILE_KANRI table [L213] |

No further nested blocks exist — the method is fully linear.

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ZM_T_DL_FILE_KANRI` | Table | Download File Management table — the database table that tracks file metadata for downloads in the broadband binding system. The `ZM_T_` prefix denotes a management table (管理テーブル). |
| `FILE_NO` | Field | File number — unique identifier for a downloaded file. |
| `TRN_KANRI_NO` | Field | Transaction management number — tracks which processing transaction this file record belongs to. |
| `EFILE_KANRI_NO` | Field | Electronic file management number — unique ID for electronic file management within the system. |
| `FILE_NM` | Field | File name — the name of the downloaded file. |
| `FILE_SIZE` | Field | File size — size of the downloaded file (typically in bytes). |
| `DATA_CNT` | Field | Data count — number of records in the file. |
| `FILE_ADD_DTM` | Field | File registration date/time — timestamp when the file was registered in the system. |
| `FILE_DEL_YMD` | Field | File deletion date — date when the file is marked for deletion (year-month-day format, no time component). |
| `ADD_DTM` | Field | Registration date/time — timestamp of when this row was created in the management table. |
| `ADD_OPEACNT` | Field | Registering operator account — the operator account that performed the registration. |
| `UPD_DTM` | Field | Update date/time — timestamp of the last update to this row. |
| `UPD_OPEACNT` | Field | Updating operator account — the operator account that last updated this row. |
| `DEL_DTM` | Field | Delete date/time — timestamp when this row was soft-deleted. |
| `DEL_OPEACNT` | Field | Deleting operator account — the operator account that performed the deletion. |
| `MK_FLG` | Field | Inactivation flag (無効フラグ) — indicates whether the record is disabled/inactive (soft-delete indicator). |
| `JBSbatCommonDBInterface` | Class | Framework interface for building parameter maps passed to database access methods. Provides `setValue()` to populate key-value pairs. |
| `JBSbatSQLAccess` | Class | Framework class providing SQL execution capabilities including `insertByPrimaryKeys()` for primary-key-based inserts. |
| `insertByPrimaryKeys` | Method | Framework method that generates and executes an INSERT statement using all columns from the provided parameter map, with WHERE clause conditions on primary key columns (for upsert/conflict scenarios). |
| `JBSbatBusinessService` | Class | Parent class for all batch business services in the K-Opticom framework. Provides lifecycle hooks and service infrastructure. |
| `JBSbatKKBndWdtUpdFile` | Class | Broadband Binding File Update — a batch file handling component for the eo Customer Base System that manages file download registration. |
| PK | Abbreviation | Primary Key — the method performs a primary-key-based insert, meaning all primary key fields are populated in the parameter set. |
| K-Opticom | Business term | The telecommunications service provider whose customer base system this code is part of. |
| eo顧客基幹システム | Business term | eo Customer Base System — the core customer management system for K-Opticom's eo broadband service. |
| 領域制御ファイル | Business term | Domain control file — the system component that manages file-level domain operations including download registration. |
