# Business Logic — JBSbatKKAdEmgSODSendOutput.terminal() [11 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKAdEmgSODSendOutput` |
| Layer | Service (Batch business service layer) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKAdEmgSODSendOutput.terminal()

This method performs the **business service termination processing** (業務サービス終了処理) for the Emergency Notification SOD (Service Order Data) Send Data Creation class. Its sole responsibility is resource cleanup: it closes three database access layer (`JBSbatSQLAccess`) instances that were opened during the `initial()` phase. These instances correspond to the following database tables: `KK_T_ODR_HAKKO_JOKEN` (Order Release/Condition table), `KK_T_ODR_INF_SKSI_WK` (Order Information Send/Receive Work table), and `KK_T_CHG_AD_JGRTWK` (Change Add Join Release Work table). This is a standard lifecycle method inherited from the `JBSbatBusinessService` base class, implementing a disposal/cleanup pattern typical of enterprise batch service frameworks. The method is tool-generated (its body contains auto-generation markers `ツールから生成した終了処理のソースです` — "Source of termination processing generated from tool") and follows a fixed structural convention: opening resources in `initial()` and closing them in `terminal()`.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["terminal()"])
    STEP1["Close db_KK_T_ODR_HAKKO_JOKEN SQL access"]
    STEP2["Close db_KK_T_ODR_INF_SKSI_WK SQL access"]
    STEP3["Close db_CHG_AD_JGRTWK SQL access"]
    END_NODE(["Return / Next"])
    START --> STEP1 --> STEP2 --> STEP3 --> END_NODE
```

**Processing Flow:**

1. **Close Order Release/Condition DB Access** — Invokes `close()` on the `db_KK_T_ODR_HAKKO_JOKEN` SQL access instance, releasing any database cursors, connections, or transaction resources associated with the `KK_T_ODR_HAKKO_JOKEN` table.
2. **Close Order Info Send/Receive Work DB Access** — Invokes `close()` on the `db_KK_T_ODR_INF_SKSI_WK` SQL access instance, releasing resources tied to the `KK_T_ODR_INF_SKSI_WK` table.
3. **Close Change Add Join Release Work DB Access** — Invokes `close()` on the `db_CHG_AD_JGRTWK` SQL access instance, releasing resources tied to the `KK_T_CHG_AD_JGRTWK` table.
4. **Return** — The method completes with `void` return; control passes back to the caller (typically the batch framework's service lifecycle manager).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no parameters. It operates entirely on instance-level state (the three `JBSbatSQLAccess` fields initialized during `initial()`). |

**Instance Fields Read by This Method:**

| No | Field Name | Type | Business Description |
|----|-----------|------|---------------------|
| 1 | `db_KK_T_ODR_HAKKO_JOKEN` | `JBSbatSQLAccess` | Database access layer for the `KK_T_ODR_HAKKO_JOKEN` (Order Release/Condition) table. Manages SQL operations for emergency notification order records. |
| 2 | `db_KK_T_ODR_INF_SKSI_WK` | `JBSbatSQLAccess` | Database access layer for the `KK_T_ODR_INF_SKSI_WK` (Order Information Send/Receive Work) table. Manages SQL operations for work-item records related to order information exchange. |
| 3 | `db_CHG_AD_JGRTWK` | `JBSbatSQLAccess` | Database access layer for the `KK_T_CHG_AD_JGRTWK` (Change Add Join Release Work) table. Manages SQL operations for change/addition join/release work records. |

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis graph:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `db_KK_T_ODR_HAKKO_JOKEN.close` | JBSbatSQLAccess | - | Closes SQL access for Order Release/Condition table |
| - | `db_KK_T_ODR_INF_SKSI_WK.close` | JBSbatSQLAccess | - | Closes SQL access for Order Information Send/Receive Work table |
| - | `db_CHG_AD_JGRTWK.close` | JBSbatSQLAccess | - | Closes SQL access for Change Add Join Release Work table |

**Notes:** The `close()` method on `JBSbatSQLAccess` is a framework-level resource disposal operation. It is not a CRUD operation per se — it closes the underlying database cursor/connection but does not insert, read, update, or delete business data. The three tables it manages were opened during `initial()` and may have been used for R/U/D operations in other methods of this class or its subclasses.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JBSbatSQLAccess.close` | JBSbatSQLAccess | KK_T_ODR_HAKKO_JOKEN | Releases database resources for the Order Release/Condition table access layer |
| - | `JBSbatSQLAccess.close` | JBSbatSQLAccess | KK_T_ODR_INF_SKSI_WK | Releases database resources for the Order Information Send/Receive Work table access layer |
| - | `JBSbatSQLAccess.close` | JBSbatSQLAccess | KK_T_CHG_AD_JGRTWK | Releases database resources for the Change Add Join Release Work table access layer |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Framework (JBSbatBusinessService lifecycle) | `JBSbatBusinessService.execute()` (framework) -> `JBSbatKKAdEmgSODSendOutput.terminal()` | `db_KK_T_ODR_HAKKO_JOKEN.close [release] KK_T_ODR_HAKKO_JOKEN` |

**Notes:** No direct callers were found in the codebase search. This method is a lifecycle callback of the `JBSbatBusinessService` base class framework, which invokes `terminal()` as part of its standard batch service execution pipeline (after `initial()`, processing methods, and before service completion). It is not called directly from any screen or CBS.

## 6. Per-Branch Detail Blocks

This method contains no conditional branches (if/else, switch/case, loops). It is a linear sequence of three method calls.

**Block 1** — [PROCESS] `(sequential cleanup)` (L222)

> This block represents the entire method body — a straightforward linear sequence of resource cleanup operations generated by the tool framework.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `db_KK_T_ODR_HAKKO_JOKEN.close()` // Close SQL access for Order Release/Condition table [KK_T_ODR_HAKKO_JOKEN] |
| 2 | CALL | `db_KK_T_ODR_INF_SKSI_WK.close()` // Close SQL access for Order Information Send/Receive Work table [KK_T_ODR_INF_SKSI_WK] |
| 3 | CALL | `db_CHG_AD_JGRTWK.close()` // Close SQL access for Change Add Join Release Work table [KK_T_CHG_AD_JGRTWK] |
| 4 | RETURN | `return;` // void return; method completes |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KK_T_ODR_HAKKO_JOKEN` | DB Table | Order Release/Condition table — stores records of order issuance conditions (e.g., immediate issue, service start conditions, agreement-based issuance) for SOD processing |
| `KK_T_ODR_INF_SKSI_WK` | DB Table | Order Information Send/Receive Work table — stores work-item records related to order information exchange between systems |
| `KK_T_CHG_AD_JGRTWK` | DB Table | Change Add Join Release Work table — stores work-item records for change/addition/join/release operations in service contracts |
| SOD | Acronym | Service Order Data — telecom service order fulfillment entity used in the K-Opticom customer backbone system |
| 緊急通報 (Kinkyuu Tsuhou) | Business term | Emergency notification — a priority order type (code `"4"` for `ORDER_SBT_CD`, code `"24"` for `SVC_ORDER_CD`) indicating urgent service changes such as emergency circuit restoration or outage response |
| `ODR_HAKKO_JOKEN_CD` | Field | Order release condition code — classifies the trigger for order issuance; value `"01"` means "immediate issue" (即時発行) |
| `ORDER_SBT_CD` | Field | Order category code — identifies the type of order; value `"4"` denotes emergency notification (緊急通報) |
| `SVC_ORDER_CD` | Field | Service order code — identifies the specific service operation; value `"24"` denotes emergency notification service |
| `YOKYU_SBT_CD` | Field | Request category code — identifies the type of request; value `"04"` denotes change (変更) |
| `ODR_NAIYO_CD` | Field | Order content code — classifies the nature of the order content; value `"251"` denotes emergency notification/change (緊急通報・変更) |
| `SEQ_ODR_HAKKO_JOKEN_NO` | Field | Order release condition number sequence — the database sequence name used to generate unique order release IDs |
| `SEQ_ODR_INF_SKSI_WK_NO` | Field | Order info send/receive work number sequence — the database sequence name used to generate unique work item IDs for order information exchange |
| `SEQ_KETA` | Field | Sequence key length — the number of digits in the generated sequence key; value is 12 |
| JBSbatSQLAccess | Component | Database SQL access framework class — provides a standardized interface for executing SQL operations against database tables in the batch layer |
| JBSbatBusinessService | Component | Base class for batch business services — defines the standard service lifecycle including `initial()`, processing methods, and `terminal()` cleanup |
| 業務サービス終了処理 (Gyoumu Service Shuuryo Shori) | Business term | Business service termination processing — the framework-mandated cleanup phase that releases all acquired resources (DB connections, cursors, transactions) |
| ツール生成 (Tool Sei sei) | Process term | Tool-generated — code auto-generated by the enterprise development tool/framework, as indicated by markers such as `ツールから生成した終了処理のソースです` |

---

*Document generated from source: `source/koptBatch/src/eo/business/service/JBSbatKKAdEmgSODSendOutput.java`, lines 222-232*
