# Business Logic — JBSbatKKOpsvkeiDelTrgtChsht.initData() [22 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKOpsvkeiDelTrgtChsht` |
| Layer | Service (Inferred from package `eo.business.service`) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKOpsvkeiDelTrgtChsht.initData()

The `initData` method serves as a **data initialization and mapping utility** within the K-Opticom batch processing framework. Its business purpose is to extract key service contract identifiers and their associated generation registration timestamps from an incoming service interface map (`inMap`) and transfer them into a freshly constructed outgoing map (`outMap`). This method is called by numerous other processing methods — including `setDelTrgtData050TelNo`, `setDelTrgtDataEmail`, `setDelTrgtDataFixipad`, `setDelTrgtDataMllist`, `setDelTrgtDataMyHp` within the same class, as well as over 40 caller classes spanning communication service component classes (CC) such as `JFUAddChgOptinmRcvsetCC`, `JFUBaseNetChgCommonCC`, and `JFUBaseTvChgCommonCC`. The method acts as a **shared forwarding utility** that ensures the calling component always has access to the core service contract number, option service contract number, and their respective generation timestamps whenever they need to operate on deletion-target data. The Javadoc describes it as "データ初期化処理" (Data Initialization Processing). The method implements a simple **extract-and-forward** pattern: it reads four fields from the input map, and — if the output map is non-null — writes those same four values to the output map using standardized field key constants from the `JBSbatKKIFM160` interface class.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["initData(inMap)"])
    STEP1["outMap = new JBSbatServiceInterfaceMap()"]
    STEP2["Extract svkeiNo: inMap.getString(JBSbatKK_T_SVC_KEI.SVC_KEI_NO)"]
    STEP3["Extract svkeiGadtm: inMap.getString(\"SVKEI_GADTM\")"]
    STEP4["Extract opsvkeiNo: inMap.getString(JBSbatKK_T_OP_SVC_KEI.OP_SVC_KEI_NO)"]
    STEP5["Extract opsvkeiGadtm: inMap.getString(\"OPSVKEI_GADTM\")"]
    COND{outMap != null}
    STEP6["outMap.setString(JBSbatKKIFM160.SVKEI_NO, svkeiNo)"]
    STEP7["outMap.setString(JBSbatKKIFM160.SVKEI_GADTM, svkeiGadtm)"]
    STEP8["outMap.setString(JBSbatKKIFM160.OPSVKEI_NO, opsvkeiNo)"]
    STEP9["outMap.setString(JBSbatKKIFM160.OPSVKEI_GADTM, opsvkeiGadtm)"]
    RETURN_NODE["Return outMap"]
    END(["End"])

    START --> STEP1
    STEP1 --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 --> STEP5
    STEP5 --> COND
    COND -- true --> STEP6
    STEP6 --> STEP7
    STEP7 --> STEP8
    STEP8 --> STEP9
    STEP9 --> RETURN_NODE
    COND -- false --> RETURN_NODE
    RETURN_NODE --> END
```

**Block descriptions:**

1. **Initialization**: A new `JBSbatServiceInterfaceMap` (`outMap`) is created to hold the mapped data.
2. **Extraction Phase**: Four values are read from `inMap` using `getString()`. Each extraction targets a specific business identifier:
   - **Line 186**: `svkeiNo` is extracted using the constant key `JBSbatKK_T_SVC_KEI.SVC_KEI_NO` (resolved value: `"SVC_KEI_NO"`). This represents the **Service Contract Number** from the `KK_T_SVC_KEI` table.
   - **Line 187**: `svkeiGadtm` is extracted using the literal key `"SVKEI_GADTM"`. This represents the **Service Contract Generation Registration DateTime** (when the service contract record was originally created in the database).
   - **Line 188**: `opsvkeiNo` is extracted using `JBSbatKK_T_OP_SVC_KEI.OP_SVC_KEI_NO` (resolved value: `"OP_SVC_KEI_NO"`). This represents the **Option Service Contract Number** from the `KK_T_OP_SVC_KEI` table.
   - **Line 189**: `opsvkeiGadtm` is extracted using the literal key `"OPSVKEI_GADTM"`. This represents the **Option Service Contract Generation Registration DateTime**.
3. **Conditional Assignment**: If `outMap` is not null (always true in practice, since it was just created), the four extracted values are written into `outMap` using the standardized field key constants from `JBSbatKKIFM160`:
   - **Line 192**: `SVKEI_NO` = `svkeiNo` (Service Contract Number)
   - **Line 193**: `SVKEI_GADTM` = `svkeiGadtm` (Service Contract Generation Registration Date/Time)
   - **Line 194**: `OPSVKEI_NO` = `opsvkeiNo` (Option Service Contract Number)
   - **Line 195**: `OPSVKEI_GADTM` = `opsvkeiGadtm` (Option Service Contract Generation Registration Date/Time)
4. **Return**: The populated `outMap` is returned to the caller.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | The input service interface map containing the source data. It carries the full service contract and option service contract context for the batch operation, including the service contract number (`SVC_KEI_NO`), service contract generation timestamp (`SVKEI_GADTM`), option service contract number (`OP_SVC_KEI_NO`), and option service contract generation timestamp (`OPSVKEI_GADTM`). This map is typically passed from a caller method that has already loaded data from the database or parsed an incoming electronic message. |
| 2 | **Implicit instance fields / external state** | — | None. The method is completely stateless with respect to instance variables. It only reads from its parameter (`inMap`) and creates a local `outMap`. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSbatServiceInterfaceMap.getString` | - | - | Extracts service contract number (`SVC_KEI_NO`) from input map. Reads from in-memory data structure. |
| R | `JBSbatServiceInterfaceMap.getString` | - | - | Extracts service contract generation registration timestamp (`SVKEI_GADTM`) from input map. |
| R | `JBSbatServiceInterfaceMap.getString` | - | - | Extracts option service contract number (`OP_SVC_KEI_NO`) from input map. Reads from in-memory data structure. |
| R | `JBSbatServiceInterfaceMap.getString` | - | - | Extracts option service contract generation registration timestamp (`OPSVKEI_GADTM`) from input map. |
| - | `JBSbatServiceInterfaceMap.setString` | - | - | Writes the extracted values to the output map using `JBSbatKKIFM160` field key constants. |

**Notes:**
- This method performs **no direct database CRUD operations**. It is a pure in-memory data mapping utility.
- The `getString` and `setString` calls operate on `JBSbatServiceInterfaceMap`, an in-memory key-value container used throughout the batch framework for data passing between components.
- The source data in `inMap` was previously loaded by upstream callers (screen components, CBS, or batch entry points) via database queries against the `KK_T_SVC_KEI` and `KK_T_OP_SVC_KEI` entity tables.
- The `setString` terminal operations propagate the four values downstream to whatever caller invoked this method, typically so that downstream processing (e.g., deletion-target data setup) has the service contract context it needs.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 14 methods.
Terminal operations from this method: `setString` [-], `setString` [-], `setString` [-], `setString` [-], `setString` [-], `setString` [-], `setString` [-], `setString` [-], `setString` [-], `setString` [-], `setString` [-], `setString` [-], `setString` [-], `setString` [-], `setString` [-], `setString` [-], `setString` [-], `setString` [-], `setString` [-], `setString` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `setDelTrgtData050TelNo` | `JBSbatKKOpsvkeiDelTrgtChsht.setDelTrgtData050TelNo` → `initData` | `setString` [-] |
| 2 | `setDelTrgtDataEmail` | `JBSbatKKOpsvkeiDelTrgtChsht.setDelTrgtDataEmail` → `initData` | `setString` [-] |
| 3 | `setDelTrgtDataFixipad` | `JBSbatKKOpsvkeiDelTrgtChsht.setDelTrgtDataFixipad` → `initData` | `setString` [-] |
| 4 | `setDelTrgtDataMllist` | `JBSbatKKOpsvkeiDelTrgtChsht.setDelTrgtDataMllist` → `initData` | `setString` [-] |
| 5 | `setDelTrgtDataMyHp` | `JBSbatKKOpsvkeiDelTrgtChsht.setDelTrgtDataMyHp` → `initData` | `setString` [-] |
| 6 | `JFUAddChgOptinmRcvsetCC.execute` | `JFUAddChgOptinmRcvsetCC.execute` → `initData` | `setString` [-] |
| 7 | `JFUAddChgOptinmRcvsetCC.getOptinmList` | `JFUAddChgOptinmRcvsetCC.getOptinmList` → `initData` | `setString` [-] |
| 8 | `JFUAddChgOptinmRcvstWkCC.execute` | `JFUAddChgOptinmRcvstWkCC.execute` → `initData` | `setString` [-] |
| 9 | `JFUAddCommonMappingCC.setSvkeiLastUpdDtmByTakino` | `JFUAddCommonMappingCC.setSvkeiLastUpdDtmByTakino` → `initData` | `setString` [-] |
| 10 | `JFUAddDchskmCdCC.addDchskmCd` | `JFUAddDchskmCdCC.addDchskmCd` → `initData` | `setString` [-] |
| 11 | `JFUAddDchskmCdCC.checkDchskmCd` | `JFUAddDchskmCdCC.checkDchskmCd` → `initData` | `setString` [-] |
| 12 | `JFUAddDchskmCdCC.getEKK1391B004` | `JFUAddDchskmCdCC.getEKK1391B004` → `initData` | `setString` [-] |
| 13 | `JFUBaseNetChgCommonCC.newKkopSvcKei` | `JFUBaseNetChgCommonCC.newKkopSvcKei` → `initData` | `setString` [-] |
| 14 | `JFUBaseNetChgCommonCC.getSvcKeiTelInfo` | `JFUBaseNetChgCommonCC.getSvcKeiTelInfo` → `initData` | `setString` [-] |

**Summary:** The method is called by both internal deletion-target data setup methods (within the same class) and by 11+ external CC (Common Component) classes that process various service registration and change operations. The callers span multiple domains: email registration, fixed IP, 050 virtual phone numbers, MyPort mobile, mail lists, and broadband service changes.

## 6. Per-Branch Detail Blocks

**Block 1** — [CONSTRUCTOR] `(new JBSbatServiceInterfaceMap())` (L183)

> Creates a new, empty service interface map to hold the initialized output data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outMap = new JBSbatServiceInterfaceMap()` // Instantiate empty output map |

**Block 2** — [EXTRACTION PHASE] `(Sequential field extraction from inMap)` (L186–L189)

> Extracts four service contract identifiers and their timestamps from the input map. These values are used by callers to establish the service contract context for deletion-target data processing.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `svkeiNo = inMap.getString(JBSbatKK_T_SVC_KEI.SVC_KEI_NO)` | Read Service Contract Number from `KK_T_SVC_KEI` table key [-> `JBSbatKK_T_SVC_KEI.SVC_KEI_NO = "SVC_KEI_NO"`] — The unique identifier for the service contract line |
| 2 | SET | `svkeiGadtm = inMap.getString("SVKEI_GADTM")` | Read Service Contract Generation Registration DateTime — the timestamp when the service contract record was originally created |
| 3 | SET | `opsvkeiNo = inMap.getString(JBSbatKK_T_OP_SVC_KEI.OP_SVC_KEI_NO)` | Read Option Service Contract Number from `KK_T_OP_SVC_KEI` table key [-> `JBSbatKK_T_OP_SVC_KEI.OP_SVC_KEI_NO = "OP_SVC_KEI_NO"`] — The identifier for an option service contract linked to the main service contract |
| 4 | SET | `opsvkeiGadtm = inMap.getString("OPSVKEI_GADTM")` | Read Option Service Contract Generation Registration DateTime — the timestamp when the option service contract record was originally created |

**Block 3** — [IF] `(outMap != null)` (L191)

> Conditional guard to ensure the output map exists before writing. Since `outMap` was just created in Block 1, this branch is always taken in practice. However, the guard provides defensive null-safety for any future modifications.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `outMap.setString(JBSbatKKIFM160.SVKEI_NO, svkeiNo)` | Write Service Contract Number to output map [-> `JBSbatKKIFM160.SVKEI_NO = "SVKEI_NO"`] — Carries the service contract identifier forward for downstream processing |
| 2 | SET | `outMap.setString(JBSbatKKIFM160.SVKEI_GADTM, svkeiGadtm)` | Write Service Contract Generation Registration Date/Time to output map [-> `JBSbatKKIFM160.SVKEI_GADTM = "SVKEI_GADTM"`] |
| 3 | SET | `outMap.setString(JBSbatKKIFM160.OPSVKEI_NO, opsvkeiNo)` | Write Option Service Contract Number to output map [-> `JBSbatKKIFM160.OPSVKEI_NO = "OPSVKEI_NO"`] — Carries the option service contract identifier forward |
| 4 | SET | `outMap.setString(JBSbatKKIFM160.OPSVKEI_GADTM, opsvkeiGadtm)` | Write Option Service Contract Generation Registration Date/Time to output map [-> `JBSbatKKIFM160.OPSVKEI_GADTM = "OPSVKEI_GADTM"`] |

**Block 4** — [ELSE-IF/ELSE] `(implicit: outMap == null — unreachable)` (L191)

> This branch is never reached in normal operation since `outMap` is always non-null after the constructor call in Block 1. It serves as a no-op fallback if the map were somehow null.

| # | Type | Code |
|---|------|------|
| 1 | (none) | *(No operations — null guard bypassed)* |

**Block 5** — [RETURN] `(Return outMap)` (L197)

> Returns the populated output map to the caller, completing the data initialization cycle.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return outMap` // Return initialized map to caller |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service Contract Number — the unique identifier for a service contract line in the `KK_T_SVC_KEI` table. Represents a single service offering (e.g., FTTH broadband, phone service) subscribed by a customer. |
| `svc_kei_gadtm` | Field | Service Contract Generation Registration Date/Time — the timestamp indicating when the service contract record was first created in the database. Used for audit and data lineage tracking. |
| `op_svc_kei_no` | Field | Option Service Contract Number — the unique identifier for an option service contract in the `KK_T_OP_SVC_KEI` table. Option service contracts represent add-on services or supplementary agreements linked to a main service contract. |
| `opsvkei_gadtm` | Field | Option Service Contract Generation Registration Date/Time — the timestamp when the option service contract record was created. Mirrors `svc_kei_gadtm` at the option level. |
| `KK_T_SVC_KEI` | Table | Service Contract entity table — the primary database table storing service contract records. |
| `KK_T_OP_SVC_KEI` | Table | Option Service Contract entity table — the database table storing option/add-on service contract records linked to main service contracts. |
| `JBSbatKKIFM160` | Interface | Interface class defining field key constants for deletion-target data (pre-check) messages. Used to standardize field names when passing data between batch processing components. |
| `JBSbatServiceInterfaceMap` | Class | In-memory key-value container used throughout the K-Opticom batch framework for passing structured data between service components, CBS classes, and batch processing methods. |
| `JBSbatKK_T_SVC_KEI` | Table Constants | Constant class defining field names for the `KK_T_SVC_KEI` service contract table (e.g., `SVC_KEI_NO`, `SVC_CD`, `SVC_KEI_STAT`). |
| `JBSbatKK_T_OP_SVC_KEI` | Table Constants | Constant class defining field names for the `KK_T_OP_SVC_KEI` option service contract table (e.g., `OP_SVC_KEI_NO`, `OP_SVC_CD`, `OP_SVC_KEI_STAT`). |
| データ初期化処理 | Japanese Comment | Data Initialization Processing — the Javadoc description indicating this method prepares/initializes data for downstream use. |
| 入力電文 | Japanese Comment | Input message/electronic data — refers to the incoming `inMap` parameter carrying structured batch data. |
| 消去対象データ | Japanese Context | Deletion-target data — the broader context in which this method operates. The class `JBSbatKKOpsvkeiDelTrgtChsht` collects and prepares data eligible for deletion operations (e.g., data cleanup, contract cancellation processing). |
| CC | Acronym | Common Component — a type of Java class (named `*CC.java`) that provides shared business logic utilities across multiple screen/controller classes. |
| SC | Acronym | Service Component — a layer of classes (typically named `*SC.java`) that encapsulate business logic and interact with the data access layer. |
| Batch | Context | K-Opticom Batch System — a scheduled batch processing framework in the eO Customer Base System that handles periodic data operations including contract cancellations, data cleanup, and bulk processing. |
