# Business Logic — JBSbatKKOpsvkeiDelTrgtChsht.execute() [51 LOC]

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

## 1. Role

### JBSbatKKOpsvkeiDelTrgtChsht.execute()

This method is the **main batch processing entry point** for identifying and routing deletion-target data associated with **optional service contracts** (オプションサービス契約) in the K-Opticom customer core system. It serves as a **routing dispatcher** that classifies the input by **operation service code (OP_SVC_CD)** and delegates to specialized handler methods, each responsible for extracting and structuring deletion target data for a specific service type.

The method handles **five active optional service categories**: (1) **Email** (B001) — extracts email addresses and mail aliases; (2) **My Homepage** (B002) — extracts homepage URLs and web IDs; (3) **Mailing List** (B003) — extracts mailing list names; (4) **Fixed Global IP Address** (B004) — extracts fixed IP addresses; and (5) **050 Virtual Number** (B029) — extracts 050-series phone numbers. It also supports a **commented-out IPv6** branch (B007) that was previously active but has since been disabled.

Each handler method creates an `outMap` by initializing common fields (service contract number, registration timestamp, etc.) from the input, then populates service-specific deletion target fields, determines the **deletion processing type** (aging update vs. deletion SOD issuance + aging update), and adds the result to the `outputBean`'s output map list. The method follows a **delegation + builder pattern** — the execute method orchestrates, while individual handlers compose output records.

This is a **shared batch utility** invoked by the batch framework (JBSbatBusinessService), designed to be reusable across different optional service deletion workflows. It transforms a single input message (`inMap`) into multiple typed output records, one per deletion-relevant field found.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execute(inMap)"])
    START --> INIT["outputBean = new JBSbatOutputItem()"]
    INIT --> READ["opSvcCd = inMap.getString(OP_SVC_CD)"]

    READ --> COND_EMAIL{opSvcCd equals OP_SVC_CD_EMAIL<br/>B001}
    COND_EMAIL -->|Yes| CALL_EMAIL["setDelTrgtDataEmail"]
    COND_EMAIL -->|No| COND_MYHP{opSvcCd equals OP_SVC_CD_MY_HP<br/>B002}

    COND_MYHP -->|Yes| CALL_MYHP["setDelTrgtDataMyHp"]
    COND_MYHP -->|No| COND_MLLIST{opSvcCd equals OP_SVC_CD_MLLIST<br/>B003}

    COND_MLLIST -->|Yes| CALL_MLLIST["setDelTrgtDataMllist"]
    COND_MLLIST -->|No| COND_FIXIPAD{opSvcCd equals OP_SVC_CD_FIXIPAD<br/>B004}

    COND_FIXIPAD -->|Yes| CALL_FIXIPAD["setDelTrgtDataFixipad"]
    COND_FIXIPAD -->|No| COND_050TEL{opSvcCd equals OP_SVC_CD_050_TELNO<br/>B029}

    COND_050TEL -->|Yes| CALL_050TEL["setDelTrgtData050TelNo"]
    COND_050TEL -->|No| END_RETURN["return outputBean"]

    CALL_EMAIL --> END_RETURN
    CALL_MYHP --> END_RETURN
    CALL_MLLIST --> END_RETURN
    CALL_FIXIPAD --> END_RETURN
    CALL_050TEL --> END_RETURN
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | The input message carrying the **optional service contract identification** and **service-specific deletion target fields**. Contains the operation service code (OP_SVC_CD) that determines which service type is being processed, along with associated data such as email addresses, URLs, phone numbers, or IP addresses depending on the service type. Also carries common fields like service contract number (SVC_KEI_NO), optional service contract number (OP_SVC_KEI_NO), and the order issuance flag (ORDER_UM_FLG) used to determine deletion processing strategy. |

**Instance Fields Read by the Method:** None directly. All constants are resolved at compile time.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSbatKK_T_OP_SVC_KEI.getString` | JBSbatKK_T_OP_SVC_KEI | - | Reads the operation service code (OP_SVC_CD) from the input map key |
| R | `inMap.getString(KEY_URL)` | - | - | Reads the homepage URL from the input map |
| R | `inMap.getString(JBSbatKK_T_OPSVKEI_ISP.MLAD)` | - | - | Reads the email address from the optional service ISP entity |
| R | `inMap.getString(JBSbatKK_T_SBOPSVKEI_ISP.ALIAS)` | - | - | Reads the mail alias from the sub optional service ISP entity |
| R | `inMap.getString(JBSbatKK_T_OPSVKEI_ISP.POP_ID)` | - | - | Reads the POP ID from the optional service ISP entity (IT1-2013-0000285) |
| R | `inMap.getString(JBSbatKK_T_OPSVKEI_ISP.WEB_ID)` | - | - | Reads the web ID from the optional service ISP entity (IT1-2013-0000285) |
| R | `inMap.getString(JBSbatKK_T_OPSVKEI_ISP.MLLIST_NM)` | - | - | Reads the mailing list name from the optional service ISP entity |
| R | `inMap.getString(JBSbatKK_T_OPSVKEI_ISP.KOTEI_IP_AD)` | - | - | Reads the fixed IP address from the optional service ISP entity |
| R | `inMap.getString(JBSbatKK_T_OPSVKEI_TEL.N_050_OP_TELNO)` | - | - | Reads the 050 virtual phone number from the optional service TEL entity |
| R | `inMap.get(KEY_ORDER_UM_FLG)` | - | - | Reads the order issuance condition flag to determine deletion processing type |
| - | `setDelTrgtDataEmail(inMap, outputBean)` | JBSbatKKOpsvkeiDelTrgtChsht | - | Delegates to email-specific deletion data handler |
| - | `setDelTrgtDataMyHp(inMap, outputBean)` | JBSbatKKOpsvkeiDelTrgtChsht | - | Delegates to My Homepage-specific deletion data handler |
| - | `setDelTrgtDataMllist(inMap, outputBean)` | JBSbatKKOpsvkeiDelTrgtChsht | - | Delegates to Mailing List-specific deletion data handler |
| - | `setDelTrgtDataFixipad(inMap, outputBean)` | JBSbatKKOpsvkeiDelTrgtChsht | - | Delegates to Fixed Global IP Address-specific deletion data handler |
| - | `setDelTrgtData050TelNo(inMap, outputBean)` | JBSbatKKOpsvkeiDelTrgtChsht | - | Delegates to 050 Virtual Number-specific deletion data handler |
| - | `initData(inMap)` | JBSbatKKOpsvkeiDelTrgtChsht | - | Initializes a new output map with common service contract fields (contract number, timestamps) |
| - | `getDelTranSbt(inMap)` | JBSbatKKOpsvkeiDelTrgtChsht | - | Determines deletion processing type (aging update only vs. deletion SOD issuance + aging update) based on the order issuance flag |

**CRUD Classification Notes:**

This method is a **data transformation/routing layer** — it does not directly perform database operations. All reads are from the input `JBSbatServiceInterfaceMap` (in-memory data extracted by the batch framework from prior SQL queries). The actual database access occurs upstream (in the batch job's data extraction phase) or downstream (when the output maps are consumed by downstream processing).

- **No C/R/U/D on tables** — all operations are in-memory field extractions and output record constructions.
- The `initData()` helper constructs `JBSbatServiceInterfaceMap` output records with common fields (SVC_KEI_NO, SVC_KEI_GADTM, OPSVKEI_NO, OPSVKEI_GADTM).
- The `getDelTranSbt()` helper determines the deletion processing type based on whether a registration SOD (Service Order Data) has already been issued.

**How deletion processing type is determined (getDelTranSbt):**
- If `ORDER_UM_FLG` is present (non-null, non-empty): `DEL_TRAN_SBT_DEL_SOD_AGING_UPD = "3"` — Deletion SOD issuance + Aging update (full deletion)
- If `ORDER_UM_FLG` is absent/empty: `DEL_TRAN_SBT_AGING_UPD = "2"` — Aging update only (pending deletion)

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatBusinessService Framework | `JBSbatBusinessService.execute()` → `JBSbatKKOpsvkeiDelTrgtChsht.execute(inMap)` | N/A — this method creates output maps for downstream processing |

**Notes:**
- This is a **batch service class** extending `JBSbatBusinessService`. It is invoked by the batch processing framework (JBSbat runtime) through a service registration/routing mechanism, not by direct code-level callers.
- No class in the codebase directly instantiates `JBSbatKKOpsvkeiDelTrgtChsht` and calls `execute()`. The batch framework discovers and invokes this class via class name convention or configuration.
- The sibling class `JBSbatCKkariAddMkDelTrgtChsht` (temporary addition & deletion target classification) shares a similar role but handles different processing (add vs. delete).
- This method's **terminal output** is `JBSbatOutputItem` containing a list of `JBSbatServiceInterfaceMap` records, each tagged with a specific deletion target type code (DEL_TRGT_SBT) and deletion processing type (DEL_TRAN_SBT).

## 6. Per-Branch Detail Blocks

**Block 1** — [METHOD_ENTRY] `execute(JBSbatServiceInterfaceMap inMap)` (L103)

The main entry point. Initializes the output container and reads the operation service code.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outputBean = new JBSbatOutputItem()` — Create empty output container |
| 2 | READ | `opSvcCd = inMap.getString(JBSbatKK_T_OP_SVC_KEI.OP_SVC_CD)` — Get operation service code from input (e.g., "B001", "B002", "B003", "B004", "B029") |

**Block 2** — [IF] `opSvcCd.equals(JBSbatKKConst.OP_SVC_CD_EMAIL) = "B001"` — Email service (L110)

Handles deletion target data for **email services** (Eメール). Routes to `setDelTrgtDataEmail`.

> The email handler extracts email addresses (MLAD) and mail aliases (ALIAS) from the input, creating separate output records for each.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setDelTrgtDataEmail(inMap, outputBean)` — Delegate to email-specific handler |

**Block 3** — [ELSE-IF] `opSvcCd.equals(JBSbatKKConst.OP_SVC_CD_MY_HP) = "B002"` — My Homepage service (L116)

Handles deletion target data for **My Homepage pages** (Myホームページページ). Routes to `setDelTrgtDataMyHp`.

> The My Homepage handler extracts homepage URLs and web IDs from the input.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setDelTrgtDataMyHp(inMap, outputBean)` — Delegate to My Homepage handler |

**Block 4** — [ELSE-IF] `opSvcCd.equals(JBSbatKKConst.OP_SVC_CD_MLLIST) = "B003"` — Mailing List service (L122)

Handles deletion target data for **mailing lists** (メーリングリスト). Routes to `setDelTrgtDataMllist`.

> The mailing list handler extracts mailing list names from the optional service ISP entity data.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setDelTrgtDataMllist(inMap, outputBean)` — Delegate to mailing list handler |

**Block 5** — [ELSE-IF] `opSvcCd.equals(JBSbatKKConst.OP_SVC_CD_FIXIPAD) = "B004"` — Fixed Global IP Address (L128)

Handles deletion target data for **fixed global IP addresses** (固定グローバルIPアドレス). Routes to `setDelTrgtDataFixipad`.

> The fixed IP handler extracts the fixed IP address from the optional service ISP entity data.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setDelTrgtDataFixipad(inMap, outputBean)` — Delegate to fixed IP handler |

**Block 6** — [ELSE-IF] `opSvcCd.equals(JBSbatKKConst.OP_SVC_CD_050_TELNO) = "B029"` — 050 Virtual Number (L134)

Handles deletion target data for **050 virtual number services** (050ナンバープレート). Routes to `setDelTrgtData050TelNo`.

> The 050 number handler extracts the 050-series phone number from the optional service TEL entity data.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setDelTrgtData050TelNo(inMap, outputBean)` — Delegate to 050 number handler |

**Block 7** — [ELSE] — Unknown service code (L140)

No action taken for unrecognized service codes. Falls through to return.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return outputBean` — Return the output item (may contain zero output maps if no matching branch was taken) |

**Block 8** — [COMMENTED-OUT] IPv6 service (L139-L145)

The IPv6 service handler (`OP_SVC_CD_IPV6_AD = "B007"`) has been commented out since a system update. If active, it would call `setDelTrgtDataIpv6(outmap, outputBean, selectWhereParam)`.

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `OP_SVC_CD` | Field | Operation Service Code — classifies the optional service type (B001=Email, B002=My Homepage, B003=Mailing List, B004=Fixed IP, B029=050 Number) |
| `OP_SVC_KEI_NO` | Field | Optional Service Contract Number — internal tracking ID for an optional service contract line item |
| `SVC_KEI_NO` | Field | Service Contract Number — identifies the parent service contract |
| `OP_SVC_KEI_GADTM` | Field | Optional Service Contract Registration Timestamp — date/time when the optional service contract was registered |
| `SVKEI_GADTM` | Field | Service Contract Registration Timestamp — date/time when the main service contract was registered |
| `MLAD` | Field | Email Address — the customer's registered email address (from Optional Service ISP entity) |
| `ALIAS` | Field | Mail Alias — an alias email address associated with the optional service ISP |
| `MLLIST_NM` | Field | Mailing List Name — the name of the mailing list the customer is subscribed to |
| `KOTEI_IP_AD` | Field | Fixed IP Address — the customer's assigned static/global IP address |
| `N_050_OP_TELNO` | Field | 050 Optional Phone Number — the virtual phone number in the 050 number range |
| `WEB_ID` | Field | Web ID — the customer's web portal login identifier (added in IT1-2013-0000285) |
| `POP_ID` | Field | POP ID — Point of Presence identifier for email service access (added in IT1-2013-0000285) |
| `URL` | Field | URL — the customer's My Homepage page URL |
| `ORDER_UM_FLG` | Field | Order Issuance Condition Flag — indicates whether a registration SOD (Service Order Data) has already been issued; used to determine deletion processing strategy |
| `DEL_TRAN_SBT` | Field | Deletion Processing Type — determines how deletion is processed (2=aging update only, 3=deletion SOD issuance + aging update) |
| `DEL_TRGT_SBT` | Field | Deletion Target Type — identifies the specific type of data being deleted (03=Email Address, 04=Mail Alias, 05=Mailing List Name, 07=URL, 08=Fixed IP, 10=050 Number, 14=Web ID, 15=POP ID) |
| B001 | Constant | Email Service — standard email optional service |
| B002 | Constant | My Homepage Service — web page hosting optional service |
| B003 | Constant | Mailing List Service — mailing list subscription optional service |
| B004 | Constant | Fixed Global IP Address Service — static IP address optional service |
| B029 | Constant | 050 Virtual Number Service — virtual phone number optional service |
| B007 | Constant | IPv6 Service — IPv6 connectivity optional service (commented out / deprecated) |
| "2" | Constant | Aging Update Only — deletion processing type where only aging/tombstoning is applied (no SOD re-issuance) |
| "3" | Constant | Deletion SOD Issuance + Aging Update — full deletion path where a new SOD is issued followed by aging update |
| SOD | Acronym | Service Order Data — the telecom order fulfillment document/entity that records service provisioning and changes |
| JBSbatBusinessService | Class | Batch Service Base Class — the abstract base for all batch processing services in the framework |
| JBSbatServiceInterfaceMap | Class | Service Interface Input Map — the in-memory data structure carrying input message fields for batch processing |
| JBSbatOutputItem | Class | Batch Output Item — the output container holding a list of output maps for downstream processing |
| JBSbatKKIFM160 | Class | K-Opticom Batch Interface Field Mapper 160 — defines the field names used in output interface maps (DEL_TRAN_SBT, DEL_TRGT_SBT, MLAD, URL, etc.) |
| IT1-2013-0000285 | Ticket | Internal ticket number — a 2013/02/13 enhancement that added WEB_ID, POPID, and POP_ID field support to the email and My Homepage handlers |
| JBSbatKK_T_OPSVKEI_ISP | Entity | Optional Service ISP Entity — database entity/table holding ISP-related optional service data (email address, fixed IP, mailing list, web ID, POP ID) |
| JBSbatKK_T_SBOPSVKEI_ISP | Entity | Sub Optional Service ISP Entity — database entity/table holding sub-service ISP data (mail alias) |
| JBSbatKK_T_OPSVKEI_TEL | Entity | Optional Service TEL Entity — database entity/table holding telephone-related optional service data (050 numbers) |
| JBSbatKK_T_OP_SVC_KEI | Entity | Optional Service Contract Entity — database entity/table holding optional service contract identification data |
| JBSbatKK_T_SVC_KEI | Entity | Service Contract Entity — database entity/table holding main service contract data |
