# Business Logic — JBSbatKKSkaLckDteEdit.initial() [12 LOC]

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

## 1. Role

### JBSbatKKSkaLckDteEdit.initial()

This method performs the **initialization step** for a batch process that manages **Skappa key information editing for DTE (Data Terminal Equipment / customer premise equipment) lock operations**. Skappa is a smart card used in set-top boxes for content encryption and subscription management. The `initial` method is the standard batch lifecycle entry point — analogous to a `@PostConstruct` or screen-init callback — where the batch framework expects service-specific setup to occur before the main processing (`execute`) method runs.

Its business role is twofold: (1) it registers common batch parameters into the service infrastructure by delegating to the parent class's `setCommonInfo`, and (2) it establishes a prepared database access layer (`JBSbatSQLAccess`) for the `KK_T_IDO_RSV` table, which is the **IDOU (Movement/Transfer) Reservation** table — a staging table used to track reservation records for equipment movement or relocation operations. The constant `D_TBL_NAME_KK_T_IDO_RSV` resolves to `"KK_T_IDO_RSV"`, which stands for **Table: IDOU (Movement) Reservation**.

This method implements the **delegation pattern** — rather than duplicating common setup logic, it delegates to `super.setCommonInfo()`. It also follows the **Template Method pattern** as part of the batch framework's lifecycle where `initial` is overridden by each specific batch service to perform domain-specific initialization. The method itself contains no conditional branches — it is a linear, straightforward setup routine.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["initial(commonItem)"])
    STEP1["SET super.setCommonInfo(commonItem)
Register common batch parameters in service infrastructure"]
    STEP2["SET db_KK_T_IDO_RSV = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_IDO_RSV)
Instantiate DB access object for KK_T_IDO_RSV (IDOU Reservation table)"]
    END_NODE(["Return void"])

    START --> STEP1
    STEP1 --> STEP2
    STEP2 --> END_NODE
```

**Processing Flow:**

1. **Initialize common batch infrastructure** — The method delegates to `super.setCommonInfo(commonItem)` which registers the batch common parameters (`JBSbatCommonItem`) into the parent service class (`JBSbatBusinessService`). This makes the batch context (such as batch ID, execution date, operator info) available throughout the service lifecycle.

2. **Initialize database access for IDOU Reservation table** — The method creates a new `JBSbatSQLAccess` instance, assigning it to the field `db_KK_T_IDO_RSV`. The table name constant `D_TBL_NAME_KK_T_IDO_RSV` resolves to `"KK_T_IDO_RSV"` (Table: IDOU/Movement Reservation). This prepared SQL access object is used by subsequent processing methods (e.g., in the `execute` method) to query and update the IDOU Reservation table. The class also defines `KK_T_IDO_RSV_KK_SELECT_114 = "KK_SELECT_114"` as the SQL definition key for a pre-defined SELECT query against this table.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `commonItem` | `JBSbatCommonItem` | Batch common parameter message — carries the shared batch execution context including batch identifier, execution date/time, operator/user ID, and other metadata common across all batch service types. This object is passed to both the parent's `setCommonInfo` (to register the context) and the `JBSbatSQLAccess` constructor (to configure the database session with the same batch context). |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `D_TBL_NAME_KK_T_IDO_RSV` | `String` (static final) | Table name constant for the IDOU (Movement/Transfer) Reservation table — resolved to `"KK_T_IDO_RSV"` |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `JBSbatBusinessService.setCommonInfo` | - | Service infrastructure | Calls `setCommonInfo` in the parent `JBSbatBusinessService` to register/update common batch parameter context |
| C | `JBSbatSQLAccess` constructor | - | `KK_T_IDO_RSV` | Creates a new `JBSbatSQLAccess` database access object bound to the IDOU Reservation table (`KK_T_IDO_RSV`) using the predefined SQL key `KK_SELECT_114` for subsequent queries |

**Classification rationale:**
- `setCommonInfo` is classified as **U (Update)** because it updates the service's internal context with the common batch parameters.
- The `JBSbatSQLAccess` constructor is classified as **C (Create)** because it instantiates a new database access layer object, preparing the service to read from the `KK_T_IDO_RSV` table in subsequent processing steps.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKSkaLckDteEdit` | Batch framework → `JBSbatKKSkaLckDteEdit.initial(commonItem)` | `setCommonInfo [U] Service Infrastructure`, `JBSbatSQLAccess [C] KK_T_IDO_RSV` |

**Notes:**
- No direct external callers were found for this method. It is designed to be invoked by the **batch framework lifecycle** — the parent class `JBSbatBusinessService` or the batch executor calls `initial()` as the first step before delegating to the `execute()` method.
- The `KK_T_IDO_RSV` table is the terminal database entity accessed through the prepared `db_KK_T_IDO_RSV` field. The SQL definition key `KK_SELECT_114` is used for SELECT queries against this table during later processing.

## 6. Per-Branch Detail Blocks

> **Block 1** — CALL `(super.setCommonInfo(commonItem))` (L68)
>
> Delegates to the parent class to register common batch parameters into the service infrastructure. This is the standard initialization step for all batch services in the framework.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `super.setCommonInfo(commonItem)` // Set common batch parameters — register batch context in parent service [-> JBSbatBusinessService.setCommonInfo] |

**Block 2** — EXEC `(new JBSbatSQLAccess(...))` (L72)
>
> Creates a database access object for the IDOU (Movement/Transfer) Reservation table. The `db_KK_T_IDO_RSV` field is assigned a fresh `JBSbatSQLAccess` instance that will be used by subsequent methods (such as `execute`) to perform SQL operations against this table.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_IDO_RSV = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_IDO_RSV)` // Generate DB access class for IDOU Reservation table [-> D_TBL_NAME_KK_T_IDO_RSV = "KK_T_IDO_RSV"] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `commonItem` | Field | Batch common parameter message — carries shared batch execution context (batch ID, date, operator) across the batch lifecycle |
| `db_KK_T_IDO_RSV` | Field | Database access object for the IDOU Reservation table — prepared SQL interface for reading/writing reservation records |
| `D_TBL_NAME_KK_T_IDO_RSV` | Constant | Table name constant for IDOU (Movement/Transfer) Reservation table — resolves to `"KK_T_IDO_RSV"` |
| `KK_T_IDO_RSV_KK_SELECT_114` | Constant | SQL definition key for a predefined SELECT query on the KK_T_IDO_RSV table — resolves to `"KK_SELECT_114"` |
| `KK_T_IDO_RSV` | Table | IDOU (Movement) Reservation table — stores reservation records for equipment movement/relocation operations |
| IDOU | Japanese term | 移動 (Idou) — "Movement" or "Transfer"; refers to equipment relocation/migration operations in the telecom service domain |
| Skappa | Product name | A smart card used in set-top boxes for content encryption, entitlement management, and subscription control in cable/satellite TV services |
| DTE | Acronym | Data Terminal Equipment — customer premises equipment (e.g., set-top box) that connects to the service provider's network |
| JBSbatCommonItem | Class | Batch common item — the central data carrier that holds shared batch execution parameters passed between batch framework and service methods |
| JBSbatSQLAccess | Class | Batch SQL access utility — a framework class that wraps JDBC database operations for batch processing, providing prepared access to specific database tables |
| JBSbatBusinessService | Class | Parent batch service class — provides common batch lifecycle methods including `setCommonInfo`, `logPrint`, and other shared infrastructure services |
| SPTVKEYINFOOPERATECC | Constant | Skappa Key Information Operation CC — resolves to `"SPTVKEYINFOOPERATECC"`; identifies the Skappa smart card key management sub-system |
| FUNC_CD_UPD | Constant | Function code for Update — resolves to `"1"`; indicates an update operation on Skappa key information |
| FUNC_CD_CHK | Constant | Function code for Check-only — resolves to `"2"`; indicates a validation/check operation without modification |
| SHORI_CD_CRS_CHG | Constant | Processing code for Course Change — resolves to `"2"`; identifies the course change (プラン変更 / plan change) processing type |
| SPTV_APLY_STDARDYMD_DIV_JST | Constant | Skappa Application Standard Date Division: Japan Standard Time — resolves to `"1"`; applies Skappa changes immediately (JST) |
| SPTV_APLY_STDARDYMD_DIV_NXTM | Constant | Skappa Application Standard Date Division: Next Month — resolves to `"2"`; applies Skappa changes at the start of the next month |
